Exemplo n.º 1
0
        public ObservableCollection<LinkageSetOR> selectAllDate()
        {
            string sql = @"select tl.*,t.StationName,d.DeviceName,c.ChannelName
             ,tLine.StationName as LineStationName,dLine.DeviceName as LineDeviceName,cLine.ChannelName  as LineChannelName
            from t_LinkageSet 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
            inner join t_Station tLine  on tl.LinkageStationID=tLine.StationID
            inner join t_Device dLine on tl.LinkageDeviceID=dLine.DeviceID
            inner join t_Channel cLine on tl.LinkageChannelNo=cLine.ChannelNo and cLine.DeviceID=dLine.DeviceID";

            DataTable dt = null;
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            ObservableCollection<LinkageSetOR> _List = new ObservableCollection<LinkageSetOR>();
            foreach (DataRow dr in dt.Rows)
            {
                LinkageSetOR obj = new LinkageSetOR(dr);
                _List.Add(obj);
            }
            return _List;
        }
Exemplo n.º 2
0
 public LinkageSetEditViewModel(LinkageSetListViewModel _vm, LinkageSetEditView _mw)
 {
     _LinkageSetListVM = _vm;
     _Window = _mw;
     OperationType = OpType.Add;
     LinkageSetObj = new LinkageSetOR();
     Init();
 }
Exemplo n.º 3
0
        public LinkageSetEditViewModel(LinkageSetListViewModel _vm, LinkageSetEditView _mw, LinkageSetOR _LinkageSetObj)
        {
            _LinkageSetListVM = _vm;
            _Window = _mw;
            _SourceObj = _LinkageSetObj;

            OperationType = OpType.Alert;
            LinkageSetObj = new LinkageSetOR();
            LinkageSetObj.Clone(_LinkageSetObj);
            Init();
        }
Exemplo n.º 4
0
 /// <summary>
 /// 插入t_LinkageSet
 /// </summary>
 public virtual bool Insert(LinkageSetOR linkageSet)
 {
     string sql = @"insert into t_LinkageSet(StationID, DeviceID, ChannelNo, ValueType, TriggerValue,
     LinkageStationID, LinkageDeviceID, LinkageChannelNo) values (@StationID, @DeviceID, @ChannelNo, @ValueType, @TriggerValue, @LinkageStationID, @LinkageDeviceID, @LinkageChannelNo)";
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@StationID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "StationID", DataRowVersion.Default, linkageSet.Stationid),
         new SqlParameter("@DeviceID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "DeviceID", DataRowVersion.Default, linkageSet.Deviceid),
         new SqlParameter("@ChannelNo", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ChannelNo", DataRowVersion.Default, linkageSet.Channelno),
         new SqlParameter("@ValueType", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ValueType", DataRowVersion.Default, linkageSet.Valuetype),
         new SqlParameter("@TriggerValue", SqlDbType.Float, 8, ParameterDirection.Input, false, 0, 0, "TriggerValue", DataRowVersion.Default, linkageSet.Triggervalue),
         new SqlParameter("@LinkageStationID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "LinkageStationID", DataRowVersion.Default, linkageSet.Linkagestationid),
         new SqlParameter("@LinkageDeviceID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "LinkageDeviceID", DataRowVersion.Default, linkageSet.Linkagedeviceid),
         new SqlParameter("@LinkageChannelNo", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "LinkageChannelNo", DataRowVersion.Default, linkageSet.Linkagechannelno)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Exemplo n.º 5
0
 /// <summary>
 /// 更新t_LinkageSet
 /// </summary>
 public virtual bool Update(LinkageSetOR linkageSet)
 {
     string sql = "update t_LinkageSet set  StationID = @StationID,  DeviceID = @DeviceID,  ChannelNo = @ChannelNo,  ValueType = @ValueType,  TriggerValue = @TriggerValue,  LinkageStationID = @LinkageStationID,  LinkageDeviceID = @LinkageDeviceID,  LinkageChannelNo = @LinkageChannelNo where  ID = @ID";
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@ID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ID", DataRowVersion.Default, linkageSet.Id),
         new SqlParameter("@StationID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "StationID", DataRowVersion.Default, linkageSet.Stationid),
         new SqlParameter("@DeviceID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "DeviceID", DataRowVersion.Default, linkageSet.Deviceid),
         new SqlParameter("@ChannelNo", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ChannelNo", DataRowVersion.Default, linkageSet.Channelno),
         new SqlParameter("@ValueType", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ValueType", DataRowVersion.Default, linkageSet.Valuetype),
         new SqlParameter("@TriggerValue", SqlDbType.Float, 8, ParameterDirection.Input, false, 0, 0, "TriggerValue", DataRowVersion.Default, linkageSet.Triggervalue),
         new SqlParameter("@LinkageStationID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "LinkageStationID", DataRowVersion.Default, linkageSet.Linkagestationid),
         new SqlParameter("@LinkageDeviceID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "LinkageDeviceID", DataRowVersion.Default, linkageSet.Linkagedeviceid),
         new SqlParameter("@LinkageChannelNo", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "LinkageChannelNo", DataRowVersion.Default, linkageSet.Linkagechannelno)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Exemplo n.º 6
0
 public LinkageSetOR selectARowDate(string m_id)
 {
     string sql = string.Format("select * from t_LinkageSet 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];
     LinkageSetOR m_Link = new LinkageSetOR(dr);
     return m_Link;
 }
Exemplo n.º 7
0
 public LinkageSetEditView(LinkageSetListViewModel _List, LinkageSetOR _LinkageSet)
 {
     InitializeComponent();
     this.DataContext = new LinkageSetEditViewModel(_List, this, _LinkageSet);
 }
Exemplo n.º 8
0
 public LinkageSetEditViewModel(LinkageSetOR _Sta)
 {
     OperationType = OpType.Alert;
     LinkageSetObj = _Sta;
 }
Exemplo n.º 9
0
        public void Clone(LinkageSetOR obj)
        {
            //
            Id = obj.Id;
            //站点名称
            Stationid = obj.Stationid;
            //设备名称
            Deviceid = obj.Deviceid;
            //通道名
            Channelno = obj.Channelno;
            //值类型
            Valuetype = obj.Valuetype;
            //触动值
            Triggervalue = obj.Triggervalue;
            //联动机房
            Linkagestationid = obj.Linkagestationid;
            //联动设备名称
            Linkagedeviceid = obj.Linkagedeviceid;
            //联动通道
            Linkagechannelno = obj.Linkagechannelno;

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

            LineStationName = obj.LineStationName;
            LineDeviceName = obj.LineDeviceName;
            LineChannelName = obj.LineChannelName;
        }