private void btnPrintByCustomer_Click(object sender, EventArgs e) { CustomersBO aCustomersBO = new CustomersBO(); Customers aCustomer = new Customers(); aCustomer = aCustomersBO.Select_ByID(int.Parse(loeListCustomer.EditValue.ToString())); this.aNewPaymentEN = this.aNewPaymentEN.SlipPaymentByCustomer(aCustomer); try { if (this.aNewPaymentEN.Status_BookingR == 8 || this.aNewPaymentEN.Status_BookingR == 7) { frmRpt_Payment_BookingRs afrmRpt_Payment_BookingRs = new frmRpt_Payment_BookingRs(this.aNewPaymentEN); ReportPrintTool tool = new ReportPrintTool(afrmRpt_Payment_BookingRs); tool.ShowPreview(); } else { frmRpt_Payment_BookingRsUnPay afrmRpt_Payment_BookingRs = new frmRpt_Payment_BookingRsUnPay(this.aNewPaymentEN); ReportPrintTool tool = new ReportPrintTool(afrmRpt_Payment_BookingRs); tool.ShowPreview(); } } catch (Exception ex) { MessageBox.Show("frmTsk_ChoosePrintType.btnPrint_Click\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void LoadListBookingRoomType() { CustomersBO aCustomersBO = new CustomersBO(); aListBookingRoomType.Clear(); foreach (var temp in aBookingRoomByTypeBO.Select_ByStatus(true)) { BookingRoomByTypeEN aBookingRoomByTypeEN = new BookingRoomByTypeEN(); aBookingRoomByTypeEN.SetValue(temp); aBookingRoomByTypeEN.CustomerName = aCustomersBO.Select_ByID(aBookingRoomByTypeEN.IDCustomer).Name; aListBookingRoomType.Add(aBookingRoomByTypeEN); } }
public void LoadData() { try { CustomersBO aCustomersBO = new CustomersBO(); BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); BookingRooms aBookingRooms = new BookingRooms(); RoomsBO aRoomsBO = new RoomsBO(); aBookingRooms = aBookingRoomsBO.Select_ByID(this.IDBookingRooms); if (aBookingRooms != null) { lblCheckIn.Text = aBookingRooms.CheckInActual.ToString("dd/MM/yyyy HH:mm"); lblCheckOut.Text = aBookingRooms.CheckOutPlan.ToString("dd/MM/yyyy HH:mm"); lblRoomSku.Text = aRoomsBO.Select_ByCodeRoom(aBookingRooms.CodeRoom,1).Sku; } BookingRsBO aBookingRsBO = new BookingRsBO(); BookingRs aBookingRs = new BookingRs(); aBookingRs = aBookingRsBO.Select_ByID(this.IDBookingRs); if (aBookingRs != null) { lblCustomerType.Text = CORE.CONSTANTS.SelectedCustomerType(Convert.ToInt32(aBookingRs.CustomerType)).Name; CompaniesBO aCompaniesBO = new CompaniesBO(); lblCompany.Text = aCompaniesBO.Select_ByIDBookingRoom(this.IDBookingRooms).Name; lblCustomer.Text = aCustomersBO.Select_ByID(aBookingRs.IDCustomer).Name; CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); lblGroup.Text = aCustomerGroupsBO.Select_ByID(aBookingRs.IDCustomerGroup).Name; lblTel.Text = aCustomersBO.Select_ByID(aBookingRs.IDCustomer).Tel; this.IDCustomerGroup = aBookingRs.IDCustomerGroup; } dgvAvaiableRooms.DataSource = this.LoadListAvailableRooms(aBookingRooms.CheckInActual, aBookingRooms.CheckOutPlan); dgvAvaiableRooms.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_EditBooking.ReloadData\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAdd_Click(object sender, EventArgs e) { DateTime? dateTime = null; CustomersBO aCustomersBO = new CustomersBO(); Customers aCustomers = new Customers(); //Update if (this.IDCustomer > 0) { aCustomers = aCustomersBO.Select_ByID(IDCustomer); } else { aCustomers = new Customers(); } aCustomers.Address = txtAddress.Text; aCustomers.Birthday = String.IsNullOrEmpty(dtpBirthday.Text) ? dateTime : dtpBirthday.DateTime; aCustomers.Citizen = Convert.ToInt32(lueCitizen.EditValue); aCustomers.Email = txtEmail.Text; aCustomers.Gender = lueGender.EditValue.ToString(); aCustomers.Identifier1 = txtIdentifier1.Text; aCustomers.Identifier2 = txtIdentifier2.Text; aCustomers.Identifier3 = txtIdentifier3.Text; aCustomers.Name = txtNames.Text; aCustomers.Nationality = lueNationality.EditValue.ToString(); aCustomers.Tel = txtTel.Text; if (this.IDCustomer > 0) { aCustomersBO.Update(aCustomers); } else { this.IDCustomer = aCustomersBO.Insert(aCustomers); } MessageBox.Show("Thêm mới khách thành công!", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btnEdit_Click(object sender, EventArgs e) { try { CustomersBO acustomersBO = new CustomersBO(); Customers aCustomers = acustomersBO.Select_ByID(IDCustomer); if (ValidateData() == true) { aCustomers.ID = IDCustomer; aCustomers.Name = txtNames.Text; aCustomers.Identifier1 = txtIdentifier1.Text; aCustomers.Birthday = dtpBirthday.DateTime; aCustomers.Tel = txtTel.Text; aCustomers.Address = txtAddress.Text; aCustomers.Email = txtEmail.Text; aCustomers.Info = txtInfo.Text; aCustomers.Status = Convert.ToInt32(lueStatus.EditValue); aCustomers.Type = Convert.ToInt32(cbbCustomerType.Text); aCustomers.Disable = bool.Parse(cbbDisable.Text); acustomersBO.Update(aCustomers); if (this.afrmLst_Customers != null) { this.afrmLst_Customers.ReloadData(); } if (this.afrmIns_CustomerGroups_Customers != null) { this.afrmIns_CustomerGroups_Customers.LoadDataAvailableCustomers(); } MessageBox.Show("Sửa thông tin khách hàng thành công!", "Success ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } catch (Exception ex) { MessageBox.Show("frmUpdateCustomers.btnUpdate_Click\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//public frmUpd_Customers_2(frmIns_CustomerGroups_Customers afrmIns_CustomerGroups_Customers, int IDCustomer) //{ // InitializeComponent(); // this.afrmIns_CustomerGroups_Customers = afrmIns_CustomerGroups_Customers; // this.IDCustomer = IDCustomer; //} //public frmUpd_Customers_2(frmLst_Customers afrmLst_Customers, int aIDCustomer) //{ // InitializeComponent(); // this.afrmLst_Customers = afrmLst_Customers; // this.IDCustomer = aIDCustomer; //} //public frmUpd_Customers_2(frmTsk_EditBooking afrmTsk_EditBooking, int aIDCustomer) //{ // InitializeComponent(); // this.afrmTsk_EditBooking = afrmTsk_EditBooking; // this.IDCustomer = aIDCustomer; //} //public frmUpd_Customers_2(frmTsk_Payment_Step2 afrmTsk_Payment_Step2, int aIDCustomer) //{ // InitializeComponent(); // this.afrmTsk_Payment_Step2 = afrmTsk_Payment_Step2; // this.IDCustomer = aIDCustomer; //} private void frmUpdateCustomers_Load(object sender, EventArgs e) { try { dgvAvailableCustomers.DataSource = (new CustomersBO()).Select_All(); btnAdd.Enabled = false; lueNationality.Properties.DataSource = CORE.CONSTANTS.ListCountries;//Load Country lueNationality.Properties.DisplayMember = "Name"; lueNationality.Properties.ValueMember = "Code"; lueCitizen.Properties.DataSource = CORE.CONSTANTS.ListCitizens;//Load Citizen lueCitizen.Properties.DisplayMember = "Name"; lueCitizen.Properties.ValueMember = "ID"; lueGender.Properties.DataSource = CORE.CONSTANTS.ListGenders;//Load Gioi tinh lueGender.Properties.DisplayMember = "Name"; lueGender.Properties.ValueMember = "ID"; CustomersBO aCustomersBO = new CustomersBO(); // lấy IDCustomer này từ FormCustomers if (this.IDCustomer > 0) { Customers aCustomer = aCustomersBO.Select_ByID(IDCustomer); if (aCustomer != null) { txtNames.EditValue = aCustomer.Name; txtIdentifier1.EditValue = aCustomer.Identifier1; txtIdentifier2.EditValue = aCustomer.Identifier2; txtIdentifier3.EditValue = aCustomer.Identifier3; if (aCustomer.Birthday != null) { dtpBirthday.EditValue = aCustomer.Birthday; } if (String.IsNullOrEmpty(aCustomer.Gender) == false) { lueGender.EditValue = Convert.ToInt32(aCustomer.Gender); } txtAddress.EditValue = aCustomer.Address; if (String.IsNullOrEmpty(aCustomer.Nationality) == false) { lueNationality.EditValue = aCustomer.Nationality; } if (lueNationality.EditValue == null) { lueNationality.EditValue = CORE.CONSTANTS.SelectedCountry(704).Code; } if (aCustomer.Citizen > 0) { lueCitizen.EditValue = aCustomer.Citizen; } else { lueCitizen.EditValue = CORE.CONSTANTS.SelectedCitizen(2).ID; } txtTel.EditValue = aCustomer.Tel; txtEmail.EditValue = aCustomer.Email; } } } catch (Exception ex) { MessageBox.Show("frmUpdateCustomers.frmUpdateCustomers_Load\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnUpdate_Click(object sender, EventArgs e) { BookingRoomsMembersBO aBookingRoomsMembersBO = new BookingRoomsMembersBO(); BookingRoomsMembers aBookingRoomsMembers = new BookingRoomsMembers(); DateTime? dateTime = null; CustomersBO aCustomersBO = new CustomersBO(); Customers aCustomers = new Customers(); //Update if (this.IDCustomer > 0) { aCustomers = aCustomersBO.Select_ByID(IDCustomer); } else { aCustomers = new Customers(); } aCustomers.Address = txtAddress.Text; aCustomers.Birthday = String.IsNullOrEmpty(dtpBirthday.Text) ? dateTime : dtpBirthday.DateTime; aCustomers.Citizen = Convert.ToInt32(lueCitizen.EditValue); aCustomers.Email = txtEmail.Text; aCustomers.Gender = lueGender.EditValue.ToString(); aCustomers.Identifier1 = txtIdentifier1.Text; aCustomers.Identifier2 = txtIdentifier2.Text; aCustomers.Identifier3 = txtIdentifier3.Text; aCustomers.Name = txtNames.Text; aCustomers.Nationality = lueNationality.EditValue.ToString(); aCustomers.Tel = txtTel.Text; if (this.IDCustomer > 0) { aCustomersBO.Update(aCustomers); } else { this.IDCustomer = aCustomersBO.Insert(aCustomers); } /*Insert nguoi moi vao group*/ CustomerGroups_CustomersBO aCustomerGroups_CustomersBO = new CustomerGroups_CustomersBO(); aCustomerGroups_CustomersBO.InsertCustomerIntoCustomerGroup_ByIDBookingRs(this.IDCustomer, (new BookingRsBO()).Select_ByIDBookingRoom(this.IDBookingRoom).ID); /*--------------------------*/ aBookingRoomsMembers = aBookingRoomsMembersBO.Select_ByIDBookingRoom_ByIDCustomer(this.IDBookingRoom, this.IDCustomer); if (aBookingRoomsMembers == null) { aBookingRoomsMembers = new BookingRoomsMembers(); aBookingRoomsMembers.IDBookingRoom = this.IDBookingRoom; aBookingRoomsMembers.IDCustomer = this.IDCustomer; } aBookingRoomsMembers.DateEnterCountry = String.IsNullOrEmpty(dtpDateEnterCountry.Text) ? dateTime : dtpDateEnterCountry.DateTime; aBookingRoomsMembers.EnterGate = txtEnterGate.Text; aBookingRoomsMembers.LeaveDate = String.IsNullOrEmpty(dtpLeaveDate.Text) ? dateTime : dtpLeaveDate.DateTime; aBookingRoomsMembers.LimitDateEnterCountry = String.IsNullOrEmpty(dtpLimitDateEnterCountry.Text) ? dateTime : dtpLimitDateEnterCountry.DateTime; aBookingRoomsMembers.Organization = txtOrganization.Text; aBookingRoomsMembers.PurposeComeVietnam = txtPurposeComeVietnam.Text; aBookingRoomsMembers.TemporaryResidenceDate = String.IsNullOrEmpty(dtpTemporaryResidenceDate.Text) ? dateTime : dtpTemporaryResidenceDate.DateTime; if (aBookingRoomsMembers.ID > 0) { aBookingRoomsMembersBO.Update(aBookingRoomsMembers); } else { aBookingRoomsMembersBO.Insert(aBookingRoomsMembers); } MessageBox.Show("Thực hiện thành công!", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.afrmTsk_Payment_Step2.Reload(); // this.afrmTsk_Payment_Step2.ReloadMoneyRoom(); this.Close(); }
private void InitForm() { // Kiem tra xem phong dang o che do checkIn hay book phong if (this.aBookingRoom.Status < 3) { dtpCheckIn.Text = aBookingRoom.CheckInPlan.ToString(); dtpCheckOut.Text = aBookingRoom.CheckOutPlan.ToString(); } else if (this.aBookingRoom.Status == 3) // Phong da checkIn { dtpCheckIn.Text = DateTime.Now.ToString(); dtpCheckOut.Text = aBookingRoom.CheckOutPlan.ToString(); } if (aBookingRs.CustomerType == 1) { lblCustomerType.Text = "Khách nhà nước"; } else if (aBookingRs.CustomerType == 2) { lblCustomerType.Text = "Cty ngoài"; } else if (aBookingRs.CustomerType == 3) { lblCustomerType.Text = "Khách lẻ"; } else if (aBookingRs.CustomerType == 4) { lblCustomerType.Text = "Khách vãng lai"; } CustomersBO aCustomersBO = new CustomersBO(); CustomerInfoEN aCustomers = new CustomerInfoEN(); aCustomers = new CustomerInfoEN (aCustomersBO.Select_ByID(aBookingRs.IDCustomer)); lblCustomer.Text = aCustomers.Name; lblTel.Text = aCustomers.Tel; CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingRs.IDCustomerGroup); lblGroup.Text = aCustomerGroups.Name; CompaniesBO aCompaniesBO = new CompaniesBO(); lblCompany.Text = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany).Name; // Fill All Customer dgvAvailableCustomers.DataSource = ConvertListCustomer ((new CustomersBO()).Select_All()); lueRooms.Properties.DataSource = this.GetAvaiableRoom(); lueRooms.Properties.ValueMember = "Code"; lueRooms.Properties.DisplayMember = "Sku"; RoomsBO aRoomsBO = new RoomsBO(); Rooms aRooms = new Rooms(); aRooms = aRoomsBO.Select_ByCodeRoom(this.aBookingRoom.CodeRoom, 1); lueRooms.Properties.NullText = aRooms.Sku; lueRooms.SelectedText = aRooms.Sku; lueRooms.EditValue = aRooms.Code; BookingRoomsMembersBO aBookingRoomsMembersBO = new BookingRoomsMembersBO(); List<BookingRoomsMembers> aListBookingRoomsMembers = aBookingRoomsMembersBO.Select_ByIDBookingRoom (this.aBookingRoom.ID); dgvSelectCustomers.DataSource = GetCustomers(aListBookingRoomsMembers); //this.aChangeRoomEn.InsertItemChangeRooms() }
// Author : Linhting public void LoadCustomerInfo() { try { BookingHsBO aBookingHsBO = new BookingHsBO(); CustomersBO aCustomersBO = new CustomersBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); CompaniesBO aCompaniesBO = new CompaniesBO(); int IDCustomer = aBookingHsBO.Select_ByID(this.IDBookingH).IDCustomer; int IDCustomerGroup = aBookingHsBO.Select_ByID(this.IDBookingH).IDCustomerGroup; lblCompany.Text = aCompaniesBO.Select_ByIDCustomerGroup(IDCustomerGroup).Name; lblNameCustomerGroup.Text = aCustomerGroupsBO.Select_ByID(IDCustomerGroup).Name; lblNameCustomer.Text = aCustomersBO.Select_ByID(IDCustomer).Name; } catch (Exception ex) { MessageBox.Show("frmTsk_PaymentHall.LoadCustomerInfo\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (this.CheckDataBeforeUpdate() == true) { DateTime? NullDateTime = null; CustomersBO acustomersBO = new CustomersBO(); Customers aCustomers = acustomersBO.Select_ByID(IDCustomer); aCustomers.ID = IDCustomer; aCustomers.Name = txtNames.Text; aCustomers.Identifier1 = txtIdentifier1.Text; aCustomers.Identifier2 = txtIdentifier2.Text; aCustomers.Identifier3 = txtIdentifier3.Text; aCustomers.Identifier1CreatedDate = String.IsNullOrEmpty(dtpIdentifier1CreatedDate.Text) == true ? NullDateTime : dtpIdentifier1CreatedDate.DateTime; aCustomers.PlaceOfIssue1 = txtPlaceOfIssue1.Text; aCustomers.AgencyOfIssue1 = txtAgencyOfIssue1.Text; aCustomers.Birthday = String.IsNullOrEmpty(dtpBirthday.Text) == true ? NullDateTime : dtpBirthday.DateTime; aCustomers.Gender = Convert.ToString(lueGender.EditValue); aCustomers.Address = txtAddress.Text; aCustomers.Nationality = Convert.ToString(lueNationality.EditValue); aCustomers.Tel = txtTel.Text; aCustomers.Email = txtEmail.Text; aCustomers.Info = txaInfo.Text; aCustomers.Note = txaNote.Text; aCustomers.Description = txaDescription.Text; aCustomers.Status = Convert.ToInt32(lueStatus.EditValue); aCustomers.Type = cbbCustomerType.SelectedIndex + 1; aCustomers.Citizen = Convert.ToInt32(lueCitizen.EditValue); aCustomers.Disable = bool.Parse(cboDisable.Text); int count = acustomersBO.Update(aCustomers); if (count > 0) { MessageBox.Show("Sửa thông tin khách hàng thành công!", "Success ", MessageBoxButtons.OK, MessageBoxIcon.Information); if (this.afrmLst_Customers != null) { this.afrmLst_Customers.ReloadData(); } if (this.afrmIns_CustomerGroups_Customers != null) { this.afrmIns_CustomerGroups_Customers.LoadDataAvailableCustomers(); } else if (this.afrmTsk_EditBooking != null) { this.afrmTsk_EditBooking.ReloadCustomers(); } else if (this.afrmTsk_Payment_Step2 != null) { this.afrmTsk_Payment_Step2.Reload(); } } this.Close(); } } catch (Exception ex) { MessageBox.Show("frmUpdateCustomers.btnUpdate_Click\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void loeListCustomer_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e) { CustomersBO aCustomersBO = new CustomersBO(); Customers aCustomer = new Customers(); if (loeListCustomer.OldEditValue != null || int.Parse(e.NewValue.ToString()) != 0 ) // Để khi fill dữ liệu vào lần đầu không xóa mất aNewPaymentEN { if (int.Parse(e.OldValue.ToString()) == 0) { this.aNewPaymentEN_Backup.Clone(this.aNewPaymentEN); aCustomer = aCustomersBO.Select_ByID(int.Parse(e.NewValue.ToString())); this.aNewPaymentEN = this.aNewPaymentEN.SlipPaymentByCustomer(aCustomer); if (this.aNewPaymentEN.aListBookingRoomUsed.Count > 0) { this.CurrentIDBookingRoom = this.aNewPaymentEN.aListBookingRoomUsed[0].ID; } else { MessageBox.Show("Có thể có lỗi dữ liệu vì người dùng này đang không tồn tại trong phòng nào"); } this.LoadDataCurrentHallForControl(); this.LoadDataCurrentRoomForControl(); } else if (int.Parse(e.OldValue.ToString()) != 0) { if (int.Parse(e.NewValue.ToString()) != 0) // Khi chọn hiển thị dữ liệu cho một người khác { this.aNewPaymentEN.Clone(this.aNewPaymentEN_Backup); aCustomer = aCustomersBO.Select_ByID(int.Parse(e.NewValue.ToString())); this.aNewPaymentEN = this.aNewPaymentEN.SlipPaymentByCustomer(aCustomer); if (this.aNewPaymentEN.aListBookingRoomUsed.Count > 0) { this.CurrentIDBookingRoom = this.aNewPaymentEN.aListBookingRoomUsed[0].ID; } else { MessageBox.Show("Có thể có lỗi dữ liệu vì người dùng này đang không tồn tại trong phòng nào"); } this.LoadDataCurrentHallForControl(); this.LoadDataCurrentRoomForControl(); } else //khi chọn hiển thị dữ liệu cho tất cả { this.aNewPaymentEN.Clone(this.aNewPaymentEN_Backup); if (this.aNewPaymentEN.aListBookingRoomUsed.Count > 0) { this.CurrentIDBookingRoom = this.aNewPaymentEN.aListBookingRoomUsed[0].ID; } else { MessageBox.Show("Có thể có lỗi dữ liệu vì người dùng này đang không tồn tại trong phòng nào"); } this.LoadDataCurrentHallForControl(); this.LoadDataCurrentRoomForControl(); } } } }
//public frmUpd_Customers_2(frmIns_CustomerGroups_Customers afrmIns_CustomerGroups_Customers, int IDCustomer) //{ // InitializeComponent(); // this.afrmIns_CustomerGroups_Customers = afrmIns_CustomerGroups_Customers; // this.IDCustomer = IDCustomer; //} //public frmUpd_Customers_2(frmLst_Customers afrmLst_Customers, int aIDCustomer) //{ // InitializeComponent(); // this.afrmLst_Customers = afrmLst_Customers; // this.IDCustomer = aIDCustomer; //} //public frmUpd_Customers_2(frmTsk_EditBooking afrmTsk_EditBooking, int aIDCustomer) //{ // InitializeComponent(); // this.afrmTsk_EditBooking = afrmTsk_EditBooking; // this.IDCustomer = aIDCustomer; //} //public frmUpd_Customers_2(frmTsk_Payment_Step2 afrmTsk_Payment_Step2, int aIDCustomer) //{ // InitializeComponent(); // this.afrmTsk_Payment_Step2 = afrmTsk_Payment_Step2; // this.IDCustomer = aIDCustomer; //} private void frmUpdateCustomers_Load(object sender, EventArgs e) { try { dgvAvailableCustomers.DataSource = (new CustomersBO()).Select_All(); btnAdd.Enabled = false; lueNationality.Properties.DataSource = CORE.CONSTANTS.ListCountries;//Load Country lueNationality.Properties.DisplayMember = "Name"; lueNationality.Properties.ValueMember = "Code"; lueCitizen.Properties.DataSource = CORE.CONSTANTS.ListCitizens;//Load Citizen lueCitizen.Properties.DisplayMember = "Name"; lueCitizen.Properties.ValueMember = "ID"; lueGender.Properties.DataSource = CORE.CONSTANTS.ListGenders;//Load Gioi tinh lueGender.Properties.DisplayMember = "Name"; lueGender.Properties.ValueMember = "ID"; CustomersBO aCustomersBO = new CustomersBO(); // lấy IDCustomer này từ FormCustomers if (this.IDCustomer > 0) { Customers aCustomer = aCustomersBO.Select_ByID(IDCustomer); if (aCustomer != null) { txtNames.EditValue = aCustomer.Name; txtIdentifier1.EditValue = aCustomer.Identifier1; txtIdentifier2.EditValue = aCustomer.Identifier2; txtIdentifier3.EditValue = aCustomer.Identifier3; if (aCustomer.Birthday != null) { dtpBirthday.EditValue = aCustomer.Birthday; } if (aCustomer.Gender != null) { lueGender.EditValue = int.Parse(aCustomer.Gender.ToString()); } else { lueGender.EditValue = CORE.CONSTANTS.SelectedGender(1).ID; } txtAddress.EditValue = aCustomer.Address; if (String.IsNullOrEmpty(aCustomer.Nationality) == false) { lueNationality.EditValue = aCustomer.Nationality; } if (lueNationality.EditValue == null) { lueNationality.EditValue = CORE.CONSTANTS.SelectedCountry(704).Code; } if (aCustomer.Citizen > 0) { lueCitizen.EditValue = aCustomer.Citizen; } else { lueCitizen.EditValue = CORE.CONSTANTS.SelectedCitizen(2).ID; } //---------------------------------------------------------------- txtTel.EditValue = aCustomer.Tel; txtEmail.EditValue = aCustomer.Email; //---------------------------------------------------------------- CustomerGroups_CustomersBO aCustomerGroups_CustomersBO = new CustomerGroups_CustomersBO(); aCustomerGroups_CustomersBO.InsertCustomerIntoCustomerGroup_ByIDBookingRs(this.IDCustomer, (new BookingRsBO()).Select_ByIDBookingRoom(this.IDBookingRoom).ID); /*--------------------------*/ BookingRoomsMembers aBookingRoomsMembers = new BookingRoomsMembers(); BookingRoomsMembersBO aBookingRoomsMembersBO = new BookingRoomsMembersBO(); aBookingRoomsMembers = aBookingRoomsMembersBO.Select_ByIDBookingRoom_ByIDCustomer(this.IDBookingRoom, this.IDCustomer); if (aBookingRoomsMembers != null) { dtpDateEnterCountry.DateTime = aBookingRoomsMembers.DateEnterCountry.GetValueOrDefault() ; txtEnterGate.Text = aBookingRoomsMembers.EnterGate; dtpLeaveDate.DateTime = aBookingRoomsMembers.LeaveDate.GetValueOrDefault(); dtpLimitDateEnterCountry.DateTime = aBookingRoomsMembers.LimitDateEnterCountry.GetValueOrDefault(); txtOrganization.Text = aBookingRoomsMembers.Organization ; txtPurposeComeVietnam.Text = aBookingRoomsMembers.PurposeComeVietnam ; aBookingRoomsMembers.TemporaryResidenceDate = dtpTemporaryResidenceDate.DateTime ; } } } } catch (Exception ex) { MessageBox.Show("frmUpdateCustomers.frmUpdateCustomers_Load\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnRemoveAvaiableCustomers_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { this.IDCustomer = Convert.ToInt32(viewAvailableCustomers.GetFocusedRowCellValue("ID")); CustomersBO aCustomersBO = new CustomersBO(); Customers aCustomers = new Customers(); aCustomers = aCustomersBO.Select_ByID(this.IDCustomer); txtAddress.Text = aCustomers.Address; dtpBirthday.EditValue = aCustomers.Birthday; lueCitizen.EditValue = aCustomers.Citizen; txtEmail.Text = aCustomers.Email; if (String.IsNullOrEmpty(aCustomers.Gender) == false) { lueGender.EditValue = Convert.ToInt32(aCustomers.Gender); } txtIdentifier1.Text = aCustomers.Identifier1; txtIdentifier2.Text = aCustomers.Identifier2; txtIdentifier3.Text = aCustomers.Identifier3; txtNames.Text = aCustomers.Name; lueNationality.EditValue = aCustomers.Nationality; txtTel.Text = aCustomers.Tel; //-------------------- txtNames.EditValue = aCustomers.Name; txtIdentifier1.EditValue = aCustomers.Identifier1; txtIdentifier2.EditValue = aCustomers.Identifier2; txtIdentifier3.EditValue = aCustomers.Identifier3; if (aCustomers.Birthday != null) { dtpBirthday.EditValue = aCustomers.Birthday; } if (String.IsNullOrEmpty(aCustomers.Gender) == false) { lueGender.EditValue = Convert.ToInt32(aCustomers.Gender); } txtAddress.EditValue = aCustomers.Address; if (String.IsNullOrEmpty(aCustomers.Nationality) == false) { lueNationality.EditValue = aCustomers.Nationality; } if (lueNationality.EditValue == null) { lueNationality.EditValue = CORE.CONSTANTS.SelectedCountry(704).Code; } if (aCustomers.Citizen > 0) { lueCitizen.EditValue = aCustomers.Citizen; } else { lueCitizen.EditValue = CORE.CONSTANTS.SelectedCitizen(2).ID; } //---------------------------------------------------------------- if (aCustomers.Gender != null) { lueGender.EditValue = aCustomers.Citizen; } else { lueGender.EditValue = CORE.CONSTANTS.SelectedGender(1).ID; } txtTel.EditValue = aCustomers.Tel; txtEmail.EditValue = aCustomers.Email; }
private void ResetFormWhenTimeChange() { if (aBookingRs.CustomerType == 1) { lblCustomerType.Text = "Khách nhà nước"; } else if (aBookingRs.CustomerType == 2) { lblCustomerType.Text = "Cty ngoài"; } else if (aBookingRs.CustomerType == 3) { lblCustomerType.Text = "Khách lẻ"; } else if (aBookingRs.CustomerType == 4) { lblCustomerType.Text = "Khách vãng lai"; } CustomersBO aCustomersBO = new CustomersBO(); CustomerInfoEN aCustomers = new CustomerInfoEN(); aCustomers = new CustomerInfoEN (aCustomersBO.Select_ByID(aBookingRs.IDCustomer)); lblCustomer.Text = aCustomers.Name; lblTel.Text = aCustomers.Tel; CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingRs.IDCustomerGroup); lblGroup.Text = aCustomerGroups.Name; CompaniesBO aCompaniesBO = new CompaniesBO(); lblCompany.Text = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany).Name; // Fill All Customer dgvAvailableCustomers.DataSource = ConvertListCustomer ((new CustomersBO()).Select_All()); lueRooms.Properties.DataSource = this.GetAvaiableRoom(); lueRooms.Properties.ValueMember = "Code"; lueRooms.Properties.DisplayMember = "Sku"; RoomsBO aRoomsBO = new RoomsBO(); Rooms aRooms = new Rooms(); aRooms = aRoomsBO.Select_ByCodeRoom(this.aBookingRoom.CodeRoom, 1); lueRooms.Properties.NullText = aRooms.Sku; lueRooms.SelectedText = aRooms.Sku; lueRooms.EditValue = aRooms.Code; BookingRoomsMembersBO aBookingRoomsMembersBO = new BookingRoomsMembersBO(); List<BookingRoomsMembers> aListBookingRoomsMembers = aBookingRoomsMembersBO.Select_ByIDBookingRoom (this.aBookingRoom.ID); dgvSelectCustomers.DataSource = GetCustomers(aListBookingRoomsMembers); }
private void frmTsk_PendingCheckIn_Step2_Load(object sender, EventArgs e) { try { BookingRsBO aBookingRsBO = new BookingRsBO(); BookingRs aBookingRs = aBookingRsBO.Select_ByID(IDBookingR); lblIDBookingR.Text = aBookingRs.ID.ToString(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingRs.IDCustomerGroup); lblNameCustomerGroup.Text = aCustomerGroups.Name; CompaniesBO aCompaniesBO = new CompaniesBO(); Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany); lblNameCompany.Text = aCompanies.Name; CustomersBO aCustomersBO = new CustomersBO(); Customers aCustomers = aCustomersBO.Select_ByID(aBookingRs.IDCustomer); lblNameCustomer.Text = aCustomers.Name; RoomsBO aRoomsBO = new RoomsBO(); Rooms aRooms = aRoomsBO.Select_ByCodeRoom(CodeRoom, 1);//1=IDLang lblSku.Text = aRooms.Sku; dtpTo.DateTime = CheckOutPlan; dtpFrom.DateTime = DateTime.Now; dtpFrom.Enabled = false; dtpFrom.Properties.ReadOnly = true; } catch (Exception ex) { MessageBox.Show("frmTsk_PendingCheckIn_Step2.frmTsk_PendingCheckIn_Step2_Load\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// =============================================================================== // Khoi tao doi tuong Payment private void InitData(int IDBookingR, int IDBookingH) { CompaniesBO aCompaniesBO = new CompaniesBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); SystemUsersBO aSystemUsersBO = new SystemUsersBO(); BookingHsBO aBookingHsBO = new BookingHsBO(); BookingRsBO aBookingRsBO = new BookingRsBO(); BookingRoomsBO aBookingRoomBO = new BookingRoomsBO(); CustomersBO aCustomersBO = new CustomersBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); RoomsBO aRoomsBO = new RoomsBO(); HallsBO aHallsBO = new HallsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); FoodsBO aFoodsBO = new FoodsBO(); ExtraCostBO aExtraCostBO = new ExtraCostBO(); List<int> aListIndexTemp = new List<int>(); BookingHs aBookingHs = new BookingHs(); BookingRs aBookingRs = aBookingRsBO.Select_ByID(IDBookingR); if (this.IDBookingH > 0) { aBookingHs = aBookingHsBO.Select_ByID(this.IDBookingH); } else { BookingRs_BookingHs aItem = (new BookingRs_BookingHsBO()).Select_ByIDBookingR(this.IDBookingR); if (aItem != null) { this.IDBookingH = aItem.IDBookingH.GetValueOrDefault(0); aBookingHs = aBookingHsBO.Select_ByID(this.IDBookingH); } } // Truyen du lieu chung cua NewPayment if (aBookingRs != null) { aNewPaymentEN.IDBookingR = aBookingRs.ID; aNewPaymentEN.IDCustomer = aBookingRs.IDCustomer; Customers aCustomers = aCustomersBO.Select_ByID(aBookingRs.IDCustomer); if (aCustomers != null) { aNewPaymentEN.NameCustomer = aCustomers.Name; } aNewPaymentEN.IDSystemUser = aBookingRs.IDSystemUser; SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingRs.IDSystemUser); if (aSystemUsers != null) { aNewPaymentEN.NameSystemUser = aSystemUsers.Name; } aNewPaymentEN.IDCustomerGroup = aBookingRs.IDCustomerGroup; CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingRs.IDCustomerGroup); if (aCustomerGroups != null) { aNewPaymentEN.NameCustomerGroup = aCustomerGroups.Name; aNewPaymentEN.IDCompany = aCustomerGroups.IDCompany; Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany); if (aCompanies != null) { aNewPaymentEN.NameCompany = aCompanies.Name; aNewPaymentEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode; aNewPaymentEN.AddressCompany = aCompanies.Address; } } aNewPaymentEN.PayMenthodR = aBookingRs.PayMenthod; aNewPaymentEN.CreatedDate_BookingR = aBookingRs.CreatedDate; aNewPaymentEN.CustomerType = aBookingRs.CustomerType; aNewPaymentEN.Status_BookingR = aBookingRs.Status; aNewPaymentEN.StatusPay = aBookingRs.StatusPay; aNewPaymentEN.BookingRMoney = aBookingRs.BookingMoney; aNewPaymentEN.Status_BookingR = aBookingRs.Status; aNewPaymentEN.AcceptDate = aBookingRs.AcceptDate; aNewPaymentEN.InvoiceDate = aBookingRs.InvoiceDate; aNewPaymentEN.InvoiceNumber = aBookingRs.InvoiceNumber; // Truyen du lieu cho List BookingRoom cua NewPayment List<BookingRooms> aListBookingRooms = aBookingRoomBO.Select_ByIDBookingRs(this.IDBookingR); if (aListBookingRooms.Count > 0) { BookingRoomUsedEN aBookingRoomUsedEN; foreach (BookingRooms item in aListBookingRooms) { aBookingRoomUsedEN = new BookingRoomUsedEN(); aBookingRoomUsedEN.SetValue(item); aBookingRoomUsedEN.ListCustomer = aCustomersBO.SelectListCustomer_ByIDBookingRoom(item.ID); Rooms aRooms = aRoomsBO.Select_ByCodeRoom(item.CodeRoom, 1); if (aRooms != null) { aBookingRoomUsedEN.RoomSku = aRooms.Sku; } else { aBookingRoomUsedEN.RoomSku = string.Empty; } if (item.Status == 8 || item.Status == 7) { aBookingRoomUsedEN.AddTimeStart = Convert.ToDouble(aReceptionTaskBO.GetAddTimeStart(Convert.ToInt32(item.Type), item.CheckInActual)); aBookingRoomUsedEN.AddTimeEnd = Convert.ToDouble(aReceptionTaskBO.GetAddTimeEnd(Convert.ToInt32(item.Type), item.CheckOutActual)); aBookingRoomUsedEN.TimeInUse = Convert.ToDecimal(aReceptionTaskBO.GetTimeInUsed(item.CheckInActual, item.CheckOutActual) * 24 * 60); } else { aBookingRoomUsedEN.AddTimeStart = Convert.ToDouble(aReceptionTaskBO.GetAddTimeStart(Convert.ToInt32(item.Type), item.CheckInActual)); aBookingRoomUsedEN.AddTimeEnd = Convert.ToDouble(aReceptionTaskBO.GetAddTimeEnd(Convert.ToInt32(item.Type), item.CheckOutPlan)); aBookingRoomUsedEN.TimeInUse = Convert.ToDecimal(aReceptionTaskBO.GetTimeInUsed(item.CheckInActual, item.CheckOutPlan) * 24 * 60); } decimal? cost = 0; if (item.Cost == null) { cost = item.CostRef_Rooms; aBookingRoomUsedEN.Cost = cost + Convert.ToDecimal(aExtraCostBO.Select_BySku_ByPriceType_ByNumberPeople(aRooms.Sku, aBookingRoomUsedEN.PriceType, aBookingRoomUsedEN.ListCustomer.Count).ExtraValue); } else { cost = item.Cost; aBookingRoomUsedEN.Cost = cost; } List<ServiceUsedEN> aListServiceRTemp = aReceptionTaskBO.GetListServiceUsedInRoom_ByIDBookingRoom(item.ID); foreach (ServiceUsedEN aTemp in aListServiceRTemp) { aBookingRoomUsedEN.ListServiceUsed.Add(aTemp); aListIndexTemp.Add(Convert.ToInt32(aTemp.IndexSubPayment)); } aListIndexTemp.Add(Convert.ToInt32(aBookingRoomUsedEN.IndexSubPayment)); aNewPaymentEN.aListBookingRoomUsed.Add(aBookingRoomUsedEN); } } //==================================================================================================== //==================================================================================================== //==================================================================================================== // Brucelee Thanh sửa ngày 04/06/2015 // //--------------- // Lỗi sai điều kiện câu lệnh if khiến aBookingHs truyền dữ liệu CustomerType sai cho NewPaymentEN //--------------- // Ban đầu : if (aBookingHs != null) //------------------------------------- if (aBookingHs.ID > 0) { aNewPaymentEN.IDBookingH = aBookingHs.ID; aNewPaymentEN.PayMenthodH = aBookingHs.PayMenthod; aNewPaymentEN.CreatedDate_BookingH = aBookingHs.CreatedDate; aNewPaymentEN.CustomerType = aBookingHs.CustomerType; aNewPaymentEN.Status_BookingH = aBookingHs.Status; aNewPaymentEN.BookingHMoney = aBookingHs.BookingMoney; // Truyen du lieu cho List BookingHall cua NewPayment List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(this.IDBookingH); if (aListBookingHalls != null) { BookingHallUsedEN aBookingHallUsedEN; foreach (BookingHalls item in aListBookingHalls) { aBookingHallUsedEN = new BookingHallUsedEN(); aBookingHallUsedEN.SetValue(item); Halls aHalls = aHallsBO.Select_ByCodeHall(item.CodeHall, 1); if (aHalls != null) { aBookingHallUsedEN.HallSku = aHalls.Sku; } else { aBookingHallUsedEN.HallSku = string.Empty; } aBookingHallUsedEN.CustomerType = aBookingHs.CustomerType; aBookingHallUsedEN.BookingTypeBookingH = aBookingHs.BookingType; aBookingHallUsedEN.StatusPayBookingH = aBookingHs.StatusPay; aBookingHallUsedEN.LevelBookingH = aBookingHs.Level; aBookingHallUsedEN.aListMenuEN = aReceptionTaskBO.GetListMenus_ByIDBookingHall(item.ID); aListIndexTemp.Add(Convert.ToInt32(aBookingHallUsedEN.IndexSubPayment)); List<ServiceUsedEN> aListServiceTemp = aReceptionTaskBO.GetListServiceUsedInHall_ByIDBookingHall(item.ID); foreach (ServiceUsedEN aTemp in aListServiceTemp) { aBookingHallUsedEN.aListServiceUsed.Add(aTemp); aListIndexTemp.Add(Convert.ToInt32(aTemp.IndexSubPayment)); } aNewPaymentEN.aListBookingHallUsed.Add(aBookingHallUsedEN); } } } aNewPaymentEN.ListIndex = aListIndexTemp.Distinct().ToList(); } }
public void LoadData() { try { CustomersBO aCustomersBO = new CustomersBO(); BookingRoomsBO aBookingRoomsBO = new BookingRoomsBO(); BookingRooms aBookingRooms = new BookingRooms(); RoomsBO aRoomsBO = new RoomsBO(); // Load các thông tin chung về phòng aBookingRooms = aBookingRoomsBO.Select_ByID(this.IDBookingRooms); if (aBookingRooms != null) { lblCheckIn.Text = aBookingRooms.CheckInActual.ToString("dd/MM/yyyy HH:mm"); lblCheckOut.Text = aBookingRooms.CheckOutPlan.ToString("dd/MM/yyyy HH:mm"); lblRoomSku.Text = aRoomsBO.Select_ByCodeRoom(aBookingRooms.CodeRoom, 1).Sku; } BookingRsBO aBookingRsBO = new BookingRsBO(); BookingRs aBookingRs = new BookingRs(); aBookingRs = aBookingRsBO.Select_ByID(this.IDBookingRs); if (aBookingRs != null) { lblCustomerType.Text = CORE.CONSTANTS.SelectedCustomerType(Convert.ToInt32(aBookingRs.CustomerType)).Name; CompaniesBO aCompaniesBO = new CompaniesBO(); lblCompany.Text = aCompaniesBO.Select_ByIDBookingRoom(this.IDBookingRooms).Name; lblCustomer.Text = aCustomersBO.Select_ByID(aBookingRs.IDCustomer).Name; CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); lblGroup.Text = aCustomerGroupsBO.Select_ByID(aBookingRs.IDCustomerGroup).Name; lblTel.Text = aCustomersBO.Select_ByID(aBookingRs.IDCustomer).Tel; this.IDCustomerGroup = aBookingRs.IDCustomerGroup; } //Load danh sách phòng còn trống lueRooms.Properties.DataSource = this.LoadListAvailableRooms(aBookingRooms.CheckInActual, aBookingRooms.CheckOutPlan); lueRooms.Properties.ValueMember = "RoomCode"; lueRooms.EditValue = this.IDBookingRooms; //Load danh sách khách trong phòng this.aListCustomersInRoom = aCustomersBO.SelectListCustomer_ByIDBookingRoom(this.IDBookingRooms); dgvAvailableCustomers.DataSource = this.aListCustomersInRoom; dgvAvailableCustomers.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmTsk_EditBooking.ReloadData\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmUpdateCustomers_Load(object sender, EventArgs e) { try { lueNationality.Properties.DataSource = CORE.CONSTANTS.ListCountries;//Load Country lueNationality.Properties.DisplayMember = "Name"; lueNationality.Properties.ValueMember = "Code"; lueCitizen.Properties.DataSource = CORE.CONSTANTS.ListCitizens;//Load Citizen lueCitizen.Properties.DisplayMember = "Name"; lueCitizen.Properties.ValueMember = "ID"; lueGender.Properties.DataSource = CORE.CONSTANTS.ListGenders;//Load Gioi tinh lueGender.Properties.DisplayMember = "Name"; lueGender.Properties.ValueMember = "ID"; lueStatus.Properties.DataSource = CORE.CONSTANTS.ListCustomerStatus;//Load CustomerStatus lueStatus.Properties.DisplayMember = "Name"; lueStatus.Properties.ValueMember = "ID"; CustomersBO aCustomersBO = new CustomersBO(); // lấy IDCustomer này từ FormCustomers Customers aCustomer = aCustomersBO.Select_ByID(IDCustomer); if (aCustomer != null) { txtNames.EditValue = aCustomer.Name; txtIdentifier1.EditValue = aCustomer.Identifier1; txtIdentifier2.EditValue = aCustomer.Identifier2; txtIdentifier3.EditValue = aCustomer.Identifier3; txtPlaceOfIssue1.EditValue = aCustomer.PlaceOfIssue1; txtAgencyOfIssue1.EditValue = aCustomer.AgencyOfIssue1; if(aCustomer.Identifier1CreatedDate != null) { dtpIdentifier1CreatedDate.DateTime = aCustomer.Identifier1CreatedDate.GetValueOrDefault(); } if (aCustomer.Birthday != null) { dtpBirthday.DateTime = aCustomer.Birthday.GetValueOrDefault(); } if (String.IsNullOrEmpty(aCustomer.Gender) == false) { lueGender.EditValue = Convert.ToInt32(aCustomer.Gender); } txtAddress.EditValue = aCustomer.Address; if(String.IsNullOrEmpty(aCustomer.Nationality) == false) { lueNationality.EditValue = aCustomer.Nationality; } if (lueNationality.EditValue == null) { lueNationality.EditValue = CORE.CONSTANTS.SelectedCountry(704).Code; } if (aCustomer.Citizen > 0) { lueCitizen.EditValue = aCustomer.Citizen; } else { lueCitizen.EditValue = CORE.CONSTANTS.SelectedCitizen(2).ID; } txtTel.EditValue = aCustomer.Tel; txtEmail.EditValue = aCustomer.Email; txaInfo.EditValue = aCustomer.Info; txaNote.EditValue = aCustomer.Note; txaDescription.EditValue = aCustomer.Description; lueStatus.EditValue = aCustomer.Status; cbbCustomerType.Text = aCustomer.Type.ToString(); if (aCustomer.Disable != null) { cboDisable.Text = Convert.ToString(aCustomer.Disable); } else { cboDisable.Text = "False"; } } } catch (Exception ex) { MessageBox.Show("frmUpdateCustomers.frmUpdateCustomers_Load\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmUpdateCustomers_Load(object sender, EventArgs e) { try { CustomersBO aCustomersBO = new CustomersBO(); Customers aCustomer = aCustomersBO.Select_ByID(IDCustomer); lueStatus.Properties.DataSource = CORE.CONSTANTS.ListCustomerStatus;//Load CustomerStatus lueStatus.Properties.DisplayMember = "Name"; lueStatus.Properties.ValueMember = "ID"; lueStatus.EditValue = aCustomer.Status; // lấy IDCustomer này từ FormCustomers txtNames.Text = aCustomer.Name; txtIdentifier1.Text = aCustomer.Identifier1; dtpBirthday.Text = Convert.ToString(aCustomer.Birthday); txtAddress.Text = aCustomer.Address; txtTel.Text = aCustomer.Tel.ToString(); txtEmail.Text = aCustomer.Email.ToString(); txtInfo.Text = aCustomer.Info.ToString(); lueStatus.EditValue = aCustomer.Status; cbbCustomerType.Text = aCustomer.Type.ToString(); cbbDisable.Text = Convert.ToString(aCustomer.Disable); } catch (Exception ex) { MessageBox.Show("frmUpdateCustomers.frmUpdateCustomers_Load\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//hiennv public void InitData(PaymentHallsEN aPaymentHallsEN, int IDBookingH) { try { HallsBO aHallsBO = new HallsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); FoodsBO aFoodsBO = new FoodsBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); CustomersBO aCustomersBO = new CustomersBO(); BookingHsBO aBookingHsBO = new BookingHsBO(); CompaniesBO aCompaniesBO = new CompaniesBO(); SystemUsersBO aSystemUsersBO = new SystemUsersBO(); BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH); if (aBookingHs != null) { aPaymentHallsEN.IDBookingH = aBookingHs.ID; aPaymentHallsEN.IDCustomerGroup = aBookingHs.IDCustomerGroup; CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingHs.IDCustomerGroup); if (aCustomerGroups != null) { aPaymentHallsEN.NameCustomerGroup = aCustomerGroups.Name; aPaymentHallsEN.IDCompany = aCustomerGroups.IDCompany; Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany); if (aCompanies != null) { aPaymentHallsEN.NameCompany = aCompanies.Name; aPaymentHallsEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode; } } aPaymentHallsEN.IDCustomer = aBookingHs.IDCustomer; Customers aCustomers = aCustomersBO.Select_ByID(aBookingHs.IDCustomer); if (aCustomers != null) { aPaymentHallsEN.NameCustomer = aCustomers.Name; } aPaymentHallsEN.IDSystemUser = aBookingHs.IDSystemUser; SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingHs.IDSystemUser); if (aSystemUsers != null) { aPaymentHallsEN.NameSystemUser = aSystemUsers.Name; } aPaymentHallsEN.CreatedDate_BookingH = aBookingHs.CreatedDate; aPaymentHallsEN.CustomerType = aBookingHs.CustomerType; aPaymentHallsEN.BookingType = aBookingHs.BookingType; aPaymentHallsEN.PayMenthod = aBookingHs.PayMenthod; aPaymentHallsEN.StatusPay = aBookingHs.StatusPay; aPaymentHallsEN.Status_BookingH = aBookingHs.Status; aPaymentHallsEN.ExchangeRate = aBookingHs.ExchangeRate; aPaymentHallsEN.Level = aBookingHs.Level; aPaymentHallsEN.BookingMoney = aBookingHs.BookingMoney; } List<BookingHalls> aListBookingHalls = new List<BookingHalls>(); aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(IDBookingH); InfoDetailPaymentHallsEN aInfoDetailPaymentHallsEN; for (int i = 0; i < aListBookingHalls.Count; i++) { aInfoDetailPaymentHallsEN = new InfoDetailPaymentHallsEN(); Halls aHalls = aHallsBO.Select_ByCodeHall(aListBookingHalls[i].CodeHall, 1); if (aHalls != null) { aInfoDetailPaymentHallsEN.Sku = aHalls.Sku; } else { aInfoDetailPaymentHallsEN.Sku = string.Empty; } aInfoDetailPaymentHallsEN.aBookingHalls = aListBookingHalls[i]; aInfoDetailPaymentHallsEN.aMenusEN = aReceptionTaskBO.GetDetailMenu_ByIDBookingHall(aListBookingHalls[i].ID); aInfoDetailPaymentHallsEN.aListServicesHallsEN = aReceptionTaskBO.GetListServicesHallsEN_ByIDBookingHall(aListBookingHalls[i].ID); aPaymentHallsEN.aListInfoDetailPaymentHallsEN.Insert(i, aInfoDetailPaymentHallsEN); } } catch (Exception ex) { MessageBox.Show("frmTsk_PaymentHall.InitData\n" + ex.ToString()); } }
private void btnRemoveAvaiableCustomers_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { this.IDCustomer = Convert.ToInt32(viewAvailableCustomers.GetFocusedRowCellValue("ID")); CustomersBO aCustomersBO = new CustomersBO(); Customers aCustomers = new Customers(); aCustomers = aCustomersBO.Select_ByID(this.IDCustomer); txtAddress.Text = aCustomers.Address; dtpBirthday.EditValue = aCustomers.Birthday; lueCitizen.EditValue = aCustomers.Citizen; txtEmail.Text = aCustomers.Email; if (String.IsNullOrEmpty(aCustomers.Gender) == false) { lueGender.EditValue = Convert.ToInt32(aCustomers.Gender); } txtIdentifier1.Text = aCustomers.Identifier1; txtIdentifier2.Text = aCustomers.Identifier2; txtIdentifier3.Text = aCustomers.Identifier3; txtNames.Text = aCustomers.Name; lueNationality.EditValue = aCustomers.Nationality; txtTel.Text = aCustomers.Tel; }
// Author : Linhting public void InitData( int IDBookingH) { try { CompaniesBO aCompaniesBO = new CompaniesBO(); CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO(); SystemUsersBO aSystemUsersBO = new SystemUsersBO(); BookingHsBO aBookingHsBO = new BookingHsBO(); CustomersBO aCustomersBO = new CustomersBO(); ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO(); HallsBO aHallsBO = new HallsBO(); BookingHallsBO aBookingHallsBO = new BookingHallsBO(); FoodsBO aFoodsBO = new FoodsBO(); BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH); // Truyen du lieu cho List BookingRoom cua NewPayment if (aBookingHs != null) { aNewPaymentEN.IDCustomer = aBookingHs.IDCustomer; Customers aCustomers = aCustomersBO.Select_ByID(aBookingHs.IDCustomer); if (aCustomers != null) { aNewPaymentEN.NameCustomer = aCustomers.Name; } aNewPaymentEN.IDSystemUser = aBookingHs.IDSystemUser; SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingHs.IDSystemUser); if (aSystemUsers != null) { aNewPaymentEN.NameSystemUser = aSystemUsers.Name; } aNewPaymentEN.IDCustomerGroup = aBookingHs.IDCustomerGroup; CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingHs.IDCustomerGroup); if (aCustomerGroups != null) { aNewPaymentEN.NameCustomerGroup = aCustomerGroups.Name; aNewPaymentEN.IDCompany = aCustomerGroups.IDCompany; Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany); if (aCompanies != null) { aNewPaymentEN.NameCompany = aCompanies.Name; aNewPaymentEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode; aNewPaymentEN.AddressCompany = aCompanies.Address; } } aNewPaymentEN.IDBookingH = aBookingHs.ID; aNewPaymentEN.CreatedDate_BookingH = aBookingHs.CreatedDate; aNewPaymentEN.CustomerType = aBookingHs.CustomerType; aNewPaymentEN.Status_BookingH = aBookingHs.Status; aNewPaymentEN.BookingHMoney = aBookingHs.BookingMoney; // Truyen du lieu cho List BookingHall cua NewPayment List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(this.IDBookingH); if (aListBookingHalls != null) { BookingHallUsedEN aBookingHallUsedEN; foreach (BookingHalls item in aListBookingHalls) { aBookingHallUsedEN = new BookingHallUsedEN(); aBookingHallUsedEN.SetValue(item); Halls aHalls = aHallsBO.Select_ByCodeHall(item.CodeHall, 1); if (aHalls != null) { aBookingHallUsedEN.HallSku = aHalls.Sku; } else { aBookingHallUsedEN.HallSku = string.Empty; } aBookingHallUsedEN.CustomerType = aBookingHs.CustomerType; aBookingHallUsedEN.BookingTypeBookingH = aBookingHs.BookingType; aBookingHallUsedEN.StatusPayBookingH = aBookingHs.StatusPay; aBookingHallUsedEN.LevelBookingH = aBookingHs.Level; aBookingHallUsedEN.aListMenuEN = aReceptionTaskBO.GetListMenus_ByIDBookingHall(item.ID); List<ServiceUsedEN> aListServiceTemp = aReceptionTaskBO.GetListServiceUsedInHall_ByIDBookingHall(item.ID); foreach (ServiceUsedEN aTemp in aListServiceTemp) { aBookingHallUsedEN.aListServiceUsed.Add(aTemp); } aNewPaymentEN.aListBookingHallUsed.Add(aBookingHallUsedEN); } } } } catch (Exception ex) { MessageBox.Show("frmTsk_PaymentHall.InitData\n" + ex.ToString()); } }
//##################################################################### private List<CustomerInfoEN> GetCustomers(List<BookingRoomsMembers> aList) { List<CustomerInfoEN> ret = new List<CustomerInfoEN>(); CustomersBO aCustomersBO = new CustomersBO(); for (int i = 0; i < aList.Count(); i++) { CustomerInfoEN aTemp = new CustomerInfoEN(aCustomersBO.Select_ByID(aList[i].IDCustomer)); aTemp.DateEnterCountry = aList[i].DateEnterCountry; aTemp.EnterGate = aList[i].EnterGate; aTemp.LimitDateEnterCountry = aList[i].LimitDateEnterCountry; aTemp.Organization = aList[i].Organization; aTemp.PurposeComeVietnam = aList[i].PurposeComeVietnam; aTemp.TemporaryResidenceDate = aList[i].TemporaryResidenceDate; ret.Add(aTemp); } return ret; }