public ActionResult ViewStaffDetails(string id) { string strErrText; //生成Model数据 long nStaffId = long.Parse(id); StaffSystem staff = new StaffSystem(); Staff data = staff.LoadStaff(nStaffId, LoginAccountId, LoginStaffName, out strErrText); if (data == null) { throw new Exception(strErrText); } StaffViewModel model = new StaffViewModel(); model.Id = data.Id; model.FamilyName = data.FamilyName; model.Name = data.Name; model.Sex = data.Sex; model.OrganId = data.OrganId; model.OrganName = data.OrganName; model.OrganFullName = data.OrganFullName; model.PositionId = data.PositionId; model.PositionName = data.PositionName; model.OfficeTel = data.OfficeTel; model.TelExt = data.TelExt; model.Fax = data.Fax; model.MobileTel1 = data.MobileTel1; model.MobileTel2 = data.MobileTel2; model.MobileTel3 = data.MobileTel3; model.EMail = data.EMail; model.QQ = data.QQ; model.IsOrganManager = data.IsOrganManager; model.IsOrganLeader = data.IsOrganLeader; model.BossStaffId = data.BossStaffId; model.BossStaffName = data.BossStaffName; return View(model); }
public ActionResult ModifyStaff(string id) { string strErrText; //生成Model数据 long nStaffId = long.Parse(id); StaffSystem staff = new StaffSystem(); Staff data = staff.LoadStaff(nStaffId, LoginAccountId, LoginStaffName, out strErrText); if (data == null) { throw new Exception(strErrText); } StaffViewModel model = new StaffViewModel(); model.Id = data.Id; model.FamilyName = data.FamilyName; model.Name = data.Name; model.Sex = data.Sex; model.OrganId = data.OrganId; model.PositionId = data.PositionId; model.OfficeTel = data.OfficeTel; model.TelExt = data.TelExt; model.Fax = data.Fax; model.MobileTel1 = data.MobileTel1; model.MobileTel2 = data.MobileTel2; model.MobileTel3 = data.MobileTel3; model.EMail = data.EMail; model.QQ = data.QQ; model.IsOrganManager = data.IsOrganManager; model.IsOrganLeader = data.IsOrganLeader; model.BossStaffId = data.BossStaffId; //生成组织部门下拉列表项 OrganizationSystem organ = new OrganizationSystem(); List<Organization> listOrganization = organ.LoadOrganizations(LoginAccountId, LoginStaffName, out strErrText); if (listOrganization == null) { throw new Exception(strErrText); } List<SelectListItem> selectListOrganization = new List<SelectListItem>(); selectListOrganization.Add(new SelectListItem { Text = string.Empty, Value = string.Empty }); selectListOrganization.AddRange(from o in listOrganization orderby o.FullName select new SelectListItem { Text = o.FullName, Value = o.Id.ToString() }); ViewData["Organizations"] = new SelectList(selectListOrganization, "Value", "Text", model.OrganId); //生成岗位下拉列表项 PositionSystem position = new PositionSystem(); List<Position> listPosition = position.LoadPositions(LoginAccountId, LoginStaffName, out strErrText); if (listPosition == null) { throw new Exception(strErrText); } List<SelectListItem> selectListPosition = new List<SelectListItem>(); selectListPosition.Add(new SelectListItem { Text = string.Empty, Value = string.Empty }); selectListPosition.AddRange(from p in listPosition select new SelectListItem { Text = p.Name, Value = p.Id.ToString() }); ViewData["Positions"] = new SelectList(selectListPosition, "Value", "Text", model.PositionId); //生成上司下拉列表项 List<Staff> listStaff = staff.LoadStaffsExcludeSelfAndSubordinates(nStaffId, LoginAccountId, LoginStaffName, out strErrText); if (listStaff == null) { throw new Exception(strErrText); } List<SelectListItem> selectListStaff = new List<SelectListItem>(); selectListStaff.Add(new SelectListItem { Text = string.Empty, Value = "0" }); selectListStaff.AddRange(from s in listStaff select new SelectListItem { Text = s.FullName, Value = s.Id.ToString() }); ViewData["Bosses"] = new SelectList(selectListStaff, "Value", "Text", model.BossStaffId); return View(model); }