/// <summary> /// 员工信息 /// </summary> /// <param name="hallNo">服务厅编号</param> /// <returns></returns> public ActionResult GetStaffs(string hallNo) { var staffDal = new SYS_STAFF_DAL(); var list = staffDal.GetListByHallNo(hallNo); return(Json(list.Select(m => new SelectListItem() { Text = m.STAFF_NAM, Value = m.STAFF_ID }), JsonRequestBehavior.AllowGet)); }
public ActionResult Detail(string hallNo, int id) { try { var staffDal = new SYS_STAFF_DAL(); var list = staffDal.GetListByHallNo(hallNo); var staffSelectList = list.Select(m => new SelectListItem() { Text = m.STAFF_NAM, Value = m.STAFF_ID }).ToList(); staffSelectList.Insert(0, new SelectListItem() { Text = "公假", Value = "-1" }); var staffMap = staffSelectList.ToDictionary(m => m.Value); var counterDal = new CHK_COUNTER_DAL(); var counter = counterDal.GetCounterByHallNoCounterId(hallNo, id); var item = new CunterViewModel() { CounterId = counter.COUNTER_ID, HallName = counter.HALL_NAM, HallNo = counter.HALL_NO, Note = counter.NOTE, W1A_STAFF_NAME = staffMap.ContainsKey(counter.W1A_STAFF_ID) ? staffMap[counter.W1A_STAFF_ID].Text : "公假", W1P_STAFF_NAME = staffMap.ContainsKey(counter.W1P_STAFF_ID) ? staffMap[counter.W1P_STAFF_ID].Text : "公假", W2A_STAFF_NAME = staffMap.ContainsKey(counter.W2A_STAFF_ID) ? staffMap[counter.W2A_STAFF_ID].Text : "公假", W2P_STAFF_NAME = staffMap.ContainsKey(counter.W2P_STAFF_ID) ? staffMap[counter.W2P_STAFF_ID].Text : "公假", W3A_STAFF_NAME = staffMap.ContainsKey(counter.W3A_STAFF_ID) ? staffMap[counter.W3A_STAFF_ID].Text : "公假", W3P_STAFF_NAME = staffMap.ContainsKey(counter.W3P_STAFF_ID) ? staffMap[counter.W3P_STAFF_ID].Text : "公假", W4A_STAFF_NAME = staffMap.ContainsKey(counter.W4A_STAFF_ID) ? staffMap[counter.W4A_STAFF_ID].Text : "公假", W4P_STAFF_NAME = staffMap.ContainsKey(counter.W4P_STAFF_ID) ? staffMap[counter.W4P_STAFF_ID].Text : "公假", W5A_STAFF_NAME = staffMap.ContainsKey(counter.W5A_STAFF_ID) ? staffMap[counter.W5A_STAFF_ID].Text : "公假", W5P_STAFF_NAME = staffMap.ContainsKey(counter.W5P_STAFF_ID) ? staffMap[counter.W5P_STAFF_ID].Text : "公假", W6A_STAFF_NAME = staffMap.ContainsKey(counter.W6A_STAFF_ID) ? staffMap[counter.W6A_STAFF_ID].Text : "公假", W6P_STAFF_NAME = staffMap.ContainsKey(counter.W6P_STAFF_ID) ? staffMap[counter.W6P_STAFF_ID].Text : "公假", W7A_STAFF_NAME = staffMap.ContainsKey(counter.W7A_STAFF_ID) ? staffMap[counter.W7A_STAFF_ID].Text : "公假", W7P_STAFF_NAME = staffMap.ContainsKey(counter.W7P_STAFF_ID) ? staffMap[counter.W7P_STAFF_ID].Text : "公假" }; return(View(item)); } catch (Exception ex) { LogHelper.ErrorLog("查看出错", ex); return(RedirectToAction("Error", "Home")); } }
private void setSatffSelectItem(string hallNo) { var staffDal = new SYS_STAFF_DAL(); var list = staffDal.GetListByHallNo(hallNo); var staffSelectList = list.Select(m => new SelectListItem() { Text = m.STAFF_NAM, Value = m.STAFF_ID }).ToList(); staffSelectList.Insert(0, new SelectListItem() { Text = "公假", Value = "-1" }); ViewBag.StaffSelectList = staffSelectList; }