コード例 #1
0
        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));
        }
コード例 #2
0
        // 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()));
        }
コード例 #3
0
        // 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());
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        // 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));
        }