Пример #1
0
        public string AddSub(EditFuncModel model)
        {
            if (ModelState.IsValid)
            {
                FuncModel func = new FuncModel();
                func.Name = model.Name;                         //英文名称
                func.Title = model.Title;                       //中文名称
                func.DisplayFlag = model.DisplayFlag;           //是否显示
                func.Sortno = model.Sortno;                     //序号
                func.Url = model.Url;                           //链接url
                func.Pid = model.Id.ToInt();                    //上级模块
                func.FullPid = model.FullPid + "-" + model.Id;  //所有上级模块
                func.FuncLevel = model.FuncLevel + 1;           //模块层级
                func.CreateMan = SysConfig.CurrentUser.Id;      //创建人
                func.CreateTime = DateTime.Now;                 //创建时间

                int result = (int)func.Insert();

                if (result > 0)
                {
                    //记录操作日志
                    FuncModel parent = FuncModel.SingleOrDefault(model.Id);
                    CommonMethod.Log(SysConfig.CurrentUser.Id, "Insert", "Sys_Func",
                                  string.Format("给[{0}]模块添加【{1}】子模块",
                                  parent == null ? "" : parent.Title, func.Title));

                    return "1";
                }
            }

            return "0";
        }
Пример #2
0
        public string Add(EditFuncModel model)
        {
            if (ModelState.IsValid)
            {
                FuncModel func = new FuncModel();
                func.Name = model.Name;                         //英文名称
                func.Title = model.Title;                       //中文名称
                func.DisplayFlag = model.DisplayFlag;           //是否显示
                func.Sortno = model.Sortno;                     //序号
                func.Url = model.Url;                           //链接url
                func.Pid = model.Pid;                           //上级模块
                func.FullPid = model.FullPid == null ? "0" : model.FullPid;     //所有上级模块
                func.FuncLevel = model.FuncLevel;               //模块层级
                func.CreateMan = SysConfig.CurrentUser.Id;      //创建人
                func.CreateTime = DateTime.Now;                 //创建时间

                int result = (int)func.Insert();

                if (result > 0)
                {
                    //记录操作日志
                    CommonMethod.Log(SysConfig.CurrentUser.Id, "Insert", "Sys_Func",
                                  string.Format("添加【{0}】模块", func.Title));

                    return "1";
                }
            }

            return "0";
        }