/// <summary> /// 插入 /// </summary> /// <param name="巡检记录info"></param> public static void Insert巡检记录(巡检记录 巡检记录info) { string sql = "INSERT INTO [BaseStationDB].[dbo].[巡检记录] " + " ([basedateID] " + " ,[巡检时间] " + " ,[室内湿度] " + " ,[直流总电流] " + " ,[室外消防] " + " ,[开关电源] " + " ,[发现隐患] " + " ,[板房] " + " ,[蓄电池] " + " ,[室内卫生] " + " ,[天馈系统] " + " ,[BTS系统] " + " ,[空调系统] " + " ,[备注] " + " ,[巡检人] " + " ,[动力引入] " + " ,[机房备品] " + " ,[消防设施] " + " ,[防雷系统] " + " ,[铁塔] " + " ,[传输系统] " + " ,[室内温度] " + " ,[室外卫生] " + " ,[应急灯] " + " ,[环监系统]) " + " VALUES " + "('" + 巡检记录info.BbasedateID.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B巡检时间.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B室内湿度.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B直流总电流.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B室外消防.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B开关电源.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B发现隐患.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B板房.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B蓄电池.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B室内卫生.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B天馈系统.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.BBTS系统.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B空调系统.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B备注.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B巡检人.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B动力引入.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B机房备品.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B消防设施.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B防雷系统.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B铁塔.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B传输系统.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B室内温度.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B室外卫生.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B应急灯.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B环监系统.ToString().Replace("'", "''") + "')"; SQLExecute.ExecuteNonQuery(sql); }
/// <summary> /// 查询 /// </summary> /// <param name="ID"></param> /// <returns></returns> public static DataTable Get巡检记录ByID(string ID) { DateDef.巡检记录 巡检记录info = new DateDef.巡检记录(ID); string sql = "SELECT [ID] " + " ,[basedateID] " + " ,[巡检时间] " + " ,[室内湿度] " + " ,[直流总电流] " + " ,[室外消防] " + " ,[开关电源] " + " ,[发现隐患] " + " ,[板房] " + " ,[蓄电池] " + " ,[室内卫生] " + " ,[天馈系统] " + " ,[BTS系统] " + " ,[空调系统] " + " ,[备注] " + " ,[巡检人] " + " ,[动力引入] " + " ,[机房备品] " + " ,[消防设施] " + " ,[防雷系统] " + " ,[铁塔] " + " ,[传输系统] " + " ,[室内温度] " + " ,[室外卫生] " + " ,[应急灯] " + " ,[环监系统] " + " FROM [BaseStationDB].[dbo].[巡检记录] where basedateID = '" + ID.ToString().Replace("'", "''") + "'"; DataTable dt = new DataTable("图片"); SQLExecute.Convertdrtodt(SQLExecute.ExecuteReader(sql), dt); return dt; }
/// <summary> /// 更新 /// </summary> /// <param name="巡检记录info"></param> public static void UpDate巡检记录(巡检记录 巡检记录info) { string InsertSQL = "UPDATE [BaseStationDB].[dbo].[巡检记录] " + " SET " + " [室内湿度] = '" + 巡检记录info.B室内湿度.ToString().Replace("'", "''") + "'" + " ,[直流总电流] = '" + 巡检记录info.B直流总电流.ToString().Replace("'", "''") + "'" + " ,[室外消防] = '" + 巡检记录info.B室外消防.ToString().Replace("'", "''") + "'" + " ,[开关电源] = '" + 巡检记录info.B开关电源.ToString().Replace("'", "''") + "'" + " ,[发现隐患] = '" + 巡检记录info.B发现隐患.ToString().Replace("'", "''") + "'" + " ,[板房] = '" + 巡检记录info.B板房.ToString().Replace("'", "''") + "'" + " ,[蓄电池] = '" + 巡检记录info.B蓄电池.ToString().Replace("'", "''") + "'" + " ,[室内卫生] = '" + 巡检记录info.B室内卫生.ToString().Replace("'", "''") + "'" + " ,[天馈系统] = '" + 巡检记录info.B天馈系统.ToString().Replace("'", "''") + "'" + " ,[BTS系统] = '" + 巡检记录info.BBTS系统.ToString().Replace("'", "''") + "'" + " ,[空调系统] = '" + 巡检记录info.B空调系统.ToString().Replace("'", "''") + "'" + " ,[备注] = '" + 巡检记录info.B备注.ToString().Replace("'", "''") + "'" + " ,[巡检人] = '" + 巡检记录info.B巡检人.ToString().Replace("'", "''") + "'" + " ,[动力引入] = '" + 巡检记录info.B动力引入.ToString().Replace("'", "''") + "'" + " ,[机房备品] = '" + 巡检记录info.B机房备品.ToString().Replace("'", "''") + "'" + " ,[消防设施] = '" + 巡检记录info.B消防设施.ToString().Replace("'", "''") + "'" + " ,[防雷系统] = '" + 巡检记录info.B防雷系统.ToString().Replace("'", "''") + "'" + " ,[铁塔] = '" + 巡检记录info.B铁塔.ToString().Replace("'", "''") + "'" + " ,[传输系统] = '" + 巡检记录info.B传输系统.ToString().Replace("'", "''") + "'" + " ,[室内温度] = '" + 巡检记录info.B室内温度.ToString().Replace("'", "''") + "'" + " ,[室外卫生] = '" + 巡检记录info.B室外卫生.ToString().Replace("'", "''") + "'" + " ,[应急灯] = '" + 巡检记录info.B应急灯.ToString().Replace("'", "''") + "'" + " ,[环监系统] = '" + 巡检记录info.B环监系统.ToString().Replace("'", "''") + "'" + " WHERE [basedateID] = '" + 巡检记录info.BbasedateID.ToString().Replace("'", "''") + "'" + "AND [巡检时间] = '" + 巡检记录info.B巡检时间.ToString().Replace("'", "''") + "'"; string UpDateSQL = "INSERT INTO [BaseStationDB].[dbo].[巡检记录] " + " ([basedateID] " + " ,[巡检时间] " + " ,[室内湿度] " + " ,[直流总电流] " + " ,[室外消防] " + " ,[开关电源] " + " ,[发现隐患] " + " ,[板房] " + " ,[蓄电池] " + " ,[室内卫生] " + " ,[天馈系统] " + " ,[BTS系统] " + " ,[空调系统] " + " ,[备注] " + " ,[巡检人] " + " ,[动力引入] " + " ,[机房备品] " + " ,[消防设施] " + " ,[防雷系统] " + " ,[铁塔] " + " ,[传输系统] " + " ,[室内温度] " + " ,[室外卫生] " + " ,[应急灯] " + " ,[环监系统]) " + " VALUES " + "('" + 巡检记录info.BbasedateID.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B巡检时间.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B室内湿度.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B直流总电流.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B室外消防.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B开关电源.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B发现隐患.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B板房.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B蓄电池.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B室内卫生.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B天馈系统.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.BBTS系统.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B空调系统.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B备注.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B巡检人.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B动力引入.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B机房备品.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B消防设施.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B防雷系统.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B铁塔.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B传输系统.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B室内温度.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B室外卫生.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B应急灯.ToString().Replace("'", "''") + "'" + ",'" + 巡检记录info.B环监系统.ToString().Replace("'", "''") + "')"; string strSQL = null; strSQL += InsertSQL;//= string.Format("Update S_RoleDetail set [Power]='{0}' where [RoleID]='{1}' and ProgramID ='{2}'", dt.Rows[i][1].ToString().Replace("'", "''"), dt.Rows[0][2].ToString().Replace("'", "''"), dt.Rows[i][0].ToString().Replace("'", "''")); strSQL = strSQL + " if @@RowCount=0 "; strSQL = strSQL + UpDateSQL;//string.Format("Insert into S_RoleDetail ([RoleID],[ProgramID],[Power]) values ('{0}','{1}','{2}')", dt.Rows[0][2].ToString().Replace("'", "''"), dt.Rows[i][0].ToString().Replace("'", "''"), dt.Rows[i][1].ToString().Replace("'", "''")); SQLExecute.ExecuteNonQuery(strSQL); }