/// <summary> /// 公用添加转岗记录 /// </summary> /// <param name="userid"></param> /// <param name="deptid"></param> /// <param name="job">职务</param> /// /// <param name="Position">岗位</param> public void edituser(string userid, string deptid, string job, string Position) { try { UserExperiencBLL exbll = new UserExperiencBLL(); UserEntity user = new UserBLL().GetEntity(userid); UserExperiencEntity userEx = new UserExperiencEntity(); userEx.ExperiencId = Guid.NewGuid().ToString(); userEx.StartTime = DateTime.Now.ToString("yyyy-MM-dd"); userEx.EndTime = ""; userEx.Isend = true; userEx.isupdate = false; userEx.createuserid = user.UserId; userEx.createtime = DateTime.Now; userEx.createuser = user.RealName; var dept = getDepartmentList("", "厂级,部门,班组"); //获取部门和班组 var userDept = dept.FirstOrDefault(x => x.DepartmentId == deptid); if (userDept.Nature == "班组") { var userParent = dept.FirstOrDefault(x => x.DepartmentId == userDept.ParentId); var company = dept.FirstOrDefault(x => x.DepartmentId == userParent.DepartmentId); userEx.Commpany = company.FullName; userEx.Department = userDept.FullName; } else { var company = dept.FirstOrDefault(x => x.DepartmentId == userDept.DepartmentId); userEx.Commpany = company.FullName; userEx.Department = userDept.FullName; } userEx.Jobs = job; userEx.Position = Position; exbll.add(userEx); } catch (Exception) { throw; } }
public string OperationBlltoerchtms(UserWorkAllocationEntity entity) { try { UserBLL userbll = new UserBLL(); UserExperiencBLL exbll = new UserExperiencBLL(); if (entity.userId.Contains(',')) { var userList = entity.userId.Split(',').ToList(); foreach (var item in userList) { UserEntity user = userbll.GetEntity(entity.userId); UserExperiencEntity userEx = new UserExperiencEntity(); userEx.ExperiencId = Guid.NewGuid().ToString(); userEx.StartTime = DateTime.Now.ToString("yyyy-MM-dd"); userEx.EndTime = ""; userEx.Isend = true; userEx.isupdate = false; userEx.createuserid = item; userEx.createtime = DateTime.Now; userEx.createuser = user.RealName; userEx.Jobs = ""; userEx.Position = ""; service.Operationleave(entity); exbll.add(userEx); } return("操作成功"); } else { UserEntity user = userbll.GetEntity(entity.userId); var dept = getDepartmentList("", "厂级,部门,班组"); UserExperiencEntity userEx = new UserExperiencEntity(); userEx.ExperiencId = Guid.NewGuid().ToString(); userEx.StartTime = DateTime.Now.ToString("yyyy-MM-dd"); userEx.EndTime = "至今"; userEx.Isend = true; userEx.isupdate = false; userEx.createuserid = user.UserId; userEx.createtime = DateTime.Now; userEx.createuser = user.RealName; //不等于空离厂时间 if (!string.IsNullOrEmpty(entity.leavetime)) { userEx.Jobs = ""; userEx.Position = ""; service.Operationleave(entity); exbll.add(userEx); return("操作成功"); } else { //获取部门和班组 var userDept = dept.FirstOrDefault(x => x.DepartmentId == entity.departmentid); if (userDept.Nature == "班组") { var userParent = dept.FirstOrDefault(x => x.DepartmentId == userDept.ParentId); var company = dept.FirstOrDefault(x => x.DepartmentId == userParent.ParentId); userEx.Commpany = company.FullName; userEx.Department = userParent.FullName + "/" + userDept.FullName; } else { var company = dept.FirstOrDefault(x => x.DepartmentId == userDept.ParentId); userEx.Commpany = company.FullName; userEx.Department = userDept.FullName; } userEx.Jobs = entity.quarters; userEx.Position = entity.RoleDutyName; service.OperationJobs(entity); exbll.add(userEx); return("操作成功"); } } } catch (Exception) { throw; } }