/// <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("@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; }
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; }
//private void ShowSettedDisarmInfo(int DisarmID) //{ // int _DisarmID = -1; // foreach (TreeNode node in Disarm_treeView.Nodes) // { // _DisarmID = (int)node.Tag; // if (_DisarmID == DisarmID) // { // node.Checked = true; // } // else // { // node.Checked = false; // } // } //} private EventTypeOR SetValue() { EventTypeOR m_Even = new EventTypeOR(); if (Request.QueryString["id"] != null) m_Even.Eventid = int.Parse(Request.QueryString["id"]); m_Even.Eventname = txtEventname.Text;//事件名称 m_Even.Alarmlevel = int.Parse(dpdAlarmlevel.SelectedItem.Value);//事件级别 string[] ArryAlarmWay = { "0", "0", "0", "0" }; if (check_Sms.Checked) ArryAlarmWay[0] = "1"; if (check_Phone.Checked) ArryAlarmWay[1] = "1"; if (check_Media.Checked) ArryAlarmWay[2] = "1"; if (check_Emali.Checked) ArryAlarmWay[3] = "1"; //if (check_Frequency.Checked) //ArryAlarmWay [4]="1"; string AlarmWay = ""; for (int i = 0; i < ArryAlarmWay.Length; i++) { if (i != 3) AlarmWay += ArryAlarmWay[i] + "-"; else AlarmWay += ArryAlarmWay[i]; } m_Even.Alarmway = AlarmWay;//报警方式 m_Even.Isenablefrequency = txtIsenablefrequency.Checked ? 1 : 0;//是否班次报警 m_Even.Alarmaudiofile = txtAlarmaudiofile.Text;//电话语音文件 m_Even.Disalarmaudiofile = txtDisalarmaudiofile.Text;//电话语音文件 m_Even.Smsmsg = txtSmsmsg.Text;//短信、Email、语音报警内容格式 string AlarmTarget = ""; //m_Even.Alarmtarget = txtAlarmtarget.Text;//报警组 foreach (ListItem li in cbAlertGroup.Items) { if(!li.Selected) continue; AlarmTarget = AlarmTarget + li.Value + "-"; } m_Even.Alarmtarget = AlarmTarget; //撤防时间 m_Even.Disarmid = ""; foreach (ListItem li in cbDisarmid.Items) { if (li.Selected) { if (!string.IsNullOrEmpty(m_Even.Disarmid)) { Alert("你不能选择连2个或2个以上撤防时间段"); return null; } m_Even.Disarmid = li.Value; } } return m_Even; }