Ejemplo n.º 1
0
        public void SaveData(ModSysRole t)
        {
            BllSysRole    bll  = new BllSysRole();
            ModJsonResult json = new ModJsonResult();

            t.Status    = (int)StatusEnum.正常;
            t.CreaterId = CurrentMaster.Id;        //创建人编号
            t.RoleType  = CurrentMaster.Attribute; //角色类型
            if (string.IsNullOrEmpty(t.CompanyID))
            {
                t.CompanyID = CurrentMaster.Cid;
            }
            if (!string.IsNullOrEmpty(Request["modify"])) //修改
            {
                var model = bll.LoadData(t.Id);
                model.Name         = t.Name;
                model.Introduction = t.Introduction;
                int result = bll.Update(model);
                if (result <= 0)
                {
                    json.success = false;
                    json.msg     = "修改失败,请稍后再操作!";
                }
            }
            else
            {
                t.Id = Guid.NewGuid().ToString();
                int result = bll.Insert(t);
                if (result <= 0)
                {
                    json.success = false;
                    json.msg     = " 保存失败,请稍后再操作!";
                }
            }

            LogInsert(OperationTypeEnum.操作, "角色配置", CurrentMaster.UserName + "角色配置新增或修改操作正常.");

            WriteJsonToPage(json.ToString());
        }