public ActionResult Edit_Selected_Employee_Get(int id) { EmployeeBusinessLayer employeeBusinessLayer = new EmployeeBusinessLayer(); BllEmployee bllEmployee = employeeBusinessLayer.Employees.Single(s => s.EmpId == id); return(View(bllEmployee)); }
public object SaveEmployee(string args, string role) { JsonResponse response = new JsonResponse(); //if (token == CurrentToken()) //{ BllEmployee bl = new BllEmployee(); List <EmployeeATT> ll = JsonUtility.DeSerialize(args, typeof(List <EmployeeATT>)) as List <EmployeeATT>; // response.Message = bl.SaveParameter(ll, role); try { response.Message = bl.SaveEmployee(ll, role); if (response.Message != "") { response.IsSucess = false; } else { response.IsSucess = true; } } catch (Exception ex) { response.Message = ex.Message; response.IsSucess = false; } return(JsonUtility.Serialize(response)); }
public ActionResult Edit_Selected_Employee_Post(int EmpId) { EmployeeBusinessLayer employeeBusinessLayer = new EmployeeBusinessLayer(); BllEmployee bllEmployee = employeeBusinessLayer.Employees.Single(s => s.EmpId == EmpId); TryUpdateModel <IBllEmployee>(bllEmployee); if (ModelState.IsValid) { employeeBusinessLayer.UpdateEmployee(bllEmployee); return(RedirectToAction("GetEmployee")); } return(View()); }
public ActionResult Create_Post() { BllEmployee bllEmployee = new BllEmployee(); TryUpdateModel(bllEmployee); if (ModelState.IsValid) { EmployeeBusinessLayer employeeBusinessLayer = new EmployeeBusinessLayer(); employeeBusinessLayer.CreateEmployee(bllEmployee); return(RedirectToAction("GetEmployee")); } return(View()); }
public BllEmployee MapToBll(DalEmployee entity) { BllEmployee bllEntity = new BllEmployee { Id = entity.Id, Fathername = entity.Fathername, Function = entity.Function, KnowledgeCheckDate = entity.KnowledgeCheckDate, MedicalCheckDate = entity.MedicalCheckDate, Name = entity.Name, Sirname = entity.Sirname }; return(bllEntity); }
public DalEmployee MapToDal(BllEmployee entity) { DalEmployee dalEntity = new DalEmployee { Id = entity.Id, Fathername = entity.Fathername, Function = entity.Function, KnowledgeCheckDate = entity.KnowledgeCheckDate, MedicalCheckDate = entity.MedicalCheckDate, Name = entity.Name, Sirname = entity.Sirname }; return(dalEntity); }
public object DeleteEmployee(int EmpId, string Visibility, string p_rc, string role) { BllEmployee objBll = new BllEmployee(); JsonResponse response = new JsonResponse(); try { response.ResponseData = objBll.DeleteEmployee(EmpId, Visibility, p_rc, role); response.IsSucess = true; } catch (Exception ex) { response.Message = ex.Message; response.IsSucess = false; } return(JsonUtility.Serialize(response)); }
private void btnSave_Click(object sender, EventArgs e) { if (txtNewPwd.Text.Equals(txtReEnter.Text)) { BllEmployee bllEmployee = new BllEmployee(); if (bllEmployee.UpdatePwd(CurrentInfo.currentEmp.EmployeeNo, txtReEnter.Text.Trim())) { MessageBox.Show("修改成功!"); this.Hide(); } else { MessageBox.Show("修改失败,检查后重试!"); } } else { MessageBox.Show("两次密码输入不一致!"); } }
private void btnLogin_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(cmbEmpID.Text.Trim()) || string.IsNullOrEmpty(txtPassword.Text)) { MessageBox.Show(@"请输入账号和密码!"); return; } try { BllEmployee bllEmployee = new BllEmployee(); using (DataTable dsUser = bllEmployee.GetEmployeeInfo(cmbEmpID.Text.Trim())) { if (dsUser == null) { MessageBox.Show(@"工号输入错误或不存在该人员工号!"); cmbEmpID.Text = string.Empty; txtPassword.Text = string.Empty; cmbEmpID.Focus(); return; } if (dsUser.Rows.Count == 0) { MessageBox.Show(@"没有创建该用户!"); cmbEmpID.Text = string.Empty; txtPassword.Text = string.Empty; cmbEmpID.Focus(); return; } if (!dsUser.Rows[0]["DocPassword"].SafeDbValue <string>().Equals(txtPassword.Text)) { MessageBox.Show(@"密码错误,请重新输入!"); txtPassword.Text = string.Empty; txtPassword.Focus(); return; } //保存登录用户信息 Information.CurrentUser = dsUser.Rows[0]; dsUser.Dispose(); } } catch (Exception ex) { MessageBox.Show(@"数据库无法访问!" + ex.ToString()); return; } empID = this.cmbEmpID.Text.Trim(); //记住用户名 if (chkRemenber.Checked) { List <string> lstLoginName = new List <string> { empID }; string[] registry = ResistryKey.GetRegistry(RegisterValueName); if (null != registry) { foreach (string name in registry.TakeWhile(name => lstLoginName.Count < MaxLoginNameSaveCount).Where(name => 0 != StringComparer.CurrentCulture.Compare(empID.ToUpper(), name.ToUpper()))) { lstLoginName.Add(name); } } ResistryKey.SetRegistry(RegisterValueName, lstLoginName.ToArray()); } //用户权限 DataTable dtPower = bllEmpPower.GetEmpPower(empID); for (int i = 0; i < dtPower.Rows.Count; i++) { Information.UsePower.Add(Convert.ToInt32(dtPower.Rows[i]["PowerID"]), dtPower.Rows[i]["DocID"].ToString()); } //主界面 FrmMain frmMain = new FrmMain(); this.Hide(); frmMain.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnLogin_Click(object sender, System.EventArgs e) { if (string.IsNullOrEmpty(cmbEmpID.Text) || string.IsNullOrEmpty(txtPassword.Text)) { MessageBox.Show(@"请输入账号和密码!"); return; } BllServer bllServer = new BllServer(); BllEmployee bllEmployee = new BllEmployee(); BllEmpPowers bllEmpPowers = new BllEmpPowers(); try { if (bllServer.TestConnection()) { using (DataTable dtUser = bllEmployee.GetEmployeeInfo(cmbEmpID.Text, 0)) { if (dtUser == null) { MessageBox.Show(@"工号输入错误或不存在该人员工号!"); cmbEmpID.Text = string.Empty; txtPassword.Text = string.Empty; cmbEmpID.Focus(); return; } if (dtUser.Rows.Count == 0) { MessageBox.Show(@"没有创建该工号!"); cmbEmpID.Text = string.Empty; txtPassword.Text = string.Empty; cmbEmpID.Focus(); return; } if (!dtUser.Rows[0]["Password"].ToString().Equals(txtPassword.Text)) { MessageBox.Show(@"密码错误,请重新输入!"); txtPassword.Text = string.Empty; txtPassword.Focus(); return; } if (chkRemember.Checked) { //记住用户名 string strLoginName = cmbEmpID.Text; List <string> lstLoginName = new List <string> { strLoginName }; string[] registry = ResistryKey.GetRegistry(RegisterValueName); if (null != registry) { foreach (string name in registry.TakeWhile(name => lstLoginName.Count < MaxLoginNameSaveCount).Where(name => 0 != StringComparer.CurrentCulture.Compare(strLoginName.ToUpper(), name.ToUpper()))) { lstLoginName.Add(name); } } ResistryKey.SetRegistry(RegisterValueName, lstLoginName.ToArray()); } //保存用户信息 Employee employee = new Employee(); employee.EmployeeNo = dtUser.Rows[0]["EmployeeNo"].ToString(); employee.EmployeeName = dtUser.Rows[0]["EmployeeName"].ToString(); employee.Age = Convert.ToInt32(dtUser.Rows[0]["Age"]); employee.Gender = dtUser.Rows[0]["Gender"].ToString(); employee.MoblePhone = dtUser.Rows[0]["MoblePhone"].ToString(); employee.PassWord = dtUser.Rows[0]["PassWord"].ToString(); CurrentInfo.currentEmp = employee; dtUser.Dispose(); //用户权限 Dictionary <int, string> empPowersLst = new Dictionary <int, string>(); DataTable dtPower = bllEmpPowers.GetEmpPowers(cmbEmpID.Text); for (int i = 0; i < dtPower.Rows.Count; i++) { if (!empPowersLst.ContainsKey(Convert.ToInt32(dtPower.Rows[i]["PowerNo"]))) { empPowersLst.Add(Convert.ToInt32(dtPower.Rows[i]["PowerNo"]), dtPower.Rows[i]["EmployeeNo"].ToString()); } } CurrentInfo.currentPowers = empPowersLst; dtPower.Dispose(); //List<EmpPowers> empPowersLst = new List<EmpPowers>(); //DataTable dtPower = bllEmpPowers.GetEmpPowers(cmbEmpID.Text); //for (int i = 0; i < dtPower.Rows.Count; i++) //{ // EmpPowers empPowers = new EmpPowers(); // empPowers.EmployeeNo = dtPower.Rows[0]["EmployeeNo"].ToString(); // empPowers.PowerNo = dtPower.Rows[0]["PowerNo"].ToString(); // empPowersLst.Add(empPowers); //} FrmMain frmMain = new FrmMain(); this.Hide(); frmMain.ShowDialog(); } } else { MessageBox.Show(@"网络连接失败,检查网络后重试!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); Application.Exit(); Application.ExitThread(); } }
public BllCertificate GetCertificateByEmployeeAndControlName(BllEmployee employee, BllControlName name) { return(mapper.MapToBll(uow.Certificates.GetCertificateByEmployeeIdAndControlId(employee.Id, name.Id))); }