public void ReloadData() { try { dgvAvailableCompanies.DataSource = null; List<Companies> aListCompanies = new List<Companies>(); CompaniesBO aCompaniesBO = new CompaniesBO(); if (afrmIns_CustomerGroups_Customers_Old != null) { aListCompanies = aCompaniesBO.Select_All(); btnAdd.Visible = false; } else if(this.afrmTsk_BookingHall_Goverment != null) { aListCompanies = aCompaniesBO.Select_ByType(Type); btnAdd.Visible = false; } else if (this.afrmTsk_BookingHall_Group != null) { aListCompanies = aCompaniesBO.Select_ByType(Type); btnAdd.Visible = false; } else if (this.afrmTsk_UpdBooking != null) { aListCompanies = aCompaniesBO.Select_ByType(Type); btnAdd.Visible = false; } else { aListCompanies = aCompaniesBO.Select_All(); btnAdd.Visible = true; } dgvAvailableCompanies.DataSource = aListCompanies; } catch (Exception ex) { MessageBox.Show("frmLst_Companies.ReloadData\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmIns_CustomerGroups_Load(object sender, EventArgs e) { try { CompaniesBO aCompaniesBO = new CompaniesBO(); List<Companies> aListCompanies = aCompaniesBO.Select_All(); Companies aItem = new Companies(); aItem.Name ="[Tất cả]"; aItem.ID = 0; aListCompanies.Add(aItem); lueFilterCompany.Properties.DataSource = aListCompanies; lueFilterCompany.Properties.DisplayMember = "Name"; lueFilterCompany.Properties.ValueMember = "ID"; this.IsReadyInit = true; } catch (Exception ex) { MessageBox.Show("frmIns_CustomerGroups.frmIns_CustomerGroups_Load\n" + ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmUpd_CustomerGroups_Load(object sender, EventArgs e) { try { CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(IDCustomerGroups_Old); CompaniesBO aCompaniesBO = new CompaniesBO(); lueCompany.Properties.DataSource = aCompaniesBO.Select_All(); lueCompany.Properties.DisplayMember = "Name"; lueCompany.Properties.ValueMember = "ID"; lueCompany.EditValue = aCustomerGroups.IDCompany; lblIDCustomerGroup.Text = aCustomerGroups.ID.ToString(); txtName.Text = aCustomerGroups.Name.ToString(); cboType.Text = aCustomerGroups.Type.ToString(); cboStatus.Text = aCustomerGroups.Status.ToString(); cboDisable.Text = aCustomerGroups.Disable.ToString(); } catch (Exception ex) { MessageBox.Show("frmEditCustomerGroup.frmEditCustomerGroup_Load\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void LoadIDCompanies() { try { CompaniesBO aCompaniesBO = new CompaniesBO(); lueCompany.Properties.DataSource = aCompaniesBO.Select_All(); lueCompany.Properties.DisplayMember = "Name"; lueCompany.Properties.ValueMember = "ID"; } catch (Exception ex) { MessageBox.Show("frmIns_CustomerGroups_Customers.LoadIDCompanies\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private List<Companies> LoadListCompaniesByType() { try { CompaniesBO aCompaniesBO = new CompaniesBO(); Companies aItem = new Companies(); aItem.Name = "[Hiện tất cả]"; aItem.ID = 0; List<Companies> aList = new List<Companies>(); aList = aCompaniesBO.Select_All(); aList.Add(aItem); return aList; } catch (Exception ex) { MessageBox.Show("frmTsk_BookingForRoom.LoadListCompaniesByType()\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } }
private void frmIns_CustomerGroups_Load(object sender, EventArgs e) { try { CompaniesBO aCompaniesBO = new CompaniesBO(); List<Companies> aListCompanies = aCompaniesBO.Select_All(); lueCompany.Properties.DataSource = aListCompanies; lueCompany.Properties.DisplayMember = "Name"; lueCompany.Properties.ValueMember = "ID"; if (IDCompany == 0) { if(aListCompanies.Count > 0) { lueCompany.EditValue = aListCompanies[0].ID; } } else { lueCompany.Enabled = false; lueCompany.EditValue = IDCompany; } } catch (Exception ex) { MessageBox.Show("frmIns_CustomerGroups.frmIns_CustomerGroups_Load\n" + ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Ngoc da sua lai ten ham 26/12/2014 public List<BookingRStatusPayViewEN> GetListBookingRByStatus(DateTime? From, DateTime? To, int? CustomerType, string StatusPay) { List<sp_BookingRsExt_GetInfo_ByTime_ByCustomerType_ByStatusPay_Result> aListTemp = new List<sp_BookingRsExt_GetInfo_ByTime_ByCustomerType_ByStatusPay_Result>(); aListTemp = aDatabaseDA.sp_BookingRsExt_GetInfo_ByTime_ByCustomerType_ByStatusPay(From, To, CustomerType, StatusPay).ToList(); List<BookingRStatusPayViewEN> aListReturn = new List<BookingRStatusPayViewEN>(); BookingRStatusPayViewEN aBookingRStatusPayViewEN; CompaniesBO aCompaniesBO = new CompaniesBO(); List<Companies> aListCompaniesTemp = aCompaniesBO.Select_All(); BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); List<BookingRooms> aListBookingRoomTemp = aBookingRoomsBO.Select_All(); for (int i = 0; i < aListTemp.Count; i++) { aBookingRStatusPayViewEN = new BookingRStatusPayViewEN(); aBookingRStatusPayViewEN.IDBookingR = aListTemp[i].BookingRs_ID; aBookingRStatusPayViewEN.CreatedDate = aListTemp[i].BookingRs_CreatedDate; aBookingRStatusPayViewEN.Customer_Name = aListTemp[i].Customers_Name; aBookingRStatusPayViewEN.Subject = aListTemp[i].BookingRs_Subject; aBookingRStatusPayViewEN.IDCustomer = aListTemp[i].Customers_ID; aBookingRStatusPayViewEN.IDCustomerGroup = aListTemp[i].CustomerGroups_ID; aBookingRStatusPayViewEN.BookingRs_Status = aListTemp[i].BookingRs_Status; aBookingRStatusPayViewEN.CustomerGroups_Name = aListTemp[i].CustomerGroups_Name; int IDCompany = !String.IsNullOrEmpty(aListTemp[i].Companies_ID.ToString()) ? Convert.ToInt32(aListTemp[i].Companies_ID) : 0; if (aListCompaniesTemp.Where(c => c.ID == IDCompany).ToList().Count > 0) { aBookingRStatusPayViewEN.NameCompany = aListCompaniesTemp.Where(c => c.ID == IDCompany).ToList()[0].Name; } else { aBookingRStatusPayViewEN.NameCompany = string.Empty; } aBookingRStatusPayViewEN.StatusPay = aListTemp[i].BookingRs_StatusPay; aBookingRStatusPayViewEN.BookingMoney = aListTemp[i].BookingRs_BookingMoney; aBookingRStatusPayViewEN.Sku = aListTemp[i].Rooms_Sku; aBookingRStatusPayViewEN.IDBookingH = aListTemp[i].BookingRs_BookingHs_IDBookingH; aBookingRStatusPayViewEN.BookingHs_Status = aListTemp[i].BookingHs_Status; aBookingRStatusPayViewEN.BookingHs_StatusPay = aListTemp[i].BookingHs_StatusPay; aBookingRStatusPayViewEN.BookingHs_Type = aListTemp[i].BookingHs_Type; aBookingRStatusPayViewEN.BookingHs_Disable = aListTemp[i].BookingHs_Disable; aBookingRStatusPayViewEN.BookingHs_Subject = aListTemp[i].BookingHs_Subject; List<BookingRooms> aListBookingRooms = aListBookingRoomTemp.Where(br => br.IDBookingR == aListTemp[i].BookingRs_ID && br.CodeRoom == aListTemp[i].Rooms_Code).ToList(); if (aListBookingRooms.Count > 0) { switch (aListBookingRooms[0].Status) { case 3: aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Đã check in"; break; case 5: aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Pending"; break; case 7: aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Đã check out nhưng chưa thanh toán"; break; case 8: aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Đã thanh toán"; break; default: aBookingRStatusPayViewEN.BookingRoomStatusPayDisplay = "Chưa xác định"; break; } aBookingRStatusPayViewEN.IDBookingRoom = aListBookingRooms[0].ID; aBookingRStatusPayViewEN.BookingRooms_CodeRoom = aListBookingRooms[0].CodeRoom; aBookingRStatusPayViewEN.CheckInActual = aListBookingRooms[0].CheckInActual; aBookingRStatusPayViewEN.CheckOut = aListBookingRooms[0].CheckOutPlan; } switch (aBookingRStatusPayViewEN.StatusPay) { case 1: aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Chưa thanh toán"; break; case 2: aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Tạm ứng"; break; case 3: aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Đã thanh toán"; break; default: aBookingRStatusPayViewEN.BookingRStatusPayDisplay = "Chưa xác định"; break; } switch (aListTemp[i].BookingRs_CustomerType) { case 1: aBookingRStatusPayViewEN.CustomerTypeDisplay = "Nhà nước"; break; case 2: aBookingRStatusPayViewEN.CustomerTypeDisplay = "Khách đoàn"; break; case 3: aBookingRStatusPayViewEN.CustomerTypeDisplay = "Khách lẻ"; break; case 4: aBookingRStatusPayViewEN.CustomerTypeDisplay = "Khách vãng lai"; break; case 5: aBookingRStatusPayViewEN.CustomerTypeDisplay = "Khách bộ ngoại giao"; break; default: aBookingRStatusPayViewEN.CustomerTypeDisplay = "Chưa xác định"; break; } aListReturn.Add(aBookingRStatusPayViewEN); } return aListReturn; }