private void btn_sua_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { bool tt = false; if (comboBox1.SelectedItem.ToString() == "Kích Hoạt") { tt = true; } DTO_Sim ds = new DTO_Sim(txt_id.Text, comboBox2.SelectedValue.ToString(), tt); if (bs.Update_Sim(ds)) { MessageBox.Show("Sửa Thành công "); dataGridView1.DataSource = bs.GetAll(); } else { MessageBox.Show("Sửa Thất Bại "); } } else { MessageBox.Show("Vui lòng chọn Sim muốn sửa "); } }
private void button1_Click(object sender, EventArgs e) { bool tt = false; if (txt_id.Text != " " && comboBox2.SelectedValue.ToString() != " ") { if (comboBox1.SelectedItem.ToString() == "Kích Hoạt") { tt = true; } DTO_Sim ds = new DTO_Sim(txt_id.Text, comboBox2.SelectedValue.ToString(), tt); if (bs.Insert_Sim(ds)) { MessageBox.Show("Thêm Thành Công "); dataGridView1.DataSource = bs.GetAll(); } else { MessageBox.Show("Thêm Thất Bại"); } } }
public bool Update_Sim(DTO_Sim ds) { return(dal_s.update_sim(ds)); }
public bool Insert_Sim(DTO_Sim ds) { return(dal_s.INSERT_SIM(ds)); }
public bool update_sim(DTO_Sim ds) { string sql = "Update " + table + " set MAKH='" + ds.Ma_kh + "', TRINHTRANG='" + ds.Tinhtrang + "' where IDSIM='" + ds.Id_sim + "'"; return(Update(sql)); }
public bool INSERT_SIM(DTO_Sim ds) { string sql = " Insert into " + table + " values('" + ds.Id_sim + "','" + ds.Ma_kh + "','" + ds.Tinhtrang + "')"; return(Update(sql)); }