public ActionResult Release_Partial(int mt, string org) { if (mt == 1) { ViewBag.STAFFLIST = new SelectList(DaoStaff.FindList("STAFF_ID asc", "ORG_ID", org), "STAFF_ID", "STAFF_NAM"); return(PartialView("Partial/Release_STAFF")); } if (mt == 2) { var hall = DaoHall.GetEntity("ORG_ID", org); if (null != hall) { ViewBag.COUNTERLIST = new SelectList(DaoCounter.FindList("COUNTER_ID asc", "HALL_NO", hall.HALL_NO) , "COUNTER_ID", "COUNTER_ID"); } return(PartialView("Partial/Release_COUNTER")); } if (mt == 3) { var hall = DaoHall.GetEntity("ORG_ID", org); if (null != hall) { ViewBag.TABLELIST = new SelectList(DaoTable.FindList("", "HALL_NO", hall.HALL_NO), "TABLE_CD", "TABLE_NAM"); } return(PartialView("Partial/Release_TABLE")); } return(Redirect("/Home/Error")); }
public ActionResult Create(WARN_RELEASE_STAFF_DETAIL info) { try { CHKVALID(info); info.RELEASE_TIME = DateTime.Now; info.RELEASE_USER_ID = UserState.UserID; string mtype = Request["MType"]; if (mtype == "3" || mtype == "2")//发送给看板 { if (ModelState.ContainsKey("STAFF_ID")) { ModelState.Remove("STAFF_ID"); } } if (!ModelState.IsValid) { ModelState.AddModelError("", "数据验证出错!"); return(JsonResult(false, "新增失败!", "WARN")); } if (mtype == "1")//发送给员工 { string reqstaffid = Request["STAFF_ID"]; if (string.IsNullOrEmpty(reqstaffid)) { ModelState.AddModelError("STAFF_ID", "请选择所要发布的员工编码!"); return(JsonResult(false, "新增失败!", "WARN")); } var arrstaffid = reqstaffid.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); List <WARN_RELEASE_STAFF_DETAIL> stafflist = new List <WARN_RELEASE_STAFF_DETAIL>(); foreach (string staffid in arrstaffid) { var obj = CommonHelper.DeepClone <WARN_RELEASE_STAFF_DETAIL>(info); obj.STAFF_ID = staffid; obj.CLI_READ_IND = false; stafflist.Add(obj); } dao.AddObject(stafflist); } if (mtype == "2")//发送给窗口 { string reqCOUNTER_ID = Request["COUNTER_ID"]; if (string.IsNullOrEmpty(reqCOUNTER_ID)) { ModelState.AddModelError("COUNTER_ID", "请选择所要发布的窗口!"); return(JsonResult(false, "新增失败!", "WARN")); } var arrcounter = reqCOUNTER_ID.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); List <WARN_RELEASE_COUNTER_DETAIL> counterlist = new List <WARN_RELEASE_COUNTER_DETAIL>(); var counterall = DaoCounter.FindList(); foreach (string counterid in arrcounter) { var nobj = new WARN_RELEASE_COUNTER_DETAIL { RELEASE_USER_ID = info.RELEASE_USER_ID, RELEASE_TIME = info.RELEASE_TIME, RELEASE_MESSAGE = info.RELEASE_MESSAGE, HALL_NO = counterall.FirstOrDefault(obj => obj.COUNTER_ID == int.Parse(counterid)).HALL_NO, COUNTER_ID = int.Parse(counterid), BEGIN_TIME = info.BEGIN_TIME, END_TIME = info.END_TIME, TITLE = info.TITLE }; counterlist.Add(nobj); } DaoReleaseCounter.AddObject(counterlist); } if (mtype == "3")//发送给看板 { string reqTABLE_CD = Request["TABLE_CD"]; if (string.IsNullOrEmpty(reqTABLE_CD)) { ModelState.AddModelError("TABLE_CD", "请选择所要发布的看板!"); return(JsonResult(false, "新增失败!", "WARN")); } var arrtable = reqTABLE_CD.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); List <WARN_RELEASE_TABLE_DETAIL> tablelist = new List <WARN_RELEASE_TABLE_DETAIL>(); var tableall = DaoTable.FindList(); foreach (string table in arrtable) { var nobj = new WARN_RELEASE_TABLE_DETAIL { RELEASE_USER_ID = info.RELEASE_USER_ID, RELEASE_TIME = info.RELEASE_TIME, RELEASE_MESSAGE = info.RELEASE_MESSAGE, HALL_NO = tableall.FirstOrDefault(obj => obj.TABLE_CD == table).HALL_NO, TABLE_CD = table, BEGIN_TIME = info.BEGIN_TIME, END_TIME = info.END_TIME, TITLE = info.TITLE }; tablelist.Add(nobj); } DaoReleaseTable.AddObject(tablelist); } return(JsonResult(true, "新增成功!", "WARN")); } catch (Exception ex) { LogHelper.ErrorLog("系统错误", ex); ModelState.AddModelError("", "系统错误!"); return(Redirect("/Home/Error")); } }