Exemplo n.º 1
0
        public ActionResult Create(SysOperation entity)
        {
            if (entity != null && ModelState.IsValid)
            {
                string currentPerson = GetCurrentPerson();
                entity.CreateTime = DateTime.Now;
                entity.CreatePerson = currentPerson;

                entity.Id = Result.GetNewId();
                string returnValue = string.Empty;
                if (m_BLL.Create(ref validationErrors, entity))
                {
                    LogClassModels.WriteServiceLog(Suggestion.InsertSucceed  + ",操作的信息的Id为" + entity.Id,"操作"
                        );//写入日志
                    return Json(Suggestion.InsertSucceed);
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return true;
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",操作的信息," + returnValue,"操作"
                        );//写入日志
                    return Json(Suggestion.InsertFail  + returnValue); //提示插入失败
                }
            }

            return Json(Suggestion.InsertFail + ",请核对输入的数据的格式"); //提示输入的数据的格式不对
        }
Exemplo n.º 2
0
        public ActionResult Create(string id)
        {
            if (!string.IsNullOrWhiteSpace(id))
            {
                using (SysMenuBLL bll = new SysMenuBLL())
                {
                    SysMenu entityId = bll.GetById(id);
                    if (entityId != null)
                    {
                        SysOperation entity = new SysOperation();
                        entity.SysMenuId = id + '&' + entityId.Name;
                        return View(entity);
                    }
                }
            }

            return View();
        }
Exemplo n.º 3
0
 public ActionResult SetSysMenu(SysOperation entity)
 {
     if (entity != null)
     {
         string currentPerson = GetCurrentPerson();
         //entity.UpdateTime = DateTime.Now;
         //entity.UpdatePerson = currentPerson;
         string returnValue = string.Empty;
         if (m_BLL.SetSysMenu(ref validationErrors, entity))
         {
             LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",角色信息的Id为" + entity.Id, "消息"
                 );//写入日志
             return Json(Suggestion.UpdateSucceed); //提示更新成功
         }
         else
         {
             if (validationErrors != null && validationErrors.Count > 0)
             {
                 validationErrors.All(a =>
                 {
                     returnValue += a.ErrorMessage;
                     return true;
                 });
             }
             LogClassModels.WriteServiceLog(Suggestion.DeleteFail + ",信息的Id为" + entity.Id + "," + returnValue, "消息"
                 );//删除失败,写入日志
             return Json(Suggestion.UpdateFail + returnValue);
          }
     }
     else
     {
         return Json(Suggestion.UpdateFail + ",请核对输入的数据的格式"); //提示输入的数据的格式不对
     }
 }
Exemplo n.º 4
0
        public ActionResult Edit(string id, SysOperation entity)
        {
            if (entity != null && ModelState.IsValid)
            {   //数据校验

                string currentPerson = GetCurrentPerson();
                //entity.UpdateTime = DateTime.Now;
                //entity.UpdatePerson = currentPerson;

                string returnValue = string.Empty;
                if (m_BLL.Edit(ref validationErrors, entity))
                {
                    LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",操作信息的Id为" + id,"操作"
                        );//写入日志
                    return Json(Suggestion.UpdateSucceed); //提示更新成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return true;
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",操作信息的Id为" + id + "," + returnValue, "操作"
                        );//写入日志
                    return Json(Suggestion.UpdateFail  + returnValue); //提示更新失败
                }
            }
            return Json(Suggestion.UpdateFail + "请核对输入的数据的格式"); //提示输入的数据的格式不对
        }