コード例 #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateData() == true)
                {
                    ServicesBO aServiceBO = new ServicesBO();
                    Services aService = aServiceBO.Select_ByID(ID);
                    aService.Name = txtName.Text;
                    aService.CostRef = decimal.Parse(txtCost.Text);
                    aService.Unit = txtUnit.Text.ToString();
                    aService.Status = cboStatus.SelectedIndex + 1;
                    aService.Type = cboType.SelectedIndex + 1;
                    aService.Disable = bool.Parse(cboDisable.Text);
                    aService.IDServiceGroups = int.Parse(lueIDServiceGroup.EditValue.ToString());
                    aServiceBO.Update(aService);
                    MessageBox.Show("Cập nhật dữ liệu thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.afrmLst_Services.ReloadData();

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmUpd_Services.btnEdit_Click\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void LoadServiceInBookingHall(int IDBookHall)
        {
            try
            {
                ServicesBO aServicesBO = new ServicesBO();
                BookingHalls_ServicesBO aBookingHalls_ServicesBO = new BookingHalls_ServicesBO();
                List<BookingHalls_Services> aListTemp = aBookingHalls_ServicesBO.Select_ByIDBookingHall(IDBookHall);
                BookingHall_ServiceEN aBookingHall_ServiceEN;
                for (int i = 0; i < aListTemp.Count; i++)
                {
                    aBookingHall_ServiceEN = new BookingHall_ServiceEN();
                    aBookingHall_ServiceEN.ID = aListTemp[i].ID;
                    aBookingHall_ServiceEN.Info = aListTemp[i].Info;
                    aBookingHall_ServiceEN.Type = aListTemp[i].Type;
                    aBookingHall_ServiceEN.Status = aListTemp[i].Status;
                    aBookingHall_ServiceEN.Disable = aListTemp[i].Disable;
                    aBookingHall_ServiceEN.IDBookingHall = aListTemp[i].IDBookingHall;
                    aBookingHall_ServiceEN.IDService = aListTemp[i].IDService;
                    aBookingHall_ServiceEN.Service_Name = aServicesBO.Select_ByID(aListTemp[i].IDService).Name;
                    aBookingHall_ServiceEN.Service_Unit = aServicesBO.Select_ByID(aListTemp[i].IDService).Unit;
                    aBookingHall_ServiceEN.Cost = aListTemp[i].Cost == null ? aListTemp[i].CostRef_Services : aListTemp[i].Cost;
                    aBookingHall_ServiceEN.CostRef_Services = aListTemp[i].CostRef_Services;
                    aBookingHall_ServiceEN.Date = aListTemp[i].Date;
                    aBookingHall_ServiceEN.PercentTax = aListTemp[i].PercentTax;
                    aBookingHall_ServiceEN.Quantity = aListTemp[i].Quantity;
                    aListSelected.Add(aBookingHall_ServiceEN);
                }
                dgvServiceInHall.DataSource = aListSelected;
                dgvServiceInHall.RefreshDataSource();
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmIns_BookingHalls_Services.grvHalls_RowClick\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }
        }
コード例 #3
0
        private void btnDel_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            try
            {
                ServicesBO aServicesBO = new ServicesBO();
                int ID = int.Parse(grvService.GetFocusedRowCellValue("ID").ToString());
                string Name = aServicesBO.Select_ByID(ID).Name;
                DialogResult result = MessageBox.Show("Bạn có muốn xóa dịch vụ " + Name + " này không?", "Xóa công ty", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    aServicesBO.Delete(ID);
                    MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.ReloadData();
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmLst_Services.btnDel_ButtonClick\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #4
0
 private void frmUpd_Services_Load(object sender, EventArgs e)
 {
     try
     {
         ServiceGroupsBO aServiceGroupsBO = new ServiceGroupsBO();
         lueIDServiceGroup.Properties.DataSource = aServiceGroupsBO.Sel_all();
         lueIDServiceGroup.Properties.DisplayMember = "Name";
         lueIDServiceGroup.Properties.ValueMember = "ID";
         ServicesBO aServiceBO = new ServicesBO();
         Services aService = aServiceBO.Select_ByID(ID);
         lblIDService.Text = ID.ToString();
         txtName.Text = aService.Name;
         txtCost.Text = String.Format("{0:0,0}",aService.CostRef);
         cboDisable.Text = aService.Disable.ToString();
         cboStatus.SelectedIndex = Convert.ToInt32(aService.Status - 1);
         cboType.SelectedIndex = Convert.ToInt32(aService.Type - 1);
         txtUnit.Text = aService.Unit;
         lueIDServiceGroup.EditValue = aService.IDServiceGroups;
     }
     catch (Exception ex)
     {
         MessageBox.Show("frmUpd_Services.frmUpd_Services_Load\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #5
0
 private void grvListBookingHalls_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     int IDBookingHall = Convert.ToInt32(grvListBookingHalls.GetFocusedRowCellValue("ID"));
     ServicesBO aServicesBO = new ServicesBO();
     BookingHalls_ServicesBO aBookingHalls_ServicesBO = new BookingHalls_ServicesBO();
     List<BookingHall_ServiceEN> aListBookingHall_ServiceEN = new List<BookingHall_ServiceEN>();
     List<BookingHalls_Services> aListTemp = aBookingHalls_ServicesBO.Select_ByIDBookingHall(IDBookingHall);
     BookingHall_ServiceEN aBookingHall_ServiceEN;
     for (int i = 0; i < aListTemp.Count; i++)
     {
         aBookingHall_ServiceEN = new BookingHall_ServiceEN();
         aBookingHall_ServiceEN.ID = aListTemp[i].ID;
         aBookingHall_ServiceEN.Info = aListTemp[i].Info;
         aBookingHall_ServiceEN.Type = aListTemp[i].Type;
         aBookingHall_ServiceEN.Status = aListTemp[i].Status;
         aBookingHall_ServiceEN.Disable = aListTemp[i].Disable;
         aBookingHall_ServiceEN.IDBookingHall = aListTemp[i].IDBookingHall;
         aBookingHall_ServiceEN.IDService = aListTemp[i].IDService;
         aBookingHall_ServiceEN.Service_Name = aServicesBO.Select_ByID(aListTemp[i].IDService).Name;
         aBookingHall_ServiceEN.Service_Unit = aServicesBO.Select_ByID(aListTemp[i].IDService).Unit;
         aBookingHall_ServiceEN.Cost = aListTemp[i].CostRef_Services;
         aBookingHall_ServiceEN.CostRef_Services = aListTemp[i].CostRef_Services;
         aBookingHall_ServiceEN.Date = aListTemp[i].Date;
         aBookingHall_ServiceEN.PercentTax = aListTemp[i].PercentTax;
         aBookingHall_ServiceEN.Quantity = aListTemp[i].Quantity;
         aListBookingHall_ServiceEN.Add(aBookingHall_ServiceEN);
     }
     dgvServiceInBookingHall.DataSource = aListBookingHall_ServiceEN;
     dgvServiceInBookingHall.RefreshDataSource();
 }
コード例 #6
0
        private void LoadServicesInRoom()
        {
            try
            {
                ServicesBO aServicesBO = new ServicesBO();
                BookingRooms_ServicesBO aBookingRooms_ServicesBO = new BookingRooms_ServicesBO();
                List<BookingRooms_Services> aListTemp = aBookingRooms_ServicesBO.Select_ByIDBookingRooms(this.IDBookingRoom);
                BookingRoom_ServiceEN aBookingRoom_ServiceEN;

                for (int i = 0; i < aListTemp.Count; i++)
                {
                    aBookingRoom_ServiceEN = new BookingRoom_ServiceEN();
                    aBookingRoom_ServiceEN.ID = aListTemp[i].ID;
                    aBookingRoom_ServiceEN.Info = aListTemp[i].Info;
                    aBookingRoom_ServiceEN.Type = aListTemp[i].Type;
                    aBookingRoom_ServiceEN.Status = aListTemp[i].Status;
                    aBookingRoom_ServiceEN.Disable = aListTemp[i].Disable;
                    aBookingRoom_ServiceEN.IDBookingRoom = aListTemp[i].IDBookingRoom;
                    aBookingRoom_ServiceEN.IDService = aListTemp[i].IDService;
                    aBookingRoom_ServiceEN.Service_Name = aServicesBO.Select_ByID(aListTemp[i].IDService).Name;
                    aBookingRoom_ServiceEN.Service_Unit = aServicesBO.Select_ByID(aListTemp[i].IDService).Unit;
                    aBookingRoom_ServiceEN.Cost = aListTemp[i].Cost == null ? aListTemp[i].CostRef_Services : aListTemp[i].Cost;
                    aBookingRoom_ServiceEN.CostRef_Services = aListTemp[i].CostRef_Services;
                    aBookingRoom_ServiceEN.Date = aListTemp[i].Date;
                    aBookingRoom_ServiceEN.PercentTax = aListTemp[i].PercentTax;
                    aBookingRoom_ServiceEN.Quantity = aListTemp[i].Quantity;
                    aBookingRoom_ServiceEN.Tag = aListTemp[i].Tag;
                    aListSelected.Add(aBookingRoom_ServiceEN);
                }
                dgvServiceInRoom.DataSource = aListSelected;
                dgvServiceInRoom.RefreshDataSource();

                CustomersBO aCustomersBO = new CustomersBO();

                lueUserInRoom.DataSource = aCustomersBO.SelectListCustomer_ByIDBookingRoom(this.IDBookingRoom);

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmIns_BookingRooms_Services.grvRooms_RowClick\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }
        }
コード例 #7
0
 private void grvListBookingHalls_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     try
     {
         int IDBookingHall = Convert.ToInt32(grvListBookingHalls.GetFocusedRowCellValue("ID"));
         ServicesBO aServicesBO = new ServicesBO();
         BookingHalls_ServicesBO aBookingHalls_ServicesBO = new BookingHalls_ServicesBO();
         List<BookingHall_ServiceEN> aListBookingHall_ServiceEN = new List<BookingHall_ServiceEN>();
         List<BookingHalls_Services> aListTemp = aBookingHalls_ServicesBO.Select_ByIDBookingHall(IDBookingHall);
         BookingHall_ServiceEN aBookingHall_ServiceEN;
         for (int i = 0; i < aListTemp.Count; i++)
         {
             aBookingHall_ServiceEN = new BookingHall_ServiceEN();
             aBookingHall_ServiceEN.ID = aListTemp[i].ID;
             aBookingHall_ServiceEN.Info = aListTemp[i].Info;
             aBookingHall_ServiceEN.Type = aListTemp[i].Type;
             aBookingHall_ServiceEN.Status = aListTemp[i].Status;
             aBookingHall_ServiceEN.Disable = aListTemp[i].Disable;
             aBookingHall_ServiceEN.IDBookingHall = aListTemp[i].IDBookingHall;
             aBookingHall_ServiceEN.IDService = aListTemp[i].IDService;
             aBookingHall_ServiceEN.Service_Name = aServicesBO.Select_ByID(aListTemp[i].IDService).Name;
             aBookingHall_ServiceEN.Service_Unit = aServicesBO.Select_ByID(aListTemp[i].IDService).Unit;
             aBookingHall_ServiceEN.Cost = aListTemp[i].CostRef_Services;
             aBookingHall_ServiceEN.CostRef_Services = aListTemp[i].CostRef_Services;
             aBookingHall_ServiceEN.Date = aListTemp[i].Date;
             aBookingHall_ServiceEN.PercentTax = aListTemp[i].PercentTax;
             aBookingHall_ServiceEN.Quantity = aListTemp[i].Quantity;
             aListBookingHall_ServiceEN.Add(aBookingHall_ServiceEN);
         }
         dgvServiceInBookingHall.DataSource = aListBookingHall_ServiceEN;
         dgvServiceInBookingHall.RefreshDataSource();
     }
     catch (Exception ex)
     {
         MessageBox.Show("frmTsk_UnpayBookingHs.grvListBookingHalls_RowClick\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public void LoadServiceInBookingHall(int IDBookingHall)
        {
            try
            {
                ServicesBO aServicesBO = new ServicesBO();
                BookingHalls_ServicesBO aBookingHalls_ServicesBO = new BookingHalls_ServicesBO();
                List<BookingHalls_Services> aListTemp = aBookingHalls_ServicesBO.Select_ByIDBookingHall(IDBookingHall);
                BookingHall_ServiceEN aBookingHall_ServiceEN;
                for (int i = 0; i < aListTemp.Count; i++)
                {
                    aBookingHall_ServiceEN = new BookingHall_ServiceEN();
                    aBookingHall_ServiceEN.ID = aListTemp[i].ID;
                    aBookingHall_ServiceEN.Info = aListTemp[i].Info;
                    aBookingHall_ServiceEN.Type = aListTemp[i].Type;
                    aBookingHall_ServiceEN.Status = aListTemp[i].Status;
                    aBookingHall_ServiceEN.Disable = aListTemp[i].Disable;
                    aBookingHall_ServiceEN.IDBookingHall = aListTemp[i].IDBookingHall;
                    aBookingHall_ServiceEN.IDService = aListTemp[i].IDService;
                    aBookingHall_ServiceEN.Service_Name = aServicesBO.Select_ByID(aListTemp[i].IDService).Name;
                    aBookingHall_ServiceEN.Service_Unit = aServicesBO.Select_ByID(aListTemp[i].IDService).Unit;

                    aBookingHall_ServiceEN.Cost = aListTemp[i].Cost == null ? aListTemp[i].CostRef_Services : aListTemp[i].Cost;
                    aBookingHall_ServiceEN.CostRef_Services = aListTemp[i].CostRef_Services;
                    aBookingHall_ServiceEN.Date = aListTemp[i].Date;
                    aBookingHall_ServiceEN.PercentTax = aListTemp[i].PercentTax;
                    aBookingHall_ServiceEN.Quantity = aListTemp[i].Quantity;

                    aBookingHall_ServiceEN.Tag = aListTemp[i].Tag;

                    aListSelected.Add(aBookingHall_ServiceEN);
                }
                dgvServiceInHall.DataSource = aListSelected;
                dgvServiceInHall.RefreshDataSource();

                CustomersBO aCustomersBO = new CustomersBO();
                BookingRs_BookingHsBO aBookingRs_BookingHsBO = new BookingRs_BookingHsBO();
                List<Customers> aListCustomerRoom = new List<Customers>();
                List<Customers> aListCustomerHall = aCustomersBO.SelectListCustomer_ByIDBookingH(this.IDBookingHall);
                if (this.aNewPayment != null)
                {
                    if (this.aNewPayment.IDBookingR > 0)
                    {
                       aListCustomerRoom = aCustomersBO.SelectListCustomer_ByIDBookingR(this.aNewPayment.IDBookingR.GetValueOrDefault(0));
                    }
                }
                aListCustomerHall.AddRange(aListCustomerRoom);
                lueUserInHall.DataSource = aListCustomerHall;
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmIns_BookingHalls_Services.grvHalls_RowClick\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }
        }