Ejemplo n.º 1
0
        public void UpdateAlarmInfo(AlarmInfo itemui)
        {
            string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);
            try
            {
                Alarm items = new Alarm
                {
                    Process = itemui.process,
                    Class = itemui.Class,
                    PdLine = itemui.PdLine,
                    BeginTime = itemui.BeginTime,
                    EndTime = itemui.EndTime,
                    Status = itemui.Status,
                    Remark = itemui.Remark,
                    Editor = itemui.Editor,
                    Cdt = itemui.Cdt,
                    Udt = itemui.Udt
                };
                using (UnitOfWork uow = new UnitOfWork())
                {
                    IRepository<Alarm> ecoModelRep = new Repository<Alarm>("UPHDBServer");
                    ecoModelRep.Update(items);
                    uow.Commit();
                }

            }
            catch (Exception e)
            {
                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
                throw;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
        }
Ejemplo n.º 2
0
        public void DelAlarmInfo(AlarmInfo itemui)
        {

            string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);
            try
            {
                Alarm items = new Alarm
                {
                    ID=itemui.ID
                };
                using (UnitOfWork uow = new UnitOfWork())
                {
                    IRepository<Alarm> ecoModelRep = new Repository<Alarm>("UPHDBServer");
                    ecoModelRep.Delete(items, true);//删掉记录 根据设置的条件
                    uow.Commit();
                }

            }
            catch (Exception e)
            {
                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
                throw;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
        }