public ActionResult Login(string userNo, string userPwd) { if (!string.IsNullOrWhiteSpace(userNo) && !string.IsNullOrWhiteSpace(userPwd)) { UserAuthorize.Login(userNo, userPwd, this); } return(View()); }
private void Page_Load(object sender, EventArgs e) { this.LoadMenu(); UserProfile userProfile = UserAuthorize.GetUserProfile(this); this.employeeID = int.Parse(userProfile.EmployeeID.ToString()); this.LblSuccess.Visible = false; if (!base.IsPostBack) { this.LoadEmployee(this.employeeID); } }
public ActionResult Login(UserAuthorize model, string returnurl) { EvrimSevinc_BTEntities entity = new EvrimSevinc_BTEntities(); if (ModelState.IsValid) { if (entity.Users.FirstOrDefault(a => a.EMail == model.EMail && a.Password == model.Password) != null) { Session["sessionName"] = "admin"; return(RedirectToAction("Index", "ControlPanel")); } else { ModelState.AddModelError("", "EMail veya şifre hatalı!"); } } return(View(model)); }
private void LoadUserInformation() { DataTable summary = SmartAdmin.Data.Employee.EmployeeList(UserAuthorize.GetUserProfile(this).EmployeeID); if (summary == null) { base.Response.Redirect(Pages.Url(this, Pages.HOME_PAGE)); } DataRow item = summary.Rows[0]; this.LblEmpID.Text = item["EmployeeID"].ToString(); this.LblEmpName.Text = string.Concat(item["FirstName"].ToString(), " ", item["LastName"].ToString()); this.LblEmpNickName.Text = item["NickName"].ToString(); this.LblEmpSex.Text = (item["Sex"].ToString() == "M" ? "Male" : "Female"); this.LblEmpType.Text = item["EmployeeTypeName"].ToString(); this.LblEmpSocialID.Text = item["SocialID"].ToString(); this.LblUserName.Text = this.LblEmpName.Text; if (item["LastLogin"] is DBNull || item["LastLogin"] == null) { this.LblLastLoginText.Text = "This is your first login to smartAdmin."; } else { Label lblLastLoginText = this.LblLastLoginText; DateTime dateTime = (DateTime)item["LastLogin"]; lblLastLoginText.Text = string.Concat("Your last login is ", dateTime.ToString("dd MMM yyyy HH:mm:ss", Home.ci)); } summary = SmartAdmin.Data.Master.GetSummary(); if (summary != null) { item = summary.Rows[0]; this.LblEmployeeCnt.Text = item["EmpCount"].ToString(); this.LblMenuTypeCnt.Text = item["MenuTypeCount"].ToString(); this.LblMenuItemCnt.Text = item["MenuItemCount"].ToString(); this.LblPromotionCnt.Text = item["PromotionCount"].ToString(); this.LblTableCnt.Text = item["TableCount"].ToString(); this.LblCustomerCnt.Text = item["CustomerCount"].ToString(); } }
private void BtnLogin_Click(object sender, EventArgs e) { if (this.TxtEmpID.Text == "" || this.TxtPassword.Text == "") { this.LblError.Text = "Please enter user ID and password."; return; } try { int.Parse(this.TxtEmpID.Text); } catch (Exception exception) { this.LblError.Text = "Your user ID is wrong format."; return; } if (UserAuthorize.Login(this, this.TxtEmpID.Text, this.TxtPassword.Text)) { base.Response.Redirect(Pages.Url(this, Pages.HOME_PAGE)); return; } this.LblError.Text = "Your user ID or password is wrong. Or you don't have authorize to access."; }
private void Page_Load(object sender, EventArgs e) { UserAuthorize.Logout(this); base.Response.Redirect(Pages.Url(this, Pages.HOME_PAGE)); }