protected void btnReserv_Click(object sender, EventArgs e) { //lbBookingMess.Text = "Đặt bàn"; int rs = 0; DatTiec data = new DatTiec(); data.Ten = custumerName.Text; data.DiaChi = Address.Text; data.Email = String.Empty; data.SDT = Convert.ToInt32(Phone.Text.Trim()); data.SoNguoi = Amount.Text; DateTime Ngay = DateTime.ParseExact(Date.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); data.Ngay = Ngay; data.Gio = Hour.Text; data.NgayGui = DateTime.Now; data.TrangThai = 0; rs = DatTiec.Them(data); if (rs > 0) { refesh(); lbBookingMess.Text = "Success, thank you!"; } else { lbBookingMess.Text = "Cannot book"; } }
protected void LoadDatTiec(DatTiec data) { //Thong tin khach hang lbID.Text = data.ID.ToString(); lbdiachi.Text = data.DiaChi; lbhoten.Text = data.Ten; lbemail.Text = data.Email; lbgio.Text = data.Gio; lbnguoi.Text = data.SoNguoi; lbngaydat.Text = String.Format("{0:dd/MM/yyyy}", data.Ngay); lbsdt.Text = data.SDT.ToString(); lbngaygui.Text = String.Format("{0:dd/MM/yyyy}", data.NgayGui); lbtrangthai.Text = LoaiStatus(data.TrangThai); titletrangthai.Text = data.TrangThai.ToString(); }
public static int Them(DatTiec dattiec) { try { object rs = DataProvider.Instance.ExecuteNonQueryWithOutput("@ID", "DatTiec_Them", dattiec.ID, dattiec.Ten, dattiec.DiaChi, dattiec.Email, dattiec.SDT, dattiec.SoNguoi, dattiec.Ngay, dattiec.Gio, dattiec.TrangThai, dattiec.NgayGui); return Convert.ToInt32(rs); } catch { return 0; } }
public static bool Sua(DatTiec dattiec) { try { object rs = DataProvider.Instance.ExecuteNonQuery("DatTiec_Sua", dattiec.ID, dattiec.Ten, dattiec.DiaChi, dattiec.Email, dattiec.SDT, dattiec.SoNguoi, dattiec.Ngay, dattiec.Gio, dattiec.TrangThai, dattiec.NgayGui); return Convert.ToInt32(rs) > 0; } catch { return false; } }