Esempio n. 1
0
        public JsonResult Edit(WN_WarningCond entity)
        {
            if (entity != null && ModelState.IsValid)
            {
                using (MBREntities db = new MBREntities())
                {
                    WarningCondService us = new WarningCondService(db);

                    if (us.Edit(ref errors, entity))
                    {
                        LogHandler.WriteServiceLog(LogonUser.RealName, "WarningCondID:" + entity.WarningCondID, Resource.EditSucceed, Resource.Edit, "预警条件设置");
                        return(Json(JsonHandler.CreateMessage(1, Resource.EditSucceed)));
                    }
                    else
                    {
                        string ErrorCol = errors.Error;
                        LogHandler.WriteServiceLog(LogonUser.RealName, "WarningCondID:" + entity.WarningCondID, Resource.EditFail, Resource.Edit, "预警条件设置");
                        return(Json(JsonHandler.CreateMessage(0, Resource.EditFail + ErrorCol)));
                    }
                }
            }
            else
            {
                return(Json(JsonHandler.CreateMessage(0, Resource.EditFail)));
            }
        }
Esempio n. 2
0
        public ActionResult Edit(int id)
        {
            WN_WarningCond entity = null;

            using (MBREntities db = new MBREntities())
            {
                entity = db.WN_WarningCond.Include("WN_ParamSett").Where(m => m.WarningCondID == id).FirstOrDefault();
            }
            return(View(entity));
        }
Esempio n. 3
0
 public JsonResult Create(WN_WarningCond entity)
 {
     using (MBREntities db = new MBREntities())
     {
         WarningCondService us = new WarningCondService(db);
         if (us.Create(ref errors, entity))
         {
             LogHandler.WriteServiceLog(LogonUser.RealName, "WarningCondID:" + entity.WarningCondID, Resource.InsertSucceed, Resource.Create, "预警条件设置");
             return(Json(JsonHandler.CreateMessage(1, Resource.InsertSucceed), JsonRequestBehavior.AllowGet));
         }
         else
         {
             string ErrorCol = errors.Error;
             LogHandler.WriteServiceLog(LogonUser.RealName, "WarningCondID:" + entity.WarningCondID, Resource.InsertFail, Resource.Create, "预警条件设置");
             return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail + ErrorCol), JsonRequestBehavior.AllowGet));
         }
     }
 }