public AlramBindTimeEditViewModel(AlramBindTimeListViewModel _vm, AlramBindTimeEditView _mw)
        {
            _AlramBindTimeListVM = _vm;
            _Window = _mw;

            OperationType = OpType.Add;
            AlramBindTimeObj = new AlramBindTimeOR();
            Init();
        }
        public AlramBindTimeEditViewModel(AlramBindTimeListViewModel _vm, AlramBindTimeEditView _mw, AlramBindTimeOR _AlramBindTimeObj)
        {
            _AlramBindTimeListVM = _vm;
            _Window = _mw;

            _SourceObj = _AlramBindTimeObj;
            OperationType = OpType.Alert;
            AlramBindTimeObj = new AlramBindTimeOR();
            AlramBindTimeObj.Clone(_AlramBindTimeObj);
            Init();
        }
Пример #3
0
 /// <summary>
 /// 插入t_AlramBindTime
 /// </summary>
 public virtual bool Insert(AlramBindTimeOR alramBindTime)
 {
     string sql = "insert into t_AlramBindTime (StationID, DeviceID, ChannelNo, IntervalTime) values(@StationID, @DeviceID, @ChannelNo, @IntervalTime)";
     SqlParameter[] parameters = new SqlParameter[]
     {
         //new SqlParameter("@ID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ID", DataRowVersion.Default, alramBindTime.Id),
         new SqlParameter("@StationID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "StationID", DataRowVersion.Default, alramBindTime.Stationid),
         new SqlParameter("@DeviceID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "DeviceID", DataRowVersion.Default, alramBindTime.Deviceid),
         new SqlParameter("@ChannelNo", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ChannelNo", DataRowVersion.Default, alramBindTime.Channelno),
         new SqlParameter("@IntervalTime", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "IntervalTime", DataRowVersion.Default, alramBindTime.Intervaltime)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Пример #4
0
        public ObservableCollection<AlramBindTimeOR> selectAllDate()
        {
            string sql = @"select tl.*,t.StationName,d.DeviceName,c.ChannelName from t_AlramBindTime tl
            inner join t_Station t  on tl.StationID=t.StationID
            inner join t_Device d on tl.DeviceID=d.DeviceID
            inner join t_Channel c on tl.ChannelNo=c.ChannelNo and c.DeviceID=d.DeviceID";

            DataTable dt = null;
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            ObservableCollection<AlramBindTimeOR> _List = new ObservableCollection<AlramBindTimeOR>();
            foreach (DataRow dr in dt.Rows)
            {
                AlramBindTimeOR obj = new AlramBindTimeOR(dr);
                _List.Add(obj);
            }
            return _List;
        }
 public AlramBindTimeEditViewModel(AlramBindTimeOR _Sta)
 {
     OperationType = OpType.Alert;
     AlramBindTimeObj = _Sta;
 }
 public AlramBindTimeEditView(AlramBindTimeListViewModel _List, AlramBindTimeOR _AlramBindTime)
 {
     InitializeComponent();
     this.DataContext = new AlramBindTimeEditViewModel(_List, this, _AlramBindTime);
 }
Пример #7
0
 public AlramBindTimeOR selectARowDate(string m_id)
 {
     string sql = string.Format("select * from t_AlramBindTime 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];
     AlramBindTimeOR m_Alra = new AlramBindTimeOR(dr);
     return m_Alra;
 }
Пример #8
0
 /// <summary>
 /// 更新t_AlramBindTime
 /// </summary>
 public virtual bool Update(AlramBindTimeOR alramBindTime)
 {
     string sql = "update t_AlramBindTime set  StationID = @StationID,  DeviceID = @DeviceID,  ChannelNo = @ChannelNo,  IntervalTime = @IntervalTime where  ID = @ID";
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@ID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ID", DataRowVersion.Default, alramBindTime.Id),
         new SqlParameter("@StationID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "StationID", DataRowVersion.Default, alramBindTime.Stationid),
         new SqlParameter("@DeviceID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "DeviceID", DataRowVersion.Default, alramBindTime.Deviceid),
         new SqlParameter("@ChannelNo", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ChannelNo", DataRowVersion.Default, alramBindTime.Channelno),
         new SqlParameter("@IntervalTime", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "IntervalTime", DataRowVersion.Default, alramBindTime.Intervaltime)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Пример #9
0
        public void Clone(AlramBindTimeOR obj)
        {
            //
            Id = obj.Id;
            //站点
            Stationid = obj.Stationid;
            //设备
            Deviceid = obj.Deviceid;
            //通道名
            Channelno = obj.Channelno;
            //间隔时间
            Intervaltime = obj.Intervaltime;

            StationName = obj.StationName;
            DeviceName = obj.DeviceName;
            ChannelName = obj.ChannelName;
        }