/// <summary> /// 确定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { Def_基站主设备 基站主设备 = new Def_基站主设备(BasedateID); 基站主设备.A1 = tb_A1.Text; 基站主设备.A2 = tb_A2.Text; 基站主设备.A3 = tb_A3.Text; 基站主设备.A4 = tb_A4.Text; 基站主设备.A5 = tb_A5.Text; 基站主设备.A6 = tb_A6.Text; 基站主设备.B_B = tb_B.Text; 基站主设备.C1 = tb_C1.Text; 基站主设备.C10 = tb_C10.Text; 基站主设备.C11 = tb_C11.Text; 基站主设备.C2 = tb_C2.Text; 基站主设备.C3 = tb_C3.Text; 基站主设备.C4 = tb_C4.Text; 基站主设备.C5 = tb_C5.Text; 基站主设备.C6 = tb_C6.Text; 基站主设备.C7 = tb_C7.Text; 基站主设备.C8 = tb_C8.Text; 基站主设备.C9 = tb_C9.Text; 基站主设备.D1 = tb_D1.Text; 基站主设备.D2 = tb_D2.Text; 基站主设备.D3 = tb_D3.Text; 基站主设备.D4 = tb_D4.Text; 基站主设备.D5 = tb_D5.Text; 基站主设备.D6 = tb_D6.Text; 基站主设备Comend.UpDate基站主设备(基站主设备); SQLExecute.Operate = "用户" + DBUser.CURR_USERID + "更新了基站主设备 ,基站编号:" + 基站主设备.BasedateID; SQLExecute.SaveOperate(); MessageBox.Show("更新成功 !", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); }
/// <summary> ///查询 /// </summary> /// <param name="BasedateID"></param> /// <returns></returns> public static Def_基站主设备 Get基站主设备ByBasedateID(string BasedateID) { Def_基站主设备 基站主设备 = new Def_基站主设备(BasedateID); string sql = "SELECT [ID] " + " ,[basedateID] " + " ,[_A1] " + " ,[_A2] " + " ,[_A3] " + " ,[_A4] " + " ,[_A5] " + " ,[_A6] " + " ,[_B] " + " ,[_C1] " + " ,[_C10] " + " ,[_C11] " + " ,[_C2] " + " ,[_C3] " + " ,[_C4] " + " ,[_C5] " + " ,[_C6] " + " ,[_C7] " + " ,[_C8] " + " ,[_C9] " + " ,[_D1] " + " ,[_D2] " + " ,[_D3] " + " ,[_D4] " + " ,[_D5] " + " ,[_D6] " + " FROM [dbo].[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 { 基站主设备.A1 = dt.Rows[0]["_A1"].ToString(); 基站主设备.A2 = dt.Rows[0]["_A2"].ToString(); 基站主设备.A3 = dt.Rows[0]["_A3"].ToString(); 基站主设备.A4 = dt.Rows[0]["_A4"].ToString(); 基站主设备.A5 = dt.Rows[0]["_A5"].ToString(); 基站主设备.A6 = dt.Rows[0]["_A6"].ToString(); 基站主设备.B_B = dt.Rows[0]["_B"].ToString(); 基站主设备.C1 = dt.Rows[0]["_C1"].ToString(); 基站主设备.C10 = dt.Rows[0]["_C10"].ToString(); 基站主设备.C11 = dt.Rows[0]["_C11"].ToString(); 基站主设备.C2 = dt.Rows[0]["_C2"].ToString(); 基站主设备.C3 = dt.Rows[0]["_C3"].ToString(); 基站主设备.C4 = dt.Rows[0]["_C4"].ToString(); 基站主设备.C5 = dt.Rows[0]["_C5"].ToString(); 基站主设备.C6 = dt.Rows[0]["_C6"].ToString(); 基站主设备.C7 = dt.Rows[0]["_C7"].ToString(); 基站主设备.C8 = dt.Rows[0]["_C8"].ToString(); 基站主设备.C9 = dt.Rows[0]["_C9"].ToString(); 基站主设备.D1 = dt.Rows[0]["_D1"].ToString(); 基站主设备.D2 = dt.Rows[0]["_D2"].ToString(); 基站主设备.D3 = dt.Rows[0]["_D3"].ToString(); 基站主设备.D4 = dt.Rows[0]["_D4"].ToString(); 基站主设备.D5 = dt.Rows[0]["_D5"].ToString(); 基站主设备.D6 = dt.Rows[0]["_D6"].ToString(); } return 基站主设备; }
/// <summary> /// 更新(带插入) /// </summary> /// <param name="基站主设备"></param> public static void UpDate基站主设备(Def_基站主设备 基站主设备) { string InsertSQL = "UPDATE [New基站主设备] " + " SET " + " [_A1] = '" + 基站主设备.A1.ToString().Replace("'", "''") + "'" + ", [_A2] = '" + 基站主设备.A2.ToString().Replace("'", "''") + "'" + ", [_A3] = '" + 基站主设备.A3.ToString().Replace("'", "''") + "'" + ", [_A4] = '" + 基站主设备.A4.ToString().Replace("'", "''") + "'" + ", [_A5] = '" + 基站主设备.A5.ToString().Replace("'", "''") + "'" + ", [_A6] = '" + 基站主设备.A6.ToString().Replace("'", "''") + "'" + ", [_B] = '" + 基站主设备.B_B.ToString().Replace("'", "''") + "'" + ", [_C1] = '" + 基站主设备.C1.ToString().Replace("'", "''") + "'" + ", [_C10] = '" + 基站主设备.C10.ToString().Replace("'", "''") + "'" + ", [_C11] = '" + 基站主设备.C11.ToString().Replace("'", "''") + "'" + ", [_C2] = '" + 基站主设备.C2.ToString().Replace("'", "''") + "'" + ", [_C3] = '" + 基站主设备.C3.ToString().Replace("'", "''") + "'" + ", [_C4] = '" + 基站主设备.C4.ToString().Replace("'", "''") + "'" + ", [_C5] = '" + 基站主设备.C5.ToString().Replace("'", "''") + "'" + ", [_C6] = '" + 基站主设备.C6.ToString().Replace("'", "''") + "'" + ", [_C7] = '" + 基站主设备.C7.ToString().Replace("'", "''") + "'" + ", [_C8] = '" + 基站主设备.C8.ToString().Replace("'", "''") + "'" + ", [_C9] = '" + 基站主设备.C9.ToString().Replace("'", "''") + "'" + ", [_D1] = '" + 基站主设备.D1.ToString().Replace("'", "''") + "'" + ", [_D2] = '" + 基站主设备.D2.ToString().Replace("'", "''") + "'" + ", [_D3] = '" + 基站主设备.D3.ToString().Replace("'", "''") + "'" + ", [_D4] = '" + 基站主设备.D4.ToString().Replace("'", "''") + "'" + ", [_D5] = '" + 基站主设备.D5.ToString().Replace("'", "''") + "'" + ", [_D6] = '" + 基站主设备.D6.ToString().Replace("'", "''") + "'" + " WHERE [basedateID] ='" + 基站主设备.BasedateID.ToString().Replace("'", "''") + "'"; string UpDateSQL = "INSERT INTO [New基站主设备] " + " ([basedateID] " + " ,[_A1] " + " ,[_A2] " + " ,[_A3] " + " ,[_A4] " + " ,[_A5] " + " ,[_A6] " + " ,[_B] " + " ,[_C1] " + " ,[_C10] " + " ,[_C11] " + " ,[_C2] " + " ,[_C3] " + " ,[_C4] " + " ,[_C5] " + " ,[_C6] " + " ,[_C7] " + " ,[_C8] " + " ,[_C9] " + " ,[_D1] " + " ,[_D2] " + " ,[_D3] " + " ,[_D4] " + " ,[_D5] " + " ,[_D6]) " + " VALUES " + " ('" + 基站主设备.BasedateID.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.A1.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.A2.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.A3.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.A4.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.A5.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.A6.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.B_B.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C1.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C10.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C11.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C2.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C3.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C4.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C5.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C6.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C7.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C8.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C9.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.D1.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.D2.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.D3.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.D4.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.D5.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.D6.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="基站主设备"></param> public static void Insert基站主设备(Def_基站主设备 基站主设备) { string sql = "INSERT INTO [New基站主设备] " + " ([basedateID] " + " ,[_A1] " + " ,[_A2] " + " ,[_A3] " + " ,[_A4] " + " ,[_A5] " + " ,[_A6] " + " ,[_B] " + " ,[_C1] " + " ,[_C10] " + " ,[_C11] " + " ,[_C2] " + " ,[_C3] " + " ,[_C4] " + " ,[_C5] " + " ,[_C6] " + " ,[_C7] " + " ,[_C8] " + " ,[_C9] " + " ,[_D1] " + " ,[_D2] " + " ,[_D3] " + " ,[_D4] " + " ,[_D5] " + " ,[_D6]) " + " VALUES " + " ('" + 基站主设备.BasedateID.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.A1.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.A2.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.A3.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.A4.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.A5.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.A6.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.B_B.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C1.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C10.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C11.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C2.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C3.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C4.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C5.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C6.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C7.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C8.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.C9.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.D1.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.D2.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.D3.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.D4.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.D5.ToString().Replace("'", "''") + "' " + ",'" + 基站主设备.D6.ToString().Replace("'", "''") + "') "; SQLExecute.ExecuteNonQuery(sql); }
/// <summary> /// Load方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void fr基站主设备_Load(object sender, EventArgs e) { Def_基站主设备 基站主设备 = new Def_基站主设备(BasedateID); 基站主设备 = 基站主设备Comend.Get基站主设备ByBasedateID(BasedateID); tb_A1.Text = 基站主设备.A1; tb_A2.Text = 基站主设备.A2; tb_A3.Text = 基站主设备.A3; tb_A4.Text = 基站主设备.A4; tb_A5.Text = 基站主设备.A5; tb_A6.Text = 基站主设备.A6; tb_B.Text = 基站主设备.B_B; tb_C1.Text = 基站主设备.C1; tb_C10.Text = 基站主设备.C10; tb_C11.Text = 基站主设备.C11; tb_C2.Text = 基站主设备.C2; tb_C3.Text = 基站主设备.C3; tb_C4.Text = 基站主设备.C4; tb_C5.Text = 基站主设备.C5; tb_C6.Text = 基站主设备.C6; tb_C7.Text = 基站主设备.C7; tb_C8.Text = 基站主设备.C8; tb_C9.Text = 基站主设备.C9; tb_D1.Text = 基站主设备.D1; tb_D2.Text = 基站主设备.D2; tb_D3.Text = 基站主设备.D3; tb_D4.Text = 基站主设备.D4; tb_D5.Text = 基站主设备.D5; tb_D6.Text = 基站主设备.D6; IsCanModify(IsModify); }