public AlarmLevelSetEditViewModel(AlarmLevelSetListViewModel _vm, AlarmLevelSetEditView _mw)
        {
            _AlarmLevelSetListVM = _vm;
            _Window = _mw;
            OperationType = OpType.Add;
            AlarmLevelSetObj = new AlarmLevelSetOR();

            Init();
        }
Esempio n. 2
0
 /// <summary>
 /// 插入t_AlarmLevelSet
 /// </summary>
 public virtual bool Insert(AlarmLevelSetOR alarmLevelSet)
 {
     string sql = "insert into t_AlarmLevelSet ( Priority, LevelName, UpInterval) values (@Priority, @LevelName, @UpInterval)";
     SqlParameter [] parameters = new SqlParameter[]
     {
         //new SqlParameter("@ID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ID", DataRowVersion.Default, alarmLevelSet.Id),
         new SqlParameter("@Priority", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "Priority", DataRowVersion.Default, alarmLevelSet.Priority),
         new SqlParameter("@LevelName", SqlDbType.NVarChar, 100, ParameterDirection.Input, false, 0, 0, "LevelName", DataRowVersion.Default, alarmLevelSet.Levelname),
         new SqlParameter("@UpInterval", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "UpInterval", DataRowVersion.Default, alarmLevelSet.Upinterval)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
        public AlarmLevelSetEditViewModel(AlarmLevelSetListViewModel _vm, AlarmLevelSetEditView _mw, AlarmLevelSetOR _AlarmLevelSetObj)
        {
            _AlarmLevelSetListVM = _vm;
            _Window = _mw;
            _SourceObj = _AlarmLevelSetObj;

            OperationType = OpType.Alert;
            AlarmLevelSetObj = new AlarmLevelSetOR();
            AlarmLevelSetObj.Clone(_AlarmLevelSetObj);

            Init();
        }
Esempio n. 4
0
        public ObservableCollection<AlarmLevelSetOR> selectAllDate()
        {
            string sql = "select * from t_AlarmLevelSet";

            DataTable dt = null;
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            ObservableCollection<AlarmLevelSetOR> _List = new ObservableCollection<AlarmLevelSetOR>();
            foreach (DataRow dr in dt.Rows)
            {
                AlarmLevelSetOR obj = new AlarmLevelSetOR(dr);
                _List.Add(obj);
            }
            return _List;
        }
Esempio n. 5
0
 public AlarmLevelSetOR selectARowDate(string m_id)
 {
     string sql = string.Format("select * from t_AlarmLevelSet where  Id='{0}'",m_id);
       DataTable dt = null;
     try
      {
      dt = db.ExecuteQueryDataSet(sql).Tables[0];
     }
       catch (Exception ex)
     {
      throw ex;
       }
     if (dt == null)
      return null;
     if (dt.Rows.Count == 0)
     return null;
     DataRow dr = dt.Rows[0];
     AlarmLevelSetOR m_Alar=new AlarmLevelSetOR(dr);
      return m_Alar;
 }
Esempio n. 6
0
 /// <summary>
 /// 更新t_AlarmLevelSet
 /// </summary>
 public virtual bool Update(AlarmLevelSetOR alarmLevelSet)
 {
     string sql = "update t_AlarmLevelSet set  Priority = @Priority,  LevelName = @LevelName,  UpInterval = @UpInterval where  ID = @ID";
     SqlParameter [] parameters = new SqlParameter[]
     {
         new SqlParameter("@ID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ID", DataRowVersion.Default, alarmLevelSet.Id),
         new SqlParameter("@Priority", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "Priority", DataRowVersion.Default, alarmLevelSet.Priority),
         new SqlParameter("@LevelName", SqlDbType.NVarChar, 100, ParameterDirection.Input, false, 0, 0, "LevelName", DataRowVersion.Default, alarmLevelSet.Levelname),
         new SqlParameter("@UpInterval", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "UpInterval", DataRowVersion.Default, alarmLevelSet.Upinterval)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
 public AlarmLevelSetEditView(AlarmLevelSetListViewModel _List, AlarmLevelSetOR _AlarmLevelSet)
 {
     InitializeComponent();
     this.DataContext = new AlarmLevelSetEditViewModel(_List, this, _AlarmLevelSet);
 }
 public AlarmLevelSetEditViewModel(AlarmLevelSetOR _Sta)
 {
     OperationType = OpType.Alert;
     AlarmLevelSetObj = _Sta;
 }
Esempio n. 9
0
 public void Clone(AlarmLevelSetOR obj)
 {
     //
     Id = obj.Id;
     //级别
     Priority = obj.Priority;
     //等级名称
     Levelname = obj.Levelname;
     //自动升级间隔时间
     Upinterval = obj.Upinterval;
 }