예제 #1
0
 public EventTypeEditViewModel(EventTypeListViewModel _vm, EventTypeEditView _mw)
 {
     _EventTypeListVM = _vm;
     _Window = _mw;
     OperationType = OpType.Add;
     EventTypeObj = new EventTypeOR();
     Init();
 }
예제 #2
0
        public EventTypeEditViewModel(EventTypeListViewModel _vm, EventTypeEditView _mw, EventTypeOR _EventTypeObj)
        {
            _EventTypeListVM = _vm;
            _Window = _mw;
            _SourceObj = _EventTypeObj;

            OperationType = OpType.Alert;
            EventTypeObj = new EventTypeOR();
            EventTypeObj.Clone(_EventTypeObj);

            Init();
        }
예제 #3
0
 /// <summary>
 /// 插入t_EventType
 /// </summary>
 public virtual bool Insert(EventTypeOR eventType)
 {
     string sql = @"insert into t_EventType ( EventName, AlarmLevel, AlarmTarget, AlarmWay, IsEnableFrequency,
     AlarmAudioFile, DisAlarmAudioFile, SmsMsg, DisarmID) values (@EventName, @AlarmLevel, @AlarmTarget,
     @AlarmWay, @IsEnableFrequency, @AlarmAudioFile, @DisAlarmAudioFile, @SmsMsg, @DisarmID)";
     SqlParameter[] parameters = new SqlParameter[]
     {
         //new SqlParameter("@EventID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "EventID", DataRowVersion.Default, eventType.Eventid),
         new SqlParameter("@EventName", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "EventName", DataRowVersion.Default, eventType.Eventname),
         new SqlParameter("@AlarmLevel", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "AlarmLevel", DataRowVersion.Default, eventType.Alarmlevel),
         new SqlParameter("@AlarmTarget", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "AlarmTarget", DataRowVersion.Default, eventType.Alarmtarget),
         new SqlParameter("@AlarmWay", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "AlarmWay", DataRowVersion.Default, eventType.Alarmway),
         new SqlParameter("@IsEnableFrequency", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "IsEnableFrequency", DataRowVersion.Default, eventType.Isenablefrequency),
         new SqlParameter("@AlarmAudioFile", SqlDbType.VarChar, 1024, ParameterDirection.Input, false, 0, 0, "AlarmAudioFile", DataRowVersion.Default, eventType.Alarmaudiofile),
         new SqlParameter("@DisAlarmAudioFile", SqlDbType.VarChar, 1024, ParameterDirection.Input, false, 0, 0, "DisAlarmAudioFile", DataRowVersion.Default, eventType.Disalarmaudiofile),
         new SqlParameter("@SmsMsg", SqlDbType.VarChar, 500, ParameterDirection.Input, false, 0, 0, "SmsMsg", DataRowVersion.Default, eventType.Smsmsg),
         new SqlParameter("@DisarmID", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "DisarmID", DataRowVersion.Default, eventType.Disarmid)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
예제 #4
0
        public ObservableCollection<EventTypeOR> selectAllDate()
        {
            string sql = "select * from t_EventType";

            DataTable dt = null;
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            ObservableCollection<EventTypeOR> _List = new ObservableCollection<EventTypeOR>();
            foreach (DataRow dr in dt.Rows)
            {
                EventTypeOR obj = new EventTypeOR(dr);
                _List.Add(obj);
            }
            return _List;
        }
예제 #5
0
 public void Clone(EventTypeOR obj)
 {
     //
     Eventid = obj.Eventid;
     //事件名称
     Eventname = obj.Eventname;
     //事件级别
     Alarmlevel = obj.Alarmlevel;
     //报警组
     Alarmtarget = obj.Alarmtarget;
     //报警方式
     Alarmway = obj.Alarmway;
     //是否班次报警
     Isenablefrequency = obj.Isenablefrequency;
     //电话语音文件
     Alarmaudiofile = obj.Alarmaudiofile;
     //电话解出语音文件
     Disalarmaudiofile = obj.Disalarmaudiofile;
     //
     Smsmsg = obj.Smsmsg;
     //
     Disarmid = obj.Disarmid;
 }
예제 #6
0
 public EventTypeEditView(EventTypeListViewModel _List, EventTypeOR _EventType)
 {
     InitializeComponent();
     this.DataContext = new EventTypeEditViewModel(_List, this, _EventType);
 }
예제 #7
0
 public EventTypeOR selectARowDate(string m_id)
 {
     string sql = string.Format("select * from t_EventType where  Eventid='{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];
     EventTypeOR m_Even = new EventTypeOR(dr);
     return m_Even;
 }
예제 #8
0
 //protected AlarmWayInfo AlarmWayOR { get; set; }
 public EventTypeEditViewModel(EventTypeOR _Sta)
 {
     OperationType = OpType.Alert;
     EventTypeObj = _Sta;
 }
        /// <summary>
        /// 绑定下拉列表
        /// </summary>
        private void BindEvent()
        {
            if (EventTypeList == null)
            {
                EventTypeList = new EventTypeDA().selectAllDate();
                if (EventTypeList == null)
                    EventTypeList = new ObservableCollection<EventTypeOR>();
                EventTypeOR tempOR = new EventTypeOR() { Eventid = -1, Eventname = "" };
                EventTypeList.Insert(0, tempOR);

                SelectSwitchEventTypeOR = tempOR;
                SelectHiEventTypeOR = tempOR;
                SelectLoEventTypeOR = tempOR;
            }

            if (LightAlarmList == null)
            {
                LightAlarmList = new LightAlarmDA().selectAllDate();
                LightAlarmOR tempOR = new LightAlarmOR() { Lightid = -1, Lightname = "未启用声光报警" };
                if (LightAlarmList == null)
                    LightAlarmList = new ObservableCollection<LightAlarmOR>();
                LightAlarmList.Insert(0, tempOR);
                SelectLightAlarmOR = tempOR;
                SelectReleaseLightAlarmOR = tempOR;
            }

            SwitchvalueArr = new ObservableCollection<string>() { "", "高电平", "低电平" };
            selectSwitchvalue = "";
        }