/// <summary> /// 插入t_AlarmGroups /// </summary> public virtual bool Insert(AlarmGroupsOR alarmGroups) { string sql = "insert into t_AlarmGroups ( GroupName, StationID) values ( @GroupName, @StationID)"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@GroupName", SqlDbType.NVarChar, 100, ParameterDirection.Input, false, 0, 0, "GroupName", DataRowVersion.Default, alarmGroups.Groupname), new SqlParameter("@StationID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "StationID", DataRowVersion.Default, alarmGroups.Stationid) }; return db.ExecuteNoQuery(sql, parameters) > -1; }
private AlarmGroupsOR SetValue() { AlarmGroupsOR m_Alar = new AlarmGroupsOR(); if (Request.QueryString["id"] != null) m_Alar.Alarmgroupsid = int.Parse(Request.QueryString["id"]); m_Alar.Groupname = txtGroupname.Text;//组名称 m_Alar.Stationid = int.Parse(dpdStationID.SelectedItem.Value);//站点ID return m_Alar; }
public AlarmGroupsOR selectARowDate(string m_id) { string sql = string.Format("select * from t_AlarmGroups where Alarmgroupsid='{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]; AlarmGroupsOR m_Alar = new AlarmGroupsOR(dr); return m_Alar; }
/// <summary> /// 更新t_AlarmGroups /// </summary> public virtual bool Update(AlarmGroupsOR alarmGroups) { string sql = "update t_AlarmGroups set GroupName = @GroupName, StationID = @StationID where AlarmGroupsID = @AlarmGroupsID"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@AlarmGroupsID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "AlarmGroupsID", DataRowVersion.Default, alarmGroups.Alarmgroupsid), new SqlParameter("@GroupName", SqlDbType.NVarChar, 100, ParameterDirection.Input, false, 0, 0, "GroupName", DataRowVersion.Default, alarmGroups.Groupname), new SqlParameter("@StationID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "StationID", DataRowVersion.Default, alarmGroups.Stationid) }; return db.ExecuteNoQuery(sql, parameters) > -1; }