Exemplo n.º 1
0
 public ActionResult Detail(ModuleDb model, bool isGoToList = true, bool isEdit = false)
 {
     if (ModelState.IsValid)
     {
         model.module_code = model.module_code.Trim();
         if (isEdit)
         {
             if (model != null)
             {
                 model.modifi_name = LoginUser.user_name;
                 model.modifi_date = DateTime.Now;
                 ModuleBll.Instance.Update(model);
             }
         }
         else
         {
             if (ModuleBll.Instance.GetModule(model.module_code) != null)
             {
                 ModelState.AddModelError("", "该code已经存在!");
                 return(View(model));
             }
             var pater = ModuleBll.Instance.GetModule(model.parent_code);
             if (pater != null)
             {
                 ViewBag.PaterName  = pater.module_name;
                 model.parent_code  = pater.module_code;
                 model.module_level = pater.module_level + 1;
             }
             else
             {
                 model.parent_code  = "";
                 model.module_level = 1;
             }
             model.action_url   = model.action_url ?? "";
             model.creator_name = LoginUser.user_name;
             model.creator_date = DateTime.Now;
             ModuleBll.Instance.Add(model);
         }
         if (isGoToList)
         {
             return(Content("<script> window.parent.location.reload();</script>"));
         }
     }
     return(View(model));
 }
Exemplo n.º 2
0
        /// <summary>
        /// 返回当前请求的Module和它的上一级Module 下标0是上级Module,下标1是当前UrlModule
        /// </summary>
        /// <returns></returns>
        public List <ModuleDb> GetThisModuleAndParentMoudule()
        {
            ModuleBll       moduleBll  = new ModuleBll();
            string          url        = AppUrl();
            ModuleDb        thisModule = moduleBll.GetModuleOnUrl(url);
            List <ModuleDb> list       = new List <ModuleDb>();

            if (thisModule != null)
            {
                ModuleDb parentModule = moduleBll.GetModule(thisModule.parent_code);

                if (thisModule != null && parentModule != null)
                {
                    list.Add(parentModule);
                    list.Add(thisModule);
                }
            }


            return(list);
        }
Exemplo n.º 3
0
        public ActionResult Detail(string paterCode = "", string code = "", bool isReadonly = false)
        {
            ViewBag.IsReadonly = isReadonly;
            ViewBag.PaterName  = "";
            ModuleDb model = new ModuleDb();

            if (!string.IsNullOrEmpty(code))
            {
                ViewBag.EditType = 2;
                model            = ModuleBll.Instance.GetModule(code);
                if (model != null && !string.IsNullOrEmpty(model.parent_code))
                {
                    paterCode = model.parent_code;
                }
            }
            else
            {
                ViewBag.EditType    = 1;
                model.module_code   = code;
                model.is_menu       = 1;
                model.module_status = 1;
            }
            var pater = ModuleBll.Instance.GetModule(paterCode);

            if (pater != null)
            {
                ViewBag.PaterName  = pater.module_name;
                model.parent_code  = paterCode;
                model.module_level = pater.module_level + 1;
            }
            else
            {
                model.parent_code  = "";
                model.module_level = 1;
            }
            return(View(model));
        }