public void LoaiPhong_Update(LoaiPhong lp) { using (var cmd = new SqlCommand("SP_LoaiPhong_Update", GetConnection())) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@MaLP", lp.MaLP)); cmd.Parameters.Add(new SqlParameter("@TenLP", lp.TenLP)); cmd.Parameters.Add(new SqlParameter("@MoTa", lp.MoTa)); cmd.Parameters.Add(new SqlParameter("@SoNguoiMax", lp.SoNguoiMax)); cmd.Parameters.Add(new SqlParameter("@Gia", lp.Gia)); cmd.ExecuteNonQuery(); } }
private void btnChinhSua_Click(object sender, EventArgs e) { if (KiemTraMa() && KiemTra()) { try { LoaiPhong lp = new LoaiPhong(); lp.MaLP = txtMaLP.Text; lp.TenLP = txtTenLP.Text; lp.MoTa = txtMoTa.Text; lp.SoNguoiMax = int.Parse(txtSoNguoiMax.Text.ToString()); lp.Gia = float.Parse(txtGiaTinh.Text.ToString()); LoaiPhongBUS.Update(lp); LoadData(); MessageBox.Show("Chỉnh sửa thành công.", "Thông báo"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public static void Update(LoaiPhong lp) { LP.LoaiPhong_Update(lp); }
private void btnLuu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { LoaiPhong lp = new LoaiPhong(); lp.MaLP = gridView1.GetFocusedRowCellValue(colMaLP).ToString(); lp.TenLP = gridView1.GetFocusedRowCellValue(colTenLP).ToString(); lp.MoTa = gridView1.GetFocusedRowCellValue(colMoTa).ToString(); lp.SoNguoiMax = int.Parse(gridView1.GetFocusedRowCellValue(colSoNguoiMax).ToString()); lp.Gia = float.Parse(gridView1.GetFocusedRowCellValue(colGia).ToString()); LoaiPhongBUS.Update(lp); LoadData(); MessageBox.Show("Chỉnh sửa thành công.", "Thông báo"); } catch(Exception ex) { MessageBox.Show(ex.Message); } }
public static void Insert(LoaiPhong lp) { LP.LoaiPhong_Insert(lp); }