private bool CustomSaveOnImport(T_Employee t_employee, out string customerror, int i) { var result = false; customerror = ""; return(result); }
/// <summary> /// 新增一个用户 /// </summary> private void employeeAdd() { string Login = HttpContext.Current.Request.Form["Login"]; string Passwd = HttpContext.Current.Request.Form["Passwd"]; string Name = HttpContext.Current.Request.Form["Name"]; int Sex = Convert.ToInt32(HttpContext.Current.Request.Form["sex"]); string Telephone = HttpContext.Current.Request.Form["Telephone"]; int RoleId = Convert.ToInt32(HttpContext.Current.Request.Form["Role"]); T_Employee employe = new T_Employee { Login = Login, Name = Name, Passwd = Passwd, Sex = Sex, Telephone = Telephone, Role = new T_Role { RoleID = RoleId } }; var obj = new { code = 200, status = "no", msg = "失败" }; if (employeeBll.employeeAdd(employe)) { obj = new { code = 201, status = "yes", msg = "成功" }; } JavaScriptSerializer js = new JavaScriptSerializer(); string str = js.Serialize(obj); HttpContext.Current.Response.Write(str); HttpContext.Current.Response.End(); }
private bool CustomSaveOnEdit(T_Employee t_employee, out bool customsave_hasissues, string command = "") { var result = false; customsave_hasissues = false; return(result); }
/// <summary> /// 登录页面 /// </summary> private void indexLogin() { string lgn = HttpContext.Current.Request.Form["lgn"]; string pwd = HttpContext.Current.Request.Form["pwd"]; var user = indexBll.EmpSelect(lgn, pwd); var obj = new { status = "error" }; if (user.Rows.Count > 0) { //缓存 T_Employee employee = new T_Employee { EmployeeID = Convert.ToInt32(user.Rows[0]["EmployeeID"].ToString()), Login = user.Rows[0]["Login"].ToString(), Passwd = user.Rows[0]["Passwd"].ToString(), Name = user.Rows[0]["Name"].ToString(), Photo = user.Rows[0]["Photo"].ToString(), Sex = Convert.ToInt32(user.Rows[0]["Sex"].ToString()), Telephone = user.Rows[0]["Telephone"].ToString(), Role = new T_Role { RoleID = Convert.ToInt32(user.Rows[0]["RoleID"].ToString()) } }; HttpContext.Current.Cache["emp"] = employee; obj = new { status = "success" }; } JavaScriptSerializer js = new JavaScriptSerializer(); string str = js.Serialize(obj); HttpContext.Current.Response.Write(str); HttpContext.Current.Response.End(); }
/// <summary> /// 编辑用户 /// </summary> private void employeeEdit() { T_Employee emp = new T_Employee { EmployeeID = Convert.ToInt32(HttpContext.Current.Request.Form["EmployeeID"]), Name = HttpContext.Current.Request.Form["Name"], Login = HttpContext.Current.Request.Form["Login"], Passwd = HttpContext.Current.Request.Form["Passwd"], Sex = Convert.ToInt32(HttpContext.Current.Request.Form["sex"]), Telephone = HttpContext.Current.Request.Form["Telephone"], Role = new T_Role { RoleID = Convert.ToInt32(HttpContext.Current.Request.Form["Role"]), } }; var obj = new { code = 200, status = "no", msg = "失败" }; if (employeeBll.employeeEdit(emp)) { obj = new { code = 201, status = "yes", msg = "成功" }; } JavaScriptSerializer js = new JavaScriptSerializer(); var str = js.Serialize(obj); HttpContext.Current.Response.Write(str); HttpContext.Current.Response.End(); }
/// <summary> /// 新增采购订单时 往订单里添加该采购订单的商品 /// </summary> private void CreatePurchaseShop() { //当前登陆人 T_Employee emp = HttpContext.Current.Cache["emp"] as T_Employee; string ListShopId = HttpContext.Current.Request.QueryString["ListShopId"]; string ListNumber = HttpContext.Current.Request.QueryString["ListNumber"]; string PurID = HttpContext.Current.Request.QueryString["PurID"]; int StoreId = Convert.ToInt32(HttpContext.Current.Request.QueryString["StoreId"]); var obj = new { status = "error", code = 200, msg = "请正确填写需要采购商品的数量" }; if (purchaseBll.CreatePurchaseShop(emp.EmployeeID, PurID, StoreId, ListShopId, ListNumber)) { obj = new { status = "success", code = 201, msg = "添加完成" }; } javaScriptSerializer(obj); }
private bool CustomDelete(T_Employee t_employee, out bool customdelete_hasissues, string command = "") { var result = false; customdelete_hasissues = false; return(result); }
//提交按钮 protected void btn_tj_Click(object sender, EventArgs e) { string name = this.txt_name.Text; string img = this.scimg.ImageUrl; int department = Convert.ToInt32(this.ddl_bh.SelectedValue); string sex = "男"; if (this.radbtn_woman.Checked) { sex = "女"; } int age = Convert.ToInt32(this.txt_age.Text); T_Employee emp = new T_Employee { EmployeeName = name, ImageUrl = img, DeptId = department, Sex = sex, Age = age }; if (BLL.T_EmployeeBLL.Add(emp)) { Response.Write("<script>alert('提交成功...')</script>"); } else { Response.Write("<script>alert('提交失败...')</script>"); } }
protected override void AfterSave(Dictionary <string, string> dic, Base.Logic.Domain.S_UI_Form formInfo, bool isNew) { T_Employee employee = BusinessEntities.Set <T_Employee>().Find(dic.GetValue("EmployeeID")); if (employee == null) { throw new Formula.Exceptions.BusinessException("未找到员工对象"); } StringBuilder sql = new StringBuilder(); var currentListStr = dic.GetValue("CurrentJobList"); if (!string.IsNullOrEmpty(currentListStr)) { var list = JsonHelper.ToList(currentListStr); foreach (var item in list) { if (item.GetValue("NeedDelete") == "1") { sql.AppendLine(" delete T_EmployeeJob where id='" + item.GetValue("EmployeeJobID") + "'"); } } } var changeListStr = dic.GetValue("ChangeJobList"); if (!string.IsNullOrEmpty(changeListStr)) { var dtField = DbHelper.GetFieldTable(formInfo.ConnName, "T_EmployeeJob").AsEnumerable(); var list = JsonHelper.ToObject <List <Dictionary <string, string> > >(changeListStr); foreach (var item in list) { item.SetValue("EmployeeID", employee.ID); item.RemoveWhere(a => !dtField.Select(b => b.Field <string>("FIELDCODE").ToUpper()).Contains(a.Key.ToUpper())); sql.AppendLine(item.CreateInsertSql(this.HRSQLDB.DbName, "T_EmployeeJob", FormulaHelper.CreateGuid(), dtField)); } } if (sql.ToString() != "") { if (Config.Constant.IsOracleDb) { this.HRSQLDB.ExecuteNonQuery(string.Format(@" begin {0} end;", sql)); } else { this.HRSQLDB.ExecuteNonQuery(sql.ToString()); } } var updateEmployeeBaseDept = GetQueryString("UpdateEmployeeBaseDept"); if (updateEmployeeBaseDept == "1") { employee.UpdateDeptByJob(); this.BusinessEntities.SaveChanges(); } }
/// <summary> /// 显示用户信息 /// </summary> public void indexUser() { T_Employee emp = HttpContext.Current.Cache["emp"] as T_Employee; JavaScriptSerializer js = new JavaScriptSerializer(); string str = js.Serialize(emp); HttpContext.Current.Response.Write(str); HttpContext.Current.Response.End(); }
public void AfterSave(T_Employee t_employee) { //Do not call db.SaveChanges() for T_Employee otherwise it will be a recursive call. //e.g. send email notification after saving changes. var db1 = new ApplicationContext(new SystemUser()); var status = db1.T_EmployeeStatusCodes.FirstOrDefault(p => p.T_Name == "T"); long statusid = 0; if (status != null) { statusid = status.Id; } if (t_employee.T_EmployeeStatusID == statusid) { bool saveFlagSupervisor = false; var lstJobUnderSupervisor = db1.T_JobAssignments.Where(p => p.T_EmployeeSupervisorID == t_employee.Id).ToList(); foreach (var job in lstJobUnderSupervisor) { if (job.T_EmployeeSupervisorID == t_employee.Id) { var unitXID = job.T_JobAssignmentUnitXID; var unitX = db1.T_UnitXs.Find(unitXID); if (unitX != null && unitX.T_EmployeeUnitXHeadID != null) { job.T_EmployeeSupervisorID = unitX.T_EmployeeUnitXHeadID; db1.Entry(job).State = EntityState.Modified; saveFlagSupervisor = true; } } } if (saveFlagSupervisor) { db1.SaveChanges(); } bool saveFlagManager = false; var lstJobUnderManager = db1.T_JobAssignments.Where(p => p.T_JobAssignmentManagerEmployeeID == t_employee.Id).ToList(); foreach (var job in lstJobUnderManager) { if (job.T_JobAssignmentManagerEmployeeID == t_employee.Id) { var unitXID = job.T_JobAssignmentUnitXID; var unitX = db1.T_UnitXs.Find(unitXID); if (unitX != null && unitX.T_EmployeeAdministratorID != null) { job.T_JobAssignmentManagerEmployeeID = unitX.T_EmployeeAdministratorID; db1.Entry(job).State = EntityState.Modified; saveFlagManager = true; } } } if (saveFlagManager) { db1.SaveChanges(); } } }
// DELETE: api/User/5 public Response Delete(int id) { T_Employee employeeToBeDeleted = dalobj.T_Employee.Find(id); dalobj.T_Employee.Remove(employeeToBeDeleted); dalobj.SaveChanges(); response.Status = "success"; return(response); }
public string CheckBeforeSave(T_Employee t_employee, string command = "") { var AlertMsg = ""; // Write your logic here //Make sure to assign AlertMsg with proper message //AlertMsg = "Validation Alert - Before Save !! Information not saved."; //ModelState.AddModelError("CustomError", AlertMsg); //ViewBag.ApplicationError = AlertMsg; return(AlertMsg); }
/// <summary> /// 根据登录员工权限显示对应功能 /// </summary> private void indexIdx() { //获取登录员工的信息 T_Employee emp = HttpContext.Current.Cache["emp"] as T_Employee; //获取权限信息 var power = indexBll.PowerSelect(emp); JavaScriptSerializer js = new JavaScriptSerializer(); string str = js.Serialize(power); HttpContext.Current.Response.Write(str); HttpContext.Current.Response.End(); }
public bool CheckBeforeDelete(T_Employee t_employee) { var result = true; // Write your logic here if (!result) { var AlertMsg = "Validation Alert - Before Delete !! Information not deleted."; ModelState.AddModelError("CustomError", AlertMsg); ViewBag.ApplicationError = AlertMsg; } return(result); }
// POST: api/User public Response Post([FromBody] T_Employee employee) { if (employee != null) { dalobj.T_Employee.Add(employee); dalobj.SaveChanges(); response.Status = "success"; return(response); } else { response.Status = "Failed"; return(response); } }
public ActionResult Index(T_Employee employee) { var hash = new HashIt(); var result = hash.Hashit(employee.employee_password); user = db.T_Employee.FirstOrDefault(x => x.employee_username.Equals(employee.employee_username) && x.employee_password.Equals(result)); if (user == null) { ViewBag.Mesaj = "Geçersiz kullanıcı adı veya parola"; return(View()); } else { FormsAuthentication.SetAuthCookie(user.employee_username, false); return(RedirectToAction("Index", "Calendar")); } }
/// <summary> /// 编辑用户查询 /// </summary> /// <param name="empId"></param> /// <returns></returns> public static T_Employee empEditSelect(int empId) { string sql = string.Format("select * from T_Employee where EmployeeID={0}", empId); var db = DBHelper.Read(sql); T_Employee employee = new T_Employee { EmployeeID = Convert.ToInt32(db.Rows[0]["EmployeeID"].ToString()), Name = db.Rows[0]["Name"].ToString(), Login = db.Rows[0]["Login"].ToString(), Passwd = db.Rows[0]["Passwd"].ToString(), Sex = Convert.ToInt32(db.Rows[0]["Sex"].ToString()), Telephone = db.Rows[0]["Telephone"].ToString(), Role = new T_Role { RoleID = Convert.ToInt32(db.Rows[0]["RoleID"]) } }; return(employee); }
/// <summary> /// 同步删除的人员到系统用户表 /// </summary> /// <param name="employee"></param> public void EmployeeDeleteToUser(T_Employee employee) { HREntities entities = FormulaHelper.GetEntities <HREntities>(); BaseEntities baseEntities = FormulaHelper.GetEntities <BaseEntities>(); S_A_User user = baseEntities.Set <S_A_User>().Where(t => t.ID == employee.UserID).FirstOrDefault(); if (user != null) { user.DeleteTime = DateTime.Now; user.ModifyTime = user.DeleteTime; user.IsDeleted = "1"; user.Code = user.ID; baseEntities.Set <S_A__RoleUser>().Delete(a => a.UserID == user.ID); var retiredList = entities.Set <T_EmployeeRetired>().Where(c => c.EmployeeID == employee.ID).OrderBy("RetiredDate", false); if (retiredList.Count() > 0) { user.OutDate = retiredList.FirstOrDefault().RetiredDate; } baseEntities.SaveChanges(); } }
//显示数据 public static List <T_Employee> GetList() { string sql = "select * from T_Employee"; DataTable table = DBhelp.Read(sql); List <T_Employee> lst = new List <T_Employee>(); foreach (DataRow row in table.Rows) { T_Employee emp = new T_Employee { EmployeeId = Convert.ToInt32(row["EmployeeId"]), EmployeeName = row["EmployeeName"].ToString(), ImageUrl = row["ImageUrl"].ToString(), DeptId = Convert.ToInt32(row["DeptId"]), Sex = row["Sex"].ToString(), Age = Convert.ToInt32(row["Age"]) }; lst.Add(emp); } return(lst); }
/// <summary> /// 用户管理--查询 /// </summary> /// <param name="page"></param> /// <param name="limit"></param> /// <returns></returns> public static object employeeSelect(int page, int limit) { string sql = string.Format(@"select * from(select ROW_NUMBER() OVER(ORDER BY employeeId desc) as row, EmployeeID,Login, Passwd, T_Employee.Name as empName, Sex, Telephone, T_Role.Name as RoleName from T_Employee join T_Role on T_Employee.RoleID = T_Role.RoleID) o"); string sqlPages = sql + string.Format(" where o.row between ({0}-1)*{1}+1 and {2}*{3} ", page, limit, page, limit); //总查询记录 var employeeTabCount = DBHelper.Read(sql).Rows.Count; //分页后查询数据 var employeeTabPage = DBHelper.Read(sqlPages); List <T_Employee> employeelst = new List <T_Employee>(); foreach (DataRow item in employeeTabPage.Rows) { T_Employee employee = new T_Employee { EmployeeID = Convert.ToInt32(item["EmployeeID"].ToString()), Login = item["Login"].ToString(), Passwd = item["Passwd"].ToString(), Name = item["empName"].ToString(), Sex = Convert.ToInt32(item["Sex"].ToString()), Telephone = item["Telephone"].ToString(), Role = new T_Role { Name = item["RoleName"].ToString() } }; employeelst.Add(employee); } var obj = new { status = employeeTabCount, lst = employeelst }; return(obj); }
// PUT: api/User/5 public Response Put(int id, [FromBody] T_Employee employee) { if (employee != null) { T_Employee employeeToBeUpdated = dalobj.T_Employee.Find(id); if (employee.name != null) { employeeToBeUpdated.name = employee.name; } if (employee.address != null) { employeeToBeUpdated.address = employee.address; } if (employee.phone_number != null) { employeeToBeUpdated.phone_number = employee.phone_number; } if (employee.email != null) { employeeToBeUpdated.email = employee.email; } if (employee.salary != null) { employeeToBeUpdated.salary = employee.salary; } dalobj.SaveChanges(); response.Status = "success"; response.Err = null; return(response); } else { response.Status = "Failed"; return(response); } }
public ActionResult SendEmailtoIT(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } T_Employee t_employee = null; if (db != null) { t_employee = db.T_Employees.Find(id); t_employee.setDateTimeToClientTime(); if (t_employee == null) { return(HttpNotFound()); } } //db is null for 'invoke action' business rule, set your own context here and find object - todo //db.Entry(t_employee).State = EntityState.Modified; //change state if only you want to modify t_employee object string emailTo = "*****@*****.**"; string subject = "WSH Update"; string msgDetails = ""; string style = ""; msgDetails = EntityComparer.EnumeratePropertyValues <T_Employee>(t_employee, "T_Employee", new string[] { "T_SSN", "T_DateOfBirth", "T_CurrentEmployeePayDetailsID", "T_CurrentEmployeeEmploymentProfileID", "T_CurrentEmployeeJobAssignmentID" }); msgDetails = msgDetails.Replace("</table></div>", ""); //current service record style = "background-color: #ffffff; color: black;"; msgDetails += "<tr style=\"" + style + "\"><td width=200>" + ("Employee Type" + " </td><td> " + t_employee.t_currentemployeeemploymentprofile.t_employmentrecordemployeetype.DisplayValue + "</td></tr>"); style = "background-color: #eeeeee; color: black;"; msgDetails += "<tr style=\"" + style + "\"><td width=200>" + ("Hired At Facility" + " </td><td> " + t_employee.t_currentemployeeemploymentprofile.t_employmentrecordhiredatfacility.DisplayValue + "</td></tr>"); style = "background-color: #ffffff; color: black;"; msgDetails += "<tr style=\"" + style + "\"><td width=200>" + ("Hire Date" + " </td><td> " + t_employee.t_currentemployeeemploymentprofile.T_HireDate + "</td></tr>"); style = "background-color: #eeeeee; color: black;"; msgDetails += "<tr style=\"" + style + "\"><td width=200>" + ("Separation Date" + " </td><td> " + t_employee.t_currentemployeeemploymentprofile.T_TerminationDate + "</td></tr>"); //primary job assignment style = "background-color: #ffffff; color: black;"; msgDetails += "<tr style=\"" + style + "\"><td width=200>" + ("Supervisor" + " </td><td> " + t_employee.t_currentemployeejobassignment.t_employeesupervisor.DisplayValue + "</td></tr>"); style = "background-color: #eeeeee; color: black;"; msgDetails += "<tr style=\"" + style + "\"><td width=200>" + ("Manager" + " </td><td> " + t_employee.t_currentemployeejobassignment.t_jobassignmentmanageremployee.DisplayValue + "</td></tr>"); style = "background-color: #ffffff; color: black;"; msgDetails += "<tr style=\"" + style + "\"><td width=200>" + ("Position Level" + " </td><td> " + t_employee.t_currentemployeejobassignment.t_positionjobassignment.DisplayValue + "</td></tr>"); msgDetails += "</table></div>"; SendEmail mail = new SendEmail(); RegisterViewModel usermodel = new RegisterViewModel(); var EmailTemplate = db.EmailTemplates.FirstOrDefault(e => e.associatedemailtemplatetype.DisplayValue == "Business Rule"); if (EmailTemplate != null) { string mailbody = string.Empty; if (!string.IsNullOrEmpty(EmailTemplate.EmailContent)) { mailbody = EmailTemplate.EmailContent; mailbody = mailbody.Replace("###Message###", msgDetails); } if (!string.IsNullOrEmpty(EmailTemplate.EmailSubject)) { subject = EmailTemplate.EmailSubject; } emailTo = string.Join(",", emailTo.Split(',').Distinct().ToArray()); mail.Notify(usermodel.UserName, emailTo, mailbody, subject); } return(Json("Success", "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet)); }
private void btnEmployeeSave_Click(object sender, EventArgs e) { try { if (employeeIDLabel.Text == "") { if (employeeNameTextBox.Text != "") { using (DatabaseConnectionDataContext conn = new DatabaseConnectionDataContext()) { T_Employee table = new T_Employee(); table.employeeNo = SerialGenerator.GenerateSerialNumber(); table.employeeName = employeeNameTextBox.Text; table.employeeSex = employeeSexCombobox.SelectedItem.ToString(); conn.T_Employee.InsertOnSubmit(table); conn.SubmitChanges(); MessageBox.Show(string.Format("添加雇员成功!\n雇员编号:{0}\n雇员姓名:{1}\n雇员性别:{2}", table.employeeNo, table.employeeName, table.employeeSex), "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { if (employeeNameTextBox.Text != "") { using (DatabaseConnectionDataContext conn=new DatabaseConnectionDataContext()) { var res = conn.T_Employee.Where(o => o.employeeNo == employeeIDLabel.Text).FirstOrDefault(); res.employeeName = employeeNameTextBox.Text; res.employeeSex = employeeSexCombobox.SelectedItem.ToString(); conn.SubmitChanges(); MessageBox.Show(string.Format("修改雇员成功!\n雇员编号:{0}\n雇员姓名:{1}\n雇员性别:{2}", res.employeeNo, res.employeeName, res.employeeSex), "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } catch (Exception ee) { MessageBox.Show(ee.Message.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { tabEmployee_Enter(null, null); btnEmployeeCls_Click(null, null); } }
private void CustomLoadViewDataListAfterOnCreate(T_Employee t_employee) { }
private void CustomLoadViewDataListBeforeEdit(T_Employee t_employee) { }
private void CustomLoadViewDataListAfterEdit(T_Employee t_employee) { }
public void OnSaving(T_Employee t_employee, ApplicationContext db) { // Write your logic here }
public void OnDeleting(T_Employee t_employee) { // Write your logic here }
//添加员工--直接向T_Employee中加入 public static bool Add(T_Employee emp) { string sql = string.Format("insert into T_Employee values('{0}','{1}','{2}','{3}','{4}')", emp.EmployeeName, emp.ImageUrl, emp.DeptId, emp.Sex, emp.Age); return(DBhelp.Write(sql)); }
private RedirectToRouteResult CustomRedirectUrl(T_Employee t_employee, string action, string command = "") { // Sample Custom implemention below // return RedirectToAction("Index", "T_Employee"); return(null); }