Пример #1
0
        public ObservableCollection<InspectionOR> selectAllDate()
        {
            string sql = @"select fp.*
            ,t.StationName,d.DeviceName,c.ChannelName,ty.TypeName  from t_Inspection fp
            inner join t_Station t  on fp.StationID=t.StationID
            inner join t_Device d on fp.DeviceID=d.DeviceID
            inner join t_DeviceType ty on ty.DeviceTypeID=d.DeviceTypeID
            inner join t_Channel c on fp.ChannelNO=c.ChannelNo and c.DeviceID=d.DeviceID";

            DataTable dt = null;
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            ObservableCollection<InspectionOR> _List = new ObservableCollection<InspectionOR>();
            foreach (DataRow dr in dt.Rows)
            {
                InspectionOR obj = new InspectionOR(dr);
                _List.Add(obj);
            }
            return _List;
        }
Пример #2
0
 public InspectionEditViewModel(InspectionListViewModel _vm, InspectionEditView _mw)
 {
     _InspectionListVM = _vm;
     _Window = _mw;
     OperationType = OpType.Add;
     InspectionObj = new InspectionOR();
     //UpdatetxtSource(_Window.gridContent);
     Init();
 }
Пример #3
0
        public InspectionEditViewModel(InspectionListViewModel _vm, InspectionEditView _mw, InspectionOR _InspectionObj)
        {
            _InspectionListVM = _vm;
            _Window = _mw;
            _SourceObj = _InspectionObj;

            OperationType = OpType.Alert;
            InspectionObj = new InspectionOR();
            InspectionObj.Clone(_InspectionObj);

            Init();
        }
Пример #4
0
 /// <summary>
 /// 插入t_Inspection
 /// </summary>
 public virtual bool Insert(InspectionOR inspection)
 {
     string sql = @"insert into t_Inspection (StationID, DeviceTypeID, DeviceID, ChannelNO, AlarmWay, SmsEmail, PhoneMedia, InspectionTime, InspectionType, ValueType)
     values (@StationID, @DeviceTypeID, @DeviceID, @ChannelNO, @AlarmWay, @SmsEmail, @PhoneMedia, @InspectionTime, @InspectionType, @ValueType)";
     SqlParameter[] parameters = new SqlParameter[]
     {
     //		new SqlParameter("@InspectionID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "InspectionID", DataRowVersion.Default, inspection.Inspectionid),
         new SqlParameter("@StationID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "StationID", DataRowVersion.Default, inspection.Stationid),
         new SqlParameter("@DeviceTypeID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "DeviceTypeID", DataRowVersion.Default, inspection.Devicetypeid),
         new SqlParameter("@DeviceID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "DeviceID", DataRowVersion.Default, inspection.Deviceid),
         new SqlParameter("@ChannelNO", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ChannelNO", DataRowVersion.Default, inspection.Channelno),
         new SqlParameter("@AlarmWay", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "AlarmWay", DataRowVersion.Default, inspection.Alarmway),
         new SqlParameter("@SmsEmail", SqlDbType.VarChar, 200, ParameterDirection.Input, false, 0, 0, "SmsEmail", DataRowVersion.Default, inspection.Smsemail),
         new SqlParameter("@PhoneMedia", SqlDbType.VarChar, 200, ParameterDirection.Input, false, 0, 0, "PhoneMedia", DataRowVersion.Default, inspection.Phonemedia),
         new SqlParameter("@InspectionTime", SqlDbType.VarChar, 200, ParameterDirection.Input, false, 0, 0, "InspectionTime", DataRowVersion.Default, inspection.Inspectiontime),
         new SqlParameter("@InspectionType", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "InspectionType", DataRowVersion.Default, inspection.Inspectiontype),
         new SqlParameter("@ValueType", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ValueType", DataRowVersion.Default, inspection.Valuetype)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Пример #5
0
 /// <summary>
 /// 更新t_Inspection
 /// </summary>
 public virtual bool Update(InspectionOR inspection)
 {
     string sql = "update t_Inspection set  StationID = @StationID,  DeviceTypeID = @DeviceTypeID,  DeviceID = @DeviceID,  ChannelNO = @ChannelNO,  AlarmWay = @AlarmWay,  SmsEmail = @SmsEmail,  PhoneMedia = @PhoneMedia,  InspectionTime = @InspectionTime,  InspectionType = @InspectionType,  ValueType = @ValueType where  InspectionID = @InspectionID";
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@InspectionID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "InspectionID", DataRowVersion.Default, inspection.Inspectionid),
         new SqlParameter("@StationID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "StationID", DataRowVersion.Default, inspection.Stationid),
         new SqlParameter("@DeviceTypeID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "DeviceTypeID", DataRowVersion.Default, inspection.Devicetypeid),
         new SqlParameter("@DeviceID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "DeviceID", DataRowVersion.Default, inspection.Deviceid),
         new SqlParameter("@ChannelNO", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ChannelNO", DataRowVersion.Default, inspection.Channelno),
         new SqlParameter("@AlarmWay", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "AlarmWay", DataRowVersion.Default, inspection.Alarmway),
         new SqlParameter("@SmsEmail", SqlDbType.VarChar, 200, ParameterDirection.Input, false, 0, 0, "SmsEmail", DataRowVersion.Default, inspection.Smsemail),
         new SqlParameter("@PhoneMedia", SqlDbType.VarChar, 200, ParameterDirection.Input, false, 0, 0, "PhoneMedia", DataRowVersion.Default, inspection.Phonemedia),
         new SqlParameter("@InspectionTime", SqlDbType.VarChar, 200, ParameterDirection.Input, false, 0, 0, "InspectionTime", DataRowVersion.Default, inspection.Inspectiontime),
         new SqlParameter("@InspectionType", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "InspectionType", DataRowVersion.Default, inspection.Inspectiontype),
         new SqlParameter("@ValueType", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ValueType", DataRowVersion.Default, inspection.Valuetype)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Пример #6
0
 public InspectionOR selectARowDate(string m_id)
 {
     string sql = string.Format("select * from t_Inspection where  Inspectionid='{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];
     InspectionOR m_Insp = new InspectionOR(dr);
     return m_Insp;
 }
Пример #7
0
 public InspectionEditView(InspectionListViewModel _List, InspectionOR _Inspection)
 {
     InitializeComponent();
     this.DataContext = new InspectionEditViewModel(_List, this, _Inspection);
 }
Пример #8
0
        public void Clone(InspectionOR obj)
        {
            //
            Inspectionid = obj.Inspectionid;
            //站点名称
            Stationid = obj.Stationid;
            //设备类型
            Devicetypeid = obj.Devicetypeid;
            //设备名称
            Deviceid = obj.Deviceid;
            //通道号
            Channelno = obj.Channelno;
            //告警方式
            Alarmway = obj.Alarmway;
            //短信及邮件内容
            Smsemail = obj.Smsemail;
            //电话语音文件
            Phonemedia = obj.Phonemedia;
            //巡检时间
            Inspectiontime = obj.Inspectiontime;
            //巡检类型
            Inspectiontype = obj.Inspectiontype;
            //值类型
            Valuetype = obj.Valuetype;

            StationName = obj.StationName;
            DeviceName = obj.DeviceName;
            ChannelName = obj.ChannelName;
            TypeName = obj.TypeName;
        }
Пример #9
0
 public InspectionEditViewModel(InspectionOR _Sta)
 {
     OperationType = OpType.Alert;
     InspectionObj = _Sta;
 }