Example #1
0
        private void btnSuaThongTin_Click(object sender, EventArgs e)
        {
           /* try
            {*/
                if (edit)
                {
                    edit = false;
                    btnSuaThongTin.Text = "Sữa thông tin.";
                    KhachSan ks = new KhachSan();
                    ks.TenKhachSan = txtTenKhachSan.Text;
                    ks.DiaChi = txtDiaChi.Text;
                    ks.Email = txtEmail.Text;
                    ks.SDT = txtSDT.Text;
                    ks.Website = txtWebSite.Text;
                    ks.ChuThich = TxtChuThich.Text;
                    KhachSanBUS.Update(ks);
                    txtTenKhachSan.Enabled = txtDiaChi.Enabled = txtSDT.Enabled = txtWebSite.Enabled = TxtChuThich.Enabled = txtEmail.Enabled = false;

                }

                else
                {
                    edit = true;
                    btnSuaThongTin.Text = "Hoàn Thành";
                    txtTenKhachSan.Enabled = txtDiaChi.Enabled = txtSDT.Enabled = txtWebSite.Enabled = TxtChuThich.Enabled = txtEmail.Enabled = true;
                }
            /*}
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }*/
            
        }
Example #2
0
 public void KhachSan_Update(KhachSan ks)
 {
     using (var cmd = new SqlCommand("SP_kHACHSAN_Update", GetConnection()))
     {
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add(new SqlParameter("@TenKhachSan", ks.TenKhachSan));
         cmd.Parameters.Add(new SqlParameter("@DiaChi", ks.DiaChi));
         cmd.Parameters.Add(new SqlParameter("@SDT", ks.SDT));
         cmd.Parameters.Add(new SqlParameter("@Email", ks.Email));
         cmd.Parameters.Add(new SqlParameter("@Website", ks.Website));
         cmd.Parameters.Add(new SqlParameter("@ChuThich", ks.ChuThich));
         cmd.ExecuteNonQuery();
     }
 }
Example #3
0
 public static void Update(KhachSan khachsan)
 {
     ks.KhachSan_Update(khachsan);
 }