Esempio n. 1
0
 /// <summary>
 /// 修改设备告警状态
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int UpdateEntityState(DBModelStateCustom entity)
 {
     try
     {
         int res = mapContext.Update("UpdateInformAlarmState", entity);
         return(res);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 更新计划任务状态
 /// </summary>
 /// <param name="id"></param>
 /// <param name="state"></param>
 /// <returns></returns>
 public bool UpdateScheduleState(int id, int state)
 {
     try
     {
         DBModelStateCustom custom = new DBModelStateCustom();
         custom.id    = id;
         custom.state = state;
         return(servScheduleDal.UpdateScheduleState(custom));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 修改计划任务状态
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool UpdateScheduleState(DBModelStateCustom model)
 {
     try
     {
         int res = mapContext.Update("UpdateScheduleState", model);
         if (res > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        /// <summary>
        /// 添加处理记录并修改记录状态
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="alarmId"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public EventRet AddRecordAndUpdateInformAlarmStatus(ServInformAlarmHandleRecordModel entity, int alarmId, int status)
        {
            EventRet ret = new EventRet();

            mapContext.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted);//创建事务
            try
            {
                int eventId = AddEntity(entity);  //添加处理记录
                if (eventId > 0)
                {
                    DBModelStateCustom stateCustom = new DBModelStateCustom();
                    stateCustom.id    = alarmId;
                    stateCustom.state = status;
                    int res = mapContext.Update("UpdateInformAlarmState", stateCustom);
                    if (res > 0)
                    {
                        mapContext.CommitTransaction();
                        ret.message = "添加处理记录成功,设置状态成功!";
                        ret.state   = 0;
                        return(ret);
                    }
                    else
                    {
                        mapContext.RollBackTransaction();
                        ret.message = "添加处理记录成功,设置状态失败!";
                        ret.state   = -1;
                        return(ret);
                    }
                }
                else
                {
                    mapContext.RollBackTransaction();
                    ret.message = "添加处理记录失败!";
                    ret.state   = -1;
                    return(ret);
                }
            }
            catch (Exception ex)
            {
                mapContext.RollBackTransaction();
                throw ex;
            }
        }