Demo entry 6346781

速度

   

Submitted by anonymous on Feb 13, 2017 at 04:12
Language: C#. Code size: 1.4 kB.

protected void user_login_Click(object o, EventArgs e)
{
	object vcodeinss = Session["verifyCode"];
	Session.Remove("verifyCode");
	ValidateObject validateResult = ValidationHelper.Validate(
		new ValidateObject(!string.IsNullOrEmpty(username.Value.Trim()), "* 用户名不能为空!"),
		new ValidateObject(!string.IsNullOrEmpty(password.Value.Trim()), "* 密码不能为空!")
		
	);
	if (!validateResult.IsValid)
	{
		ExamAppHelper.DialogAlert(validateResult.ErrorMessage, string.Empty);
		return;
	}

	IDataReader udr = DbHelperCache.Default.ExecuteReader("select * from [exam_view_examineeIncludeDeptName] where [username]=@username and [password]=@password", ParameterCreator.VarChar("@username", 50, username.Value), ParameterCreator.VarChar("@password", 50, Examinee.HashPassword(password.Value)));
	if (udr.Read())
	{
		if (Convert.ToBoolean(udr["disabled"]))
		{
			ExamAppHelper.DialogAlert("此用户已被禁用!", string.Empty);
			goto LOGEND;
		}
		#region 检查是否管理员(管理员roleid字段为空)
		object role = udr["departId"];
		string strRole = string.Empty;
		strRole = role.ToString();
		#endregion

		ExamineeFormsUser.LogIn(udr["eid"].ToString(), udr["name"].ToString(), strRole, udr["name"].ToString());
	
		Response.Redirect("~/index_2.aspx");
	}
	else
	{
		ExamAppHelper.DialogAlert("用户名或密码不正确!", string.Empty);
	}

LOGEND:
	if (!udr.IsClosed)
		udr.Close();
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).