public JsonResult Create(SysModuleModel model)
        {
            model.Id = ResultHelper.NewId;
            model.CreateTime = ResultHelper.NowTime;
            model.CreatePerson = GetUserId();
            if (model != null && ModelState.IsValid)
            {

                if (m_BLL.Create(ref errors, model))
                {
                    SysLogBLL.WriteServiceLog(GetUserId(), "Id" + model.Id + ",Name" + model.Name, "成功", "创建", "SysModule");
                    return Json(JsonHandler.CreateMessage(1, Suggestion.InsertSucceed));
                }
                else
                {
                    string ErrorCol = errors.Error;
                    SysLogBLL.WriteServiceLog(GetUserId(), "Id" + model.Id + ",Name" + model.Name + "," + ErrorCol, "失败", "创建", "SysModule");
                    return Json(JsonHandler.CreateMessage(0, Suggestion.InsertFail + ErrorCol));
                }
            }
            else
            {
                return Json(JsonHandler.CreateMessage(0, Suggestion.InsertFail));
            }
        }
 public ActionResult Create(string id)
 {
     ViewBag.Perm = GetPermission();
     SysModuleModel entity = new SysModuleModel()
     {
         ParentId = id,
         Enable = true,
         Sort = 0
     };
     return View(entity);
 }
 public bool Create(ref ValidationErrors errors, SysModuleModel model)
 {
     try
     {
         SysModule entity = m_Rep.GetById(model.Id);
         if (entity != null)
         {
             errors.Add(Suggestion.PrimaryRepeat);
             return false;
         }
         entity = new SysModule();
         entity.Id = model.Id;
         entity.Name = model.Name;
         entity.EnglishName = model.EnglishName;
         entity.ParentId = model.ParentId;
         entity.Url = model.Url;
         entity.Iconic = model.Iconic;
         entity.Sort = model.Sort;
         entity.Remark = model.Remark;
         entity.Enable = model.Enable;
         entity.CreatePerson = model.CreatePerson;
         entity.CreateTime = model.CreateTime;
         entity.IsLast = model.IsLast;
         if (m_Rep.Create(entity) == 1)
         {
             //分配给角色
             dbContainer.P_Sys_InsertSysRight();
             return true;
         }
         else
         {
             errors.Add(Suggestion.InsertFail);
             return false;
         }
     }
     catch (Exception ex)
     {
         errors.Add(ex.Message);
         ExceptionHander.WriteException(ex);
         return false;
     }
 }
 public SysModuleModel GetById(string id)
 {
     if (IsExist(id))
     {
         SysModule entity = m_Rep.GetById(id);
         SysModuleModel model = new SysModuleModel();
         model.Id = entity.Id;
         model.Name = entity.Name;
         model.EnglishName = entity.EnglishName;
         model.ParentId = entity.ParentId;
         model.Url = entity.Url;
         model.Iconic = entity.Iconic;
         model.Sort = entity.Sort;
         model.Remark = entity.Remark;
         model.Enable = entity.Enable;
         model.CreatePerson = entity.CreatePerson;
         model.CreateTime = entity.CreateTime;
         model.IsLast = entity.IsLast;
         return model;
     }
     else
     {
         return null;
     }
 }
        public bool Edit(ref ValidationErrors errors, SysModuleModel model)
        {
            try
            {
                SysModule entity = m_Rep.GetById(model.Id);
                if (entity == null)
                {
                    errors.Add(Suggestion.Disable);
                    return false;
                }
                entity.Name = model.Name;
                entity.EnglishName = model.EnglishName;
                entity.ParentId = model.ParentId;
                entity.Url = model.Url;
                entity.Iconic = model.Iconic;
                entity.Sort = model.Sort;
                entity.Remark = model.Remark;
                entity.Enable = model.Enable;
                entity.IsLast = model.IsLast;

                if (m_Rep.Edit(entity) == 1)
                {
                    return true;
                }
                else
                {
                    errors.Add(Suggestion.EditFail);
                    return false;
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message);
                ExceptionHander.WriteException(ex);
                return false;
            }
        }
 public JsonResult Edit(SysModuleModel model)
 {
     if (model != null && ModelState.IsValid)
     {
         if (m_BLL.Edit(ref errors, model))
         {
             SysLogBLL.WriteServiceLog(GetUserId(), "Id" + model.Id + ",Name" + model.Name, "成功", "修改", "系统菜单");
             return Json(JsonHandler.CreateMessage(1, Suggestion.EditSucceed));
         }
         else
         {
             string ErrorCol = errors.Error;
             SysLogBLL.WriteServiceLog(GetUserId(), "Id" + model.Id + ",Name" + model.Name + "," + ErrorCol, "失败", "修改", "系统菜单");
             return Json(JsonHandler.CreateMessage(0, Suggestion.EditFail + ErrorCol));
         }
     }
     else
     {
         return Json(JsonHandler.CreateMessage(0, Suggestion.EditFail));
     }
 }