コード例 #1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public bool SaveDangerZone(SaveDangerZone request)
        {
            using (var db = DbFactory.Open())
            {
                var info = new DangerZone();
                info.adcd           = request.adcd;
                info.DangerZoneName = request.name;
                var log = new operateLog();
                log.userName    = RealName;
                log.operateTime = DateTime.Now;
                var logList = new List <operateLog>();

                if (request.id != 0)
                {
                    var model = GetDangerZoneById(request.id);
                    if (model == null)
                    {
                        throw new Exception("该类型不存在");
                    }
                    info.Id        = request.id;
                    log.operateMsg = "编辑id为:" + request.id + "原类型为:" + info.DangerZoneName + ",现类型为:" + request.name +
                                     "的危险点类型数据";
                    logList.Add(log);
                    info.operateLog = JsonTools.ObjectToJson(logList);
                    return(db.Update(info) == 1);
                }
                else
                {
                    log.operateMsg = "新增类型为:" + request.name + "的危险点类型数据";
                    logList.Add(log);
                    info.operateLog = JsonTools.ObjectToJson(logList);
                    return(db.Insert(info) == 1);
                }
            }
        }
コード例 #2
0
 public bool Post(SaveDangerZone request)
 {
     return(DangerZoneManager.SaveDangerZone(request));
 }