public ActionResult Create([Bind(Include = "id,code,usertypeid_fx,moduleid_fx,isdefault,isenable,isread,iswrite,desc_text,remark,whocreateid_fx,createdate")] SYS_UTYPE_MODULE sYS_UTYPE_MODULE) { Model1 ef = new Model1(); String username = Request.Cookies["username"].Value.ToString(); String cuuserid = ef.SYS_USER.Where(item => item.account_id == username).First <SYS_USER>().id.ToString(); var obj = ef.SYS_UTYPE_MODULE.Where(item => item.id > 0); int nowcode = 0, maxid = 0; if (obj.Count <SYS_UTYPE_MODULE>() > 0) { maxid = obj.Max(item => item.id); nowcode = maxid + 1; } else { nowcode = 1; } sYS_UTYPE_MODULE.whocreateid_fx = int.Parse(cuuserid); sYS_UTYPE_MODULE.createdate = DateTime.Now; sYS_UTYPE_MODULE.code = "UTM" + nowcode.ToString().PadLeft(5, '0'); if (ModelState.IsValid) { db.SYS_UTYPE_MODULE.Add(sYS_UTYPE_MODULE); db.SaveChanges(); return(RedirectToAction("Index")); } List <SYS_USERTYPE> categories_ug = SYS_USERTYPE.GETALL(); ViewData["categories_ug"] = new SelectList(categories_ug, "id", "typename"); List <SYS_MODULE> categories_mo = SYS_MODULE.GETALL(); ViewData["categories_mo"] = new SelectList(categories_mo, "id", "name"); return(View(sYS_UTYPE_MODULE)); }
// GET: SYS_UTYPE_MODULE public ActionResult Index(int?searchUtype, int?searchModule) { var utms = from s in db.SYS_UTYPE_MODULE select s; List <SYS_USERTYPE> categories_Utype = SYS_USERTYPE.GETALL(); ViewData["categories_Utype"] = new SelectList(categories_Utype, "id", "typename"); List <SYS_MODULE> categories_Mod = SYS_MODULE.GETALL(); ViewData["categories_Mod"] = new SelectList(categories_Mod, "id", "name"); if (searchUtype != null) {//用户组筛选 utms = utms.Where(s => s.usertypeid_fx == searchUtype); } else { utms = utms.Where(s => s.usertypeid_fx == 7); } if (searchModule != null) {//模块筛选 utms = utms.Where(s => s.moduleid_fx == searchModule); } return(View(utms.ToList())); }
// GET: SYS_USER public ActionResult Index(string searchName, int?searchDep, int?searchUtype, int?pageNum) { var users = from s in db.SYS_USER select s; List <SYS_DEPART> categories_Dep = SYS_DEPART.GETALL(); ViewData["categories_Dep"] = new SelectList(categories_Dep, "id", "name"); List <SYS_USERTYPE> categories_Utype = SYS_USERTYPE.GETALL(); ViewData["categories_Utype"] = new SelectList(categories_Utype, "id", "typename"); if (searchDep != null) {//部门筛选 users = users.Where(s => s.departid_fx == searchDep); } if (searchUtype != null) {//用户组筛选 users = users.Where(s => s.usertypeid_fx == searchUtype); } if (!String.IsNullOrEmpty(searchName)) {//搜索名称 users = users.Where(s => s.cname.Contains(searchName)); } users = users.OrderBy(s => s.departid_fx); return(View(users.ToPagedList(pageNum ?? 1, 5))); }
// GET: SYS_UTYPE_MODULE/Create public ActionResult Create() { List <SYS_USERTYPE> categories_ug = SYS_USERTYPE.GETALL(); ViewData["categories_ug"] = new SelectList(categories_ug, "id", "typename"); List <SYS_MODULE> categories_mo = SYS_MODULE.GETALL(); ViewData["categories_mo"] = new SelectList(categories_mo, "id", "name"); return(View()); }
// GET: SYS_USER/Create public ActionResult Create() { List <SYS_USERTYPE> categories_ug = SYS_USERTYPE.GETALL(); ViewData["categories_ug"] = new SelectList(categories_ug, "id", "typename"); List <SYS_DEPART> categories = SYS_DEPART.GETALL(); ViewData["Categories"] = new SelectList(categories, "id", "name"); return(View()); }
public ActionResult Edit([Bind(Include = "id,code,usertypeid_fx,moduleid_fx,isdefault,isenable,isread,iswrite,desc_text,remark,whocreateid_fx,createdate")] SYS_UTYPE_MODULE sYS_UTYPE_MODULE) { if (ModelState.IsValid) { db.Entry(sYS_UTYPE_MODULE).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } List <SYS_USERTYPE> categories_ug = SYS_USERTYPE.GETALL(); ViewData["categories_ug"] = new SelectList(categories_ug, "id", "typename"); List <SYS_MODULE> categories_mo = SYS_MODULE.GETALL(); ViewData["categories_mo"] = new SelectList(categories_mo, "id", "name"); return(View(sYS_UTYPE_MODULE)); }
public ActionResult Edit([Bind(Include = "id,code,cname,account_id,pwd,birthdate,tel,email,departid_fx,usertypeid_fx,desc_text,remark,whocreateid_fx,createdate")] SYS_USER sYS_USER) { if (ModelState.IsValid) { db.Entry(sYS_USER).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } List <SYS_DEPART> categories = SYS_DEPART.GETALL(); ViewData["Categories"] = new SelectList(categories, "id", "name"); List <SYS_USERTYPE> categories_ug = SYS_USERTYPE.GETALL(); ViewData["categories_ug"] = new SelectList(categories_ug, "id", "typename"); return(View(sYS_USER)); }
// GET: SYS_UTYPE_MODULE/Edit/5 public ActionResult Edit(int?id) { List <SYS_USERTYPE> categories_ug = SYS_USERTYPE.GETALL(); ViewData["categories_ug"] = new SelectList(categories_ug, "id", "typename"); List <SYS_MODULE> categories_mo = SYS_MODULE.GETALL(); ViewData["categories_mo"] = new SelectList(categories_mo, "id", "name"); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SYS_UTYPE_MODULE sYS_UTYPE_MODULE = db.SYS_UTYPE_MODULE.Find(id); if (sYS_UTYPE_MODULE == null) { return(HttpNotFound()); } return(View(sYS_UTYPE_MODULE)); }
// GET: SYS_USER/Edit/5 public ActionResult Edit(int?id) { List <SYS_DEPART> categories = SYS_DEPART.GETALL(); ViewData["Categories"] = new SelectList(categories, "id", "name"); List <SYS_USERTYPE> categories_ug = SYS_USERTYPE.GETALL(); ViewData["categories_ug"] = new SelectList(categories_ug, "id", "typename"); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SYS_USER sYS_USER = db.SYS_USER.Find(id); if (sYS_USER == null) { return(HttpNotFound()); } return(View(sYS_USER)); }
public ActionResult Create([Bind(Include = "id,code,cname,account_id,birthdate,tel,email,departid_fx,usertypeid_fx,desc_text,remark,whocreateid_fx,createdate")] SYS_USER sYS_USER) { Model1 ef = new Model1(); String username = Request.Cookies["username"].Value.ToString(); String cuuserid = ef.SYS_USER.Where(item => item.account_id == username).First <SYS_USER>().id.ToString(); var obj = ef.SYS_USER.Where(item => item.id > 0); int nowcode = 0, maxid = 0; if (obj.Count <SYS_USER>() > 0) { maxid = obj.Max(item => item.id); nowcode = maxid + 1; } else { nowcode = 1; } sYS_USER.pwd = "123456"; sYS_USER.whocreateid_fx = int.Parse(cuuserid); sYS_USER.createdate = DateTime.Now; sYS_USER.code = "USR" + nowcode.ToString().PadLeft(5, '0'); if (ModelState.IsValid) { db.SYS_USER.Add(sYS_USER); db.SaveChanges(); return(RedirectToAction("Index")); } List <SYS_DEPART> categories = SYS_DEPART.GETALL(); ViewData["Categories"] = new SelectList(categories, "id", "name"); List <SYS_USERTYPE> categories_ug = SYS_USERTYPE.GETALL(); ViewData["categories_ug"] = new SelectList(categories_ug, "id", "typename"); return(View(sYS_USER)); }