/// <summary> /// 插入t_ReportConfig /// </summary> public virtual bool Insert(ReportConfigOR reportConfig) { ReportConfigOR temp = selectARowDate(reportConfig.Bussystemid); if (temp.Bussystemid > 0) { return Update(reportConfig); } string sql = "insert into t_ReportConfig (BusSystemID, Host_DiskUseRate, Host_Memory, Host_CPUUseRate, DB_TableNameSpace, DB_Hitrate, DB_OnlineTime, Mid_Session, Mid_JVMUse, Mid_ConnPool, System_Stop, StopInfo, AvailableRate) values (@BusSystemID, @Host_DiskUseRate, @Host_Memory, @Host_CPUUseRate, @DB_TableNameSpace, @DB_Hitrate, @DB_OnlineTime, @Mid_Session, @Mid_JVMUse, @Mid_ConnPool, @System_Stop, @StopInfo, @AvailableRate)"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@BusSystemID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "BusSystemID", DataRowVersion.Default, reportConfig.Bussystemid), new SqlParameter("@Host_DiskUseRate", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "Host_DiskUseRate", DataRowVersion.Default, reportConfig.HostDiskuserate), new SqlParameter("@Host_Memory", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "Host_Memory", DataRowVersion.Default, reportConfig.HostMemory), new SqlParameter("@Host_CPUUseRate", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "Host_CPUUseRate", DataRowVersion.Default, reportConfig.HostCpuuserate), new SqlParameter("@DB_TableNameSpace", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "DB_TableNameSpace", DataRowVersion.Default, reportConfig.DbTablenamespace), new SqlParameter("@DB_Hitrate", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "DB_Hitrate", DataRowVersion.Default, reportConfig.DbHitrate), new SqlParameter("@DB_OnlineTime", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "DB_OnlineTime", DataRowVersion.Default, reportConfig.DbOnlinetime), new SqlParameter("@Mid_Session", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "Mid_Session", DataRowVersion.Default, reportConfig.MidSession), new SqlParameter("@Mid_JVMUse", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "Mid_JVMUse", DataRowVersion.Default, reportConfig.MidJvmuse), new SqlParameter("@Mid_ConnPool", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "Mid_ConnPool", DataRowVersion.Default, reportConfig.MidConnpool), new SqlParameter("@System_Stop", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "System_Stop", DataRowVersion.Default, reportConfig.SystemStop), new SqlParameter("@StopInfo", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "StopInfo", DataRowVersion.Default, reportConfig.Stopinfo), new SqlParameter("@AvailableRate", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "AvailableRate", DataRowVersion.Default, reportConfig.Availablerate) }; return db.ExecuteNoQuery(sql, parameters) > -1; }
public ReportConfigOR selectARowDate(int m_id) { string sql = string.Format("select * from t_ReportConfig where Bussystemid='{0}'", m_id); DataTable dt = null; try { dt = db.ExecuteQueryDataSet(sql).Tables[0]; } catch (Exception ex) { throw ex; } if (dt == null) return new ReportConfigOR(); if (dt.Rows.Count == 0) return new ReportConfigOR(); DataRow dr = dt.Rows[0]; ReportConfigOR m_Repo = new ReportConfigOR(dr); return m_Repo; }
/// <summary> /// 更新t_ReportConfig /// </summary> public virtual bool Update(ReportConfigOR reportConfig) { string sql = "update t_ReportConfig set Host_DiskUseRate = @Host_DiskUseRate, Host_Memory = @Host_Memory, Host_CPUUseRate = @Host_CPUUseRate, DB_TableNameSpace = @DB_TableNameSpace, DB_Hitrate = @DB_Hitrate, DB_OnlineTime = @DB_OnlineTime, Mid_Session = @Mid_Session, Mid_JVMUse = @Mid_JVMUse, Mid_ConnPool = @Mid_ConnPool, System_Stop = @System_Stop, StopInfo = @StopInfo, AvailableRate = @AvailableRate where BusSystemID = @BusSystemID"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@BusSystemID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "BusSystemID", DataRowVersion.Default, reportConfig.Bussystemid), new SqlParameter("@Host_DiskUseRate", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "Host_DiskUseRate", DataRowVersion.Default, reportConfig.HostDiskuserate), new SqlParameter("@Host_Memory", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "Host_Memory", DataRowVersion.Default, reportConfig.HostMemory), new SqlParameter("@Host_CPUUseRate", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "Host_CPUUseRate", DataRowVersion.Default, reportConfig.HostCpuuserate), new SqlParameter("@DB_TableNameSpace", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "DB_TableNameSpace", DataRowVersion.Default, reportConfig.DbTablenamespace), new SqlParameter("@DB_Hitrate", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "DB_Hitrate", DataRowVersion.Default, reportConfig.DbHitrate), new SqlParameter("@DB_OnlineTime", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "DB_OnlineTime", DataRowVersion.Default, reportConfig.DbOnlinetime), new SqlParameter("@Mid_Session", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "Mid_Session", DataRowVersion.Default, reportConfig.MidSession), new SqlParameter("@Mid_JVMUse", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "Mid_JVMUse", DataRowVersion.Default, reportConfig.MidJvmuse), new SqlParameter("@Mid_ConnPool", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "Mid_ConnPool", DataRowVersion.Default, reportConfig.MidConnpool), new SqlParameter("@System_Stop", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "System_Stop", DataRowVersion.Default, reportConfig.SystemStop), new SqlParameter("@StopInfo", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "StopInfo", DataRowVersion.Default, reportConfig.Stopinfo), new SqlParameter("@AvailableRate", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "AvailableRate", DataRowVersion.Default, reportConfig.Availablerate) }; return db.ExecuteNoQuery(sql, parameters) > -1; }
private ReportConfigOR SetValue() { ReportConfigOR m_Repo = new ReportConfigOR(); m_Repo.Bussystemid = Convert.ToInt32(dpdSystem.SelectedItem.Value); m_Repo.HostDiskuserate = cbHost_DiskUseRate.Checked;// m_Repo.HostMemory = cbHost_Memory.Checked;// m_Repo.HostCpuuserate = cbHost_CPUUseRate.Checked;// m_Repo.DbTablenamespace = cbDB_TableNameSpace.Checked;// m_Repo.DbHitrate = cbDB_Hitrate.Checked;// m_Repo.DbOnlinetime = cbDB_OnlineTime.Checked;// m_Repo.MidSession = cbMid_Session.Checked;// m_Repo.MidJvmuse = cbMid_JVMUse.Checked;// m_Repo.MidConnpool = cbMid_ConnPool.Checked;// m_Repo.SystemStop = cbSystem_Stop.Checked;// m_Repo.Stopinfo = cbStopInfo.Checked;// m_Repo.Availablerate = cbAvailableRate.Checked;// return m_Repo; }