//Hiennv public void LoadData(DateTime createDate) { try { List<CustomerEN> aListCustomersCurrentInRooms = new List<CustomerEN>(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); List<CustomerEN> aListCustomerEN = aReceptionTaskBO.GetListCustomersCurrentInRooms_ByCreateDateBookingR(createDate); CustomerEN aCustomerEN; foreach (CustomerEN items in aListCustomerEN) { aCustomerEN = new CustomerEN(); aCustomerEN.SetValue(items); if (String.IsNullOrEmpty(items.Gender) == false) { aCustomerEN.GenderDisplay = CORE.CONSTANTS.SelectedGender(Convert.ToInt32(items.Gender)).Name; } if (String.IsNullOrEmpty(items.Nationality) == false) { aCustomerEN.NationalityDisplay = CORE.CONSTANTS.SelectedCountry(Convert.ToString(items.Nationality)).Name; } if (items.Citizen != null) { aCustomerEN.CitizenDisplay = CORE.CONSTANTS.SelectedCitizen(Convert.ToInt32(items.Citizen)).Name; } aCustomerEN.IDCompany = items.IDCompany; aCustomerEN.NameCompany = items.NameCompany; aCustomerEN.IDGroup = items.IDGroup; aCustomerEN.NameGroup = items.NameGroup; aCustomerEN.CodeRoom = items.CodeRoom; aCustomerEN.SkuRoom = items.SkuRoom; aListCustomersCurrentInRooms.Add(aCustomerEN); } dgvCustomers.DataSource = aListCustomersCurrentInRooms; dgvCustomers.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_ListCustomersCurrentInRoom.LoadData\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void ReloadData() { try { dgvAvailableCustomers.DataSource = null; CustomersBO aCustomersBO = new CustomersBO(); List<Customers> aListCustomers = new List<Customers>(); List<CustomerEN> aListCustomersEN = new List<CustomerEN>(); if (this.afrmTsk_CheckIn_Goverment_Step2 != null) { aListCustomers.Clear(); aListCustomers = aCustomersBO.SelectListCustomer_ByIDCustomerGroups(IDCustomerGroup); btnAddCustomer.Visible = false; colChoose.Visible = true; } else if (this.afrmTsk_CheckIn_Group_Step2 != null) { aListCustomers.Clear(); aListCustomers = aCustomersBO.SelectListCustomer_ByIDCustomerGroups(IDCustomerGroup); btnAddCustomer.Visible = false; colChoose.Visible = true; } else if (this.afrm_Tsk_CheckIn_Customer_Step2 != null) { aListCustomers.Clear(); aListCustomers = aCustomersBO.SelectListCustomer_ByIDCustomerGroups(IDCustomerGroup); btnAddCustomer.Visible = false; colChoose.Visible = true; } else if (this.afrmTsk_CheckInGoverment_ForRoomBooking_Step2 != null) { aListCustomers.Clear(); aListCustomers = aCustomersBO.SelectListCustomer_ByIDCustomerGroups(IDCustomerGroup); btnAddCustomer.Visible = false; colChoose.Visible = true; } else if (this.afrmTsk_CheckInGroup_ForRoomBooking_Step2 != null) { aListCustomers.Clear(); aListCustomers = aCustomersBO.SelectListCustomer_ByIDCustomerGroups(IDCustomerGroup); btnAddCustomer.Visible = false; colChoose.Visible = true; } else if (this.afrmTsk_CheckInCustomer_ForRoomBooking_Step2 != null) { aListCustomers.Clear(); aListCustomers = aCustomersBO.SelectListCustomer_ByIDCustomerGroups(IDCustomerGroup); btnAddCustomer.Visible = false; colChoose.Visible = true; } else if (this.afrmTsk_Booking_Step2 != null) { aListCustomers.Clear(); aListCustomers = aCustomersBO.SelectListCustomer_ByIDCustomerGroups(IDCustomerGroup); btnAddCustomer.Visible = false; colChoose.Visible = true; } else if (this.afrmMain != null) { aListCustomers.Clear(); aListCustomers = aCustomersBO.Select_All(); btnAddCustomer.Visible = true; colChoose.Visible = false; } else if (this.afrmTsk_BookingHall_Customer_New != null) { aListCustomers.Clear(); aListCustomers = aCustomersBO.Select_All(); btnAddCustomer.Visible = true; } CustomerEN aCus; for (int i = 0; i < aListCustomers.Count; i++) { aCus = new CustomerEN(); aCus.SetValue(aListCustomers[i]); if (String.IsNullOrEmpty(aListCustomers[i].Gender) == false) { aCus.GenderDisplay = CORE.CONSTANTS.SelectedGender(Convert.ToInt32(aListCustomers[i].Gender)).Name; } if (String.IsNullOrEmpty(aListCustomers[i].Nationality) == false) { aCus.NationalityDisplay = CORE.CONSTANTS.SelectedCountry(Convert.ToString(aListCustomers[i].Nationality)).Name; } if (aListCustomers[i].Citizen != null) { aCus.CitizenDisplay = CORE.CONSTANTS.SelectedCitizen(Convert.ToInt32(aListCustomers[i].Citizen)).Name; } aListCustomersEN.Add(aCus); } dgvAvailableCustomers.DataSource = aListCustomersEN; dgvAvailableCustomers.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmLst_Customers.ReloadData\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }