public ActionResult Delete(string id) { try { var arrid = id.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var _id in arrid) { int mt = int.Parse(_id.Split('-')[1]); if (mt == 1) { dao.Delete("STAFF_DETAIL_ID", int.Parse(_id.Split('-')[0])); } if (mt == 2) { DaoReleaseCounter.Delete("COUNTER_DETAIL_ID", int.Parse(_id.Split('-')[0])); } if (mt == 3) { DaoReleaseTable.Delete("TABLE_DETAIL_ID", int.Parse(_id.Split('-')[0])); } } return(RedirectToAction("/")); } catch (Exception ex) { LogHelper.ErrorLog("删除出错", ex); 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")); } }