Ejemplo n.º 1
0
 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();
     }
 }
Ejemplo n.º 2
0
 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);
         }
     }
 }
Ejemplo n.º 3
0
 public static void Update(LoaiPhong lp)
 {
     LP.LoaiPhong_Update(lp);
 }
Ejemplo n.º 4
0
 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);
     }
 }
Ejemplo n.º 5
0
 public static void Insert(LoaiPhong lp)
 {
     LP.LoaiPhong_Insert(lp);
 }