private void fr基站传输_Load(object sender, EventArgs e) { Def_基站传输 基站传输 = new Def_基站传输(BasedateID); 基站传输 = 基站传输Comend.Get基站传输ByBasedateID(BasedateID); tb2M占用数量1.Text = 基站传输.B2M占用数量1; tb2M占用数量2.Text = 基站传输.B2M占用数量2; tb2M占用数量3.Text = 基站传输.B2M占用数量3; tb2M占用数量4.Text = 基站传输.B2M占用数量4; tb厂家及型号1.Text = 基站传输.B厂家及型号1; tb厂家及型号2.Text = 基站传输.B厂家及型号2; tb厂家及型号3.Text = 基站传输.B厂家及型号3; tb厂家及型号4.Text = 基站传输.B厂家及型号4; tb传输上端1.Text = 基站传输.B传输上端1; tb传输上端2.Text = 基站传输.B传输上端2; tb传输下端1.Text = 基站传输.B传输下端1; tb传输下端2.Text = 基站传输.B传输下端2; tb容量1.Text = 基站传输.B容量1; tb容量2.Text = 基站传输.B容量2; tb容量3.Text = 基站传输.B容量3; tb容量4.Text = 基站传输.B容量4; tb所带业务1.Text = 基站传输.B所带业务1; tb所带业务2.Text = 基站传输.B所带业务2; tb所带业务3.Text = 基站传输.B所带业务3; tb所带业务4.Text = 基站传输.B所带业务4; tb微波本端3.Text = 基站传输.B微波本端3; tb微波本端4.Text = 基站传输.B微波本端4; tb微波下端3.Text = 基站传输.B微波下端3; tb微波下端4.Text = 基站传输.B微波下端4; IsCanModify(IsModify); }
private void button1_Click(object sender, EventArgs e) { Def_基站传输 基站传输 = new Def_基站传输(BasedateID); 基站传输.B2M占用数量1 = tb2M占用数量1.Text; 基站传输.B2M占用数量2 = tb2M占用数量2.Text; 基站传输.B2M占用数量3 = tb2M占用数量3.Text; 基站传输.B2M占用数量4 = tb2M占用数量4.Text; 基站传输.B厂家及型号1 = tb厂家及型号1.Text; 基站传输.B厂家及型号2 = tb厂家及型号2.Text; 基站传输.B厂家及型号3 = tb厂家及型号3.Text; 基站传输.B厂家及型号4 = tb厂家及型号4.Text; 基站传输.B传输上端1 = tb传输上端1.Text; 基站传输.B传输上端2 = tb传输上端2.Text; 基站传输.B传输下端1 = tb传输下端1.Text; 基站传输.B传输下端2 = tb传输下端2.Text; 基站传输.B容量1 = tb容量1.Text; 基站传输.B容量2 = tb容量2.Text; 基站传输.B容量3 = tb容量3.Text; 基站传输.B容量4 = tb容量4.Text; 基站传输.B所带业务1 = tb所带业务1.Text; 基站传输.B所带业务2 = tb所带业务2.Text; 基站传输.B所带业务3 = tb所带业务3.Text; 基站传输.B所带业务4 = tb所带业务4.Text; 基站传输.B微波本端3 = tb微波本端3.Text; 基站传输.B微波本端4 = tb微波本端4.Text; 基站传输.B微波下端3 = tb微波下端3.Text; 基站传输.B微波下端4 = tb微波下端4.Text; 基站传输Comend.UpDate基站主设备(基站传输); SQLExecute.Operate = "用户" + DBUser.CURR_USERID + "更新了基站传输 ,基站编号:" + 基站传输.BasedateID; SQLExecute.SaveOperate(); MessageBox.Show("更新成功 !", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); }
/// <summary> /// 更新(带插入) /// </summary> /// <param name="基站传输"></param> public static void UpDate基站主设备(Def_基站传输 基站传输) { string InsertSQL = "UPDATE [New基站传输] " + " SET " + " [_2M占用数量1] = '" + 基站传输.B2M占用数量1.ToString().Replace("'", "''") + "'" + ", [_2M占用数量2] = '" + 基站传输.B2M占用数量2.ToString().Replace("'", "''") + "'" + ", [_2M占用数量3] = '" + 基站传输.B2M占用数量3.ToString().Replace("'", "''") + "'" + ", [_2M占用数量4] = '" + 基站传输.B2M占用数量4.ToString().Replace("'", "''") + "'" + ", [_厂家及型号1] = '" + 基站传输.B厂家及型号1.ToString().Replace("'", "''") + "'" + ", [_厂家及型号2] = '" + 基站传输.B厂家及型号2.ToString().Replace("'", "''") + "'" + ", [_厂家及型号3] = '" + 基站传输.B厂家及型号3.ToString().Replace("'", "''") + "'" + ", [_厂家及型号4] = '" + 基站传输.B厂家及型号4.ToString().Replace("'", "''") + "'" + ", [_传输上端1] = '" + 基站传输.B传输上端1.ToString().Replace("'", "''") + "'" + ", [_传输上端2] = '" + 基站传输.B传输上端2.ToString().Replace("'", "''") + "'" + ", [_传输下端1] = '" + 基站传输.B传输下端1.ToString().Replace("'", "''") + "'" + ", [_传输下端2] = '" + 基站传输.B传输下端2.ToString().Replace("'", "''") + "'" + ", [_容量1] = '" + 基站传输.B容量1.ToString().Replace("'", "''") + "'" + ", [_容量2] = '" + 基站传输.B容量2.ToString().Replace("'", "''") + "'" + ", [_容量3] = '" + 基站传输.B容量3.ToString().Replace("'", "''") + "'" + ", [_容量4] = '" + 基站传输.B容量4.ToString().Replace("'", "''") + "'" + ", [_所带业务1] = '" + 基站传输.B所带业务1.ToString().Replace("'", "''") + "'" + ", [_所带业务2] = '" + 基站传输.B所带业务2.ToString().Replace("'", "''") + "'" + ", [_所带业务3] = '" + 基站传输.B所带业务3.ToString().Replace("'", "''") + "'" + ", [_所带业务4] = '" + 基站传输.B所带业务4.ToString().Replace("'", "''") + "'" + ", [_微波本端3] = '" + 基站传输.B微波本端3.ToString().Replace("'", "''") + "'" + ", [_微波本端4] = '" + 基站传输.B微波本端4.ToString().Replace("'", "''") + "'" + ", [_微波下端3] = '" + 基站传输.B微波下端3.ToString().Replace("'", "''") + "'" + ", [_微波下端4] = '" + 基站传输.B微波下端4.ToString().Replace("'", "''") + "'"+ " WHERE [basedateID] ='" + 基站传输.BasedateID.ToString().Replace("'", "''") + "'"; string UpDateSQL = "INSERT INTO [New基站传输] " + " ([basedateID] " + " ,[_2M占用数量1] " + " ,[_2M占用数量2] " + " ,[_2M占用数量3] " + " ,[_2M占用数量4] " + " ,[_厂家及型号1] " + " ,[_厂家及型号2] " + " ,[_厂家及型号3] " + " ,[_厂家及型号4] " + " ,[_传输上端1] " + " ,[_传输上端2] " + " ,[_传输下端1] " + " ,[_传输下端2] " + " ,[_容量1] " + " ,[_容量2] " + " ,[_容量3] " + " ,[_容量4] " + " ,[_所带业务1] " + " ,[_所带业务2] " + " ,[_所带业务3] " + " ,[_所带业务4] " + " ,[_微波本端3] " + " ,[_微波本端4] " + " ,[_微波下端3] "+ " ,[_微波下端4])" + " VALUES " + " ('" + 基站传输.BasedateID.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B2M占用数量1.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B2M占用数量2.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B2M占用数量3.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B2M占用数量4.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B厂家及型号1.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B厂家及型号2.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B厂家及型号3.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B厂家及型号4.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B传输上端1.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B传输上端2.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B传输下端1.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B传输下端2.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B容量1.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B容量2.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B容量3.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B容量4.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B所带业务1.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B所带业务2.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B所带业务3.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B所带业务4.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B微波本端3.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B微波本端4.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B微波下端3.ToString().Replace("'", "''") + "' "+ " ,'" + 基站传输.B微波下端4.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); }
/// <summary> ///查询 /// </summary> /// <param name="BasedateID"></param> /// <returns></returns> public static Def_基站传输 Get基站传输ByBasedateID(string BasedateID) { Def_基站传输 基站传输 = new Def_基站传输(BasedateID); string sql = "SELECT [ID] " + " ,[basedateID] " + " ,[_2M占用数量1] " + " ,[_2M占用数量2] " + " ,[_2M占用数量3] " + " ,[_2M占用数量4] " + " ,[_厂家及型号1] " + " ,[_厂家及型号2] " + " ,[_厂家及型号3] " + " ,[_厂家及型号4] " + " ,[_传输上端1] " + " ,[_传输上端2] " + " ,[_传输下端1] " + " ,[_传输下端2] " + " ,[_容量1] " + " ,[_容量2] " + " ,[_容量3] " + " ,[_容量4] " + " ,[_所带业务1] " + " ,[_所带业务2] " + " ,[_所带业务3] " + " ,[_所带业务4] " + " ,[_微波本端3] " + " ,[_微波本端4] " + " ,[_微波下端3] " + " ,[_微波下端4] " + " FROM [New基站传输] where basedateID = '" + BasedateID.ToString().Replace("'", "''") + "'"; DataTable dt = new DataTable("基站传输"); SQLExecute.Convertdrtodt(SQLExecute.ExecuteReader(sql), dt); if (dt.Rows.Count == 0) { 基站传输 = new Def_基站传输(BasedateID); } else { 基站传输.B2M占用数量1 = dt.Rows[0]["_2M占用数量1"].ToString(); 基站传输.B2M占用数量2 = dt.Rows[0]["_2M占用数量2"].ToString(); 基站传输.B2M占用数量3 = dt.Rows[0]["_2M占用数量3"].ToString(); 基站传输.B2M占用数量4 = dt.Rows[0]["_2M占用数量4"].ToString(); 基站传输.B厂家及型号1 = dt.Rows[0]["_厂家及型号1"].ToString(); 基站传输.B厂家及型号2 = dt.Rows[0]["_厂家及型号2"].ToString(); 基站传输.B厂家及型号3 = dt.Rows[0]["_厂家及型号3"].ToString(); 基站传输.B厂家及型号4 = dt.Rows[0]["_厂家及型号4"].ToString(); 基站传输.B传输上端1 = dt.Rows[0]["_传输上端1"].ToString(); 基站传输.B传输上端2 = dt.Rows[0]["_传输上端2"].ToString(); 基站传输.B传输下端1 = dt.Rows[0]["_传输下端1"].ToString(); 基站传输.B传输下端2 = dt.Rows[0]["_传输下端2"].ToString(); 基站传输.B容量1 = dt.Rows[0]["_容量1"].ToString(); 基站传输.B容量2 = dt.Rows[0]["_容量2"].ToString(); 基站传输.B容量3 = dt.Rows[0]["_容量3"].ToString(); 基站传输.B容量4 = dt.Rows[0]["_容量4"].ToString(); 基站传输.B所带业务1 = dt.Rows[0]["_所带业务1"].ToString(); 基站传输.B所带业务2 = dt.Rows[0]["_所带业务2"].ToString(); 基站传输.B所带业务3 = dt.Rows[0]["_所带业务3"].ToString(); 基站传输.B所带业务4 = dt.Rows[0]["_所带业务4"].ToString(); 基站传输.B微波本端3 = dt.Rows[0]["_微波本端3"].ToString(); 基站传输.B微波本端4 = dt.Rows[0]["_微波本端4"].ToString(); 基站传输.B微波下端3 = dt.Rows[0]["_微波下端3"].ToString(); 基站传输.B微波下端4 = dt.Rows[0]["_微波下端4"].ToString(); } return 基站传输; }
/// <summary> /// 添加 /// </summary> /// <param name="基站传输"></param> public static void Insert基站主设备(Def_基站传输 基站传输) { string sql = "INSERT INTO [New基站传输] " + " ([basedateID] " + " ,[_2M占用数量1] " + " ,[_2M占用数量2] " + " ,[_2M占用数量3] " + " ,[_2M占用数量4] " + " ,[_厂家及型号1] " + " ,[_厂家及型号2] " + " ,[_厂家及型号3] " + " ,[_厂家及型号4] " + " ,[_传输上端1] " + " ,[_传输上端2] " + " ,[_传输下端1] " + " ,[_传输下端2] " + " ,[_容量1] " + " ,[_容量2] " + " ,[_容量3] " + " ,[_容量4] " + " ,[_所带业务1] " + " ,[_所带业务2] " + " ,[_所带业务3] " + " ,[_所带业务4] " + " ,[_微波本端3] " + " ,[_微波本端4] " + " ,[_微波下端3])" + " VALUES " + " ('" + 基站传输.BasedateID.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B2M占用数量1.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B2M占用数量2.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B2M占用数量3.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B2M占用数量4.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B厂家及型号1.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B厂家及型号2.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B厂家及型号3.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B厂家及型号4.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B传输上端1.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B传输上端2.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B传输下端1.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B传输下端2.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B容量1.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B容量2.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B容量3.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B容量4.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B所带业务1.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B所带业务2.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B所带业务3.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B所带业务4.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B微波本端3.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B微波本端4.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B微波下端3.ToString().Replace("'", "''") + "' " + " ,'" + 基站传输.B微波下端4.ToString().Replace("'", "''") + "' )"; SQLExecute.ExecuteNonQuery(sql); }