public ActionResult CheckLogin(string Password) { try { StaffModel item = null; int result = 0; var UserGet = UserService.GetStaffByUserName(Class.UserName); foreach (StaffModel _item in UserGet) { item = new StaffModel(); item.UserName = _item.UserName; item.Password = _item.Password; } string PassCompare = StaffModel.Decrypt(item.Password); if (Password == PassCompare) { result = 1; this.Session["User"] = item; } return(Json(result, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(ex, JsonRequestBehavior.AllowGet)); } }
private void textBox1_TextChanged(object sender, EventArgs e) { if (usermodel.StaffID > 0) { var passcheck = StaffModel.Decrypt(usermodel.Password); var passinput = textBox1.Text; SetImgLogin(passinput); if (passinput.Count() == 4) { if (passinput == passcheck) { if (CheckCallform == 0) { UserLoginModel.UserLoginInfo = usermodel; frmMain frm = new frmMain(); frm.ShowDialog(); this.Close(); } else { this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } } else { var passshow = textBox1.Text; if (passshow.Count() > 0) { this.lblMessger.Visible = true; //frmMessager frm = new frmMessager("Messenger", "Pin code isn't correct."); //frm.ShowDialog(); textBox1.Text = ""; } } } } else { var passshow = textBox1.Text; if (passshow.Count() > 0) { frmMessager frm = new frmMessager("Messenger", "Please chose user name"); frmOpacity.ShowDialog(this, frm); textBox1.Text = ""; } } }
void addStaffDetail(StaffModel data) { // pDetail.Controls.Clear(); if (data.StaffID > 0) { UCUserListDetail ucUserDetail = new UCUserListDetail(); if (pDetail.Controls.Count > 0) { ucUserDetail = (UCUserListDetail)pDetail.Controls[0]; } else { ucUserDetail.Dock = DockStyle.Fill; pDetail.Controls.Add(ucUserDetail); } // ucUserDetail.Dock = DockStyle.Fill; ucUserDetail.lbTitle.Text = data.Fname + " " + data.Lname; ucUserDetail.txtFname.Text = data.Fname; ucUserDetail.txtLname.Text = data.Lname; ucUserDetail.txtUserName.Text = data.UserName; ucUserDetail.txtPinCode.Text = StaffModel.Decrypt(data.Password); var department = UserService.GetListDepartment().ToList(); ucUserDetail.cbRole.DisplayMember = "Value"; ucUserDetail.cbRole.ValueMember = "Key"; var textDefault = ""; ucUserDetail.cbRole.Items.Clear(); foreach (var item in department) { if (item.DepartmentID == data.DepartmentID) { textDefault = item.DepartmentName; } var temp = new KeyValueModel(); temp.Key = item.DepartmentID; temp.Value = item.DepartmentName; ucUserDetail.cbRole.Items.Add(temp); } if (textDefault != "") { ucUserDetail.cbRole.Text = textDefault; } else { ucUserDetail.cbRole.SelectedIndex = 0; } ucUserDetail.btnSave.Tag = data; ucUserDetail.btnSave.Click += btnSaveUser_Click; ucUserDetail.btnDelete.Tag = data; ucUserDetail.btnDelete.Click += btnDeleteUser_Click; ucUserDetail.btnDelete.Show(); } }