public ActionResult Update() { string id = Request["id"] ?? ""; string rolename = Request["rolename"] ?? ""; string roledescripe = Request["roledescripe"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; string isclose = Request["isclose"] ?? ""; int uid = int.Parse(id); try { auth_juese p = ob_auth_jueseservice.GetEntityById(auth_juese => auth_juese.ID == uid); p.RoleName = rolename.Trim(); p.RoleDescripe = roledescripe.Trim(); p.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); p.MakeMan = makeman == "" ? 0 : int.Parse(makeman); p.IsClose = isclose == "" ? false : Boolean.Parse(isclose); ob_auth_jueseservice.UpdateEntity(p); ViewBag.saveok = ViewAddTag.ModifyOk; } catch (Exception ex) { Console.WriteLine(ex.Message); ViewBag.saveok = ViewAddTag.ModifyNo; } return(RedirectToAction("Edit", new { id = uid })); }
public ActionResult Save() { string id = Request["id"] ?? ""; string rolename = Request["rolename"] ?? ""; string roledescripe = Request["roledescripe"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; string isclose = Request["isclose"] ?? ""; try { auth_juese ob_auth_juese = new auth_juese(); ob_auth_juese.RoleName = rolename.Trim(); ob_auth_juese.RoleDescripe = roledescripe.Trim(); ob_auth_juese.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); ob_auth_juese.MakeMan = makeman == "" ? 0 : int.Parse(makeman); ob_auth_juese.IsClose = isclose == "" ? false : Boolean.Parse(isclose); ob_auth_juese = ob_auth_jueseservice.AddEntity(ob_auth_juese); ViewBag.auth_juese = ob_auth_juese; } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("Index")); }
public ActionResult Authority() { int userid = (int)Session["user_id"]; string jsid = Request["jsid"] ?? ""; if (jsid == "") { jsid = "0"; } Iauth_jueseService jueseservice = ServiceFactory.auth_jueseservice; auth_juese juese = jueseservice.GetEntityById(auth_juese => auth_juese.ID == int.Parse(jsid) && auth_juese.IsDelete == false); if (juese == null) { return(View()); } auth_authorizeViewModel authorview = new auth_authorizeViewModel(); authorview.RoleID = juese.ID; authorview.RoleName = juese.RoleName; IuserinfoService userservice = ServiceFactory.userinfoservice; IList <userinfo> users = userservice.LoadSortEntities(userinfo => userinfo.IsDelete == false, true, userinfo => userinfo.FullName).ToList <userinfo>(); //Iauth_quanxianService qxservice = ServiceFactory.auth_quanxianservice; IList <auth_quanxian> qxs = ob_auth_quanxianservice.LoadSortEntities(auth_quanxian => auth_quanxian.IsDelete == false && auth_quanxian.JSID == int.Parse(jsid), true, auth_quanxian => auth_quanxian.RYID).ToList <auth_quanxian>(); authorview.AllUser = users; authorview.AuthorizedUser = qxs; return(View(authorview)); }
public ActionResult Edit(int id) { auth_juese tempData = ob_auth_jueseservice.GetEntityById(auth_juese => auth_juese.ID == id && auth_juese.IsDelete == false); ViewBag.auth_juese = tempData; if (tempData == null) { return(View()); } else { auth_jueseViewModel auth_jueseviewmodel = new auth_jueseViewModel(); auth_jueseviewmodel.ID = tempData.ID; auth_jueseviewmodel.RoleName = tempData.RoleName; auth_jueseviewmodel.RoleDescripe = tempData.RoleDescripe; auth_jueseviewmodel.MakeDate = tempData.MakeDate; auth_jueseviewmodel.MakeMan = tempData.MakeMan; auth_jueseviewmodel.IsClose = tempData.IsClose; return(View(auth_jueseviewmodel)); } }