예제 #1
0
        public JsonResult Edit(WN_WarningSett entity)
        {
            if (entity != null && ModelState.IsValid)
            {
                using (MBREntities db = new MBREntities())
                {
                    WarningSettService us = new WarningSettService(db);

                    if (us.Edit(ref errors, entity))
                    {
                        LogHandler.WriteServiceLog(LogonUser.RealName, "WarningSettID:" + entity.WarningSettID + ",Title:" + entity.Title, Resource.EditSucceed, Resource.Edit, "预警规则设置");
                        return(Json(JsonHandler.CreateMessage(1, Resource.EditSucceed)));
                    }
                    else
                    {
                        string ErrorCol = errors.Error;
                        LogHandler.WriteServiceLog(LogonUser.RealName, "WarningSettID:" + entity.WarningSettID + ",Title:" + entity.Title, Resource.EditFail, Resource.Edit, "预警规则设置");
                        return(Json(JsonHandler.CreateMessage(0, Resource.EditFail + ErrorCol)));
                    }
                }
            }
            else
            {
                return(Json(JsonHandler.CreateMessage(0, Resource.EditFail)));
            }
        }
예제 #2
0
 public JsonResult Delete(int id)
 {
     using (MBREntities db = new MBREntities())
     {
         WarningSettService us = new WarningSettService(db);
         if (us.Delete(ref errors, id))
         {
             LogHandler.WriteServiceLog(LogonUser.RealName, "WarningSettID:" + id, Resource.DeleteSucceed, Resource.Delete, "预警规则设置");
             return(Json(JsonHandler.CreateMessage(1, Resource.DeleteSucceed)));
         }
         else
         {
             string ErrorCol = errors.Error;
             LogHandler.WriteServiceLog(LogonUser.RealName, "WarningSettID:" + id, Resource.DeleteFail, Resource.Delete, "预警规则设置");
             return(Json(JsonHandler.CreateMessage(0, Resource.DeleteFail + ErrorCol)));
         }
     }
 }
예제 #3
0
 public JsonResult Create(WN_WarningSett entity)
 {
     using (MBREntities db = new MBREntities())
     {
         WarningSettService us = new WarningSettService(db);
         if (us.Create(ref errors, entity))
         {
             LogHandler.WriteServiceLog(LogonUser.RealName, "WarningSettID:" + entity.WarningSettID + ",Title:" + entity.Title, Resource.InsertSucceed, Resource.Create, "预警规则设置");
             return(Json(JsonHandler.CreateMessage(1, Resource.InsertSucceed), JsonRequestBehavior.AllowGet));
         }
         else
         {
             string ErrorCol = errors.Error;
             LogHandler.WriteServiceLog(LogonUser.RealName, "WarningSettID:" + entity.WarningSettID + ",Title:" + entity.Title, Resource.InsertFail, Resource.Create, "预警规则设置");
             return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail + ErrorCol), JsonRequestBehavior.AllowGet));
         }
     }
 }