public ActionResult Create(OperationalAuthority collection, string IsContinue = "0") { ReturnMessage RM = new ReturnMessage(false); try { collection.RightsOptions = Request["RightsOptions"]; DateTime now = DateTime.Now; collection.CreateDataTime = now; collection.UpdateTime = now; collection.UpdateUser = CurrentHelper.CurrentUser.User.LoginName; collection.CreateDataUser = CurrentHelper.CurrentUser.User.LoginName; var query = BusinessContext.OperationalAuthority.GetModelList(String.Format("OperRational_Name='{0}'", collection.OperRational_Name)); if (query.Count > 0) { RM.Message = "业务名已被占用"; } else { int Rid = BusinessContext.OperationalAuthority.Add(collection); RM.IsSuccess = Rid > 0; collection.Rid = Rid; if (RM.IsSuccess) { OperateLogHelper.Create <OperationalAuthority>(collection); if (IsContinue == "1") { RM.IsContinue = true; } else { RM.IsContinue = false; } } } } catch (Exception ex) { RM.Message = ex.Message; } return(Json(RM)); }
// // GET: /System/BusinessRights/Edit/5 public ActionResult Edit(int id) { OperationalAuthority model = BusinessContext.OperationalAuthority.GetModel(id); if (model == null) { return(HttpNotFound()); } IList <SelectListItem> RightsOptionsList = new List <SelectListItem>(); string[] RightsArray = model.RightsOptions.Split(','); RightsOptionsList.Add(new SelectListItem { Text = "查看本人", Value = "查看本人", Selected = RightsArray.Contains("查看本人") }); RightsOptionsList.Add(new SelectListItem { Text = "查看下级", Value = "查看下级", Selected = RightsArray.Contains("查看下级") }); RightsOptionsList.Add(new SelectListItem { Text = "查看所有", Value = "查看所有", Selected = RightsArray.Contains("查看所有") }); RightsOptionsList.Add(new SelectListItem { Text = "查看本部门", Value = "查看本部门", Selected = RightsArray.Contains("查看本部门") }); ViewData["RightsOptionsList"] = RightsOptionsList; IList <SelectListItem> OptionList = new List <SelectListItem>(); OptionList = new List <SelectListItem>(); OptionList.Add(new SelectListItem { Text = "单选", Value = "false", Selected = (model.Options == false ? true : false) }); OptionList.Add(new SelectListItem { Text = "多选", Value = "true", Selected = (model.Options == true ? true : false) }); ViewData["OptionList"] = OptionList; return(View(model)); }
public ActionResult Edit(int id, OperationalAuthority collection, FormCollection form) { ReturnMessage RM = new ReturnMessage(false); try { OperationalAuthority old = BusinessContext.OperationalAuthority.GetModel(id); string Rights_select = Request["Rights_select"]; collection.RightsOptions = Rights_select; collection.UpdateUser = CurrentHelper.CurrentUser.User.LoginName; collection.UpdateTime = DateTime.Now; RM.IsSuccess = BusinessContext.OperationalAuthority.Update(collection); if (RM.IsSuccess) { OperateLogHelper.Edit <OperationalAuthority>(collection, old); } } catch (Exception ex) { RM.Message = ex.Message; } return(Json(RM)); }