Ejemplo n.º 1
0
 private void LoadOneBill(BillDisplay bill)
 {
     IdNumericUpDown.Value = bill.Id;
     this.bill             = new BillDisplay()
     {
         Id          = bill.Id,
         CreatingDay = bill.CreatingDay,
         Customer_   = bill.Customer_,
         Employee_   = bill.Employee_,
         TotalPrice  = bill.TotalPrice
     };
 }
Ejemplo n.º 2
0
        public void SetCurrentBill(BillDisplay bill)
        {
            currentBill = bill;

            LoadAllServices();
            LoadAllCustomers();
            LoadAllEmployees();

            if (bill.Id != 0)
            {
                LoadBillsServices();
                currentDetails = LessLazyWorker.GetBillDetails(currentBill.Id);

                CustomerComboBox.SelectedValue = bill.Customer_.Id;
                EmployeeComboBox.SelectedValue = bill.Employee_.Id;

                SaveBillButton.Enabled           =
                    DeleteBillButton.Enabled     =
                        ExportBillButton.Enabled =
                            true;

                AddServiceButton.Enabled            =
                    SaveServiceButton.Enabled       =
                        RemoveServiceButton.Enabled =
                            true;
            }
            else
            {
                LoadBillsServices(new List <ServiceMapped>());
                currentDetails = new List <BillDetail>();

                CustomerComboBox.SelectedIndex = 0;
                EmployeeComboBox.SelectedIndex = 0;

                SaveBillButton.Enabled           =
                    DeleteBillButton.Enabled     =
                        ExportBillButton.Enabled =
                            false;

                AddServiceButton.Enabled            =
                    SaveServiceButton.Enabled       =
                        RemoveServiceButton.Enabled =
                            false;
            }
        }
Ejemplo n.º 3
0
        private void LoadAllBills()
        {
            LazyWorker <BillDisplay> .LoadAllToGridView
            (
                BillGridView,
                new string[] { "Id", "Customer_", "Employee_", "CreatingDay" },
                LessLazyWorker.GetAllBills()
            );

            DataTable table = (DataTable)BillGridView.DataSource;

            table.Columns.Add("Customer");
            table.Columns.Add("Employee");
            LessLazyWorker.SetColumnsOrder(table,
                                           new string[] { "Customer", "Employee", "CreatingDay", "TotalPrice" });

            foreach (DataRow row in table.Rows)
            {
                BillDisplay bill = LazyWorker <BillDisplay> .DataRowToObject(row);

                row["Customer"] = bill.Customer_ != null ? bill.Customer_.FullName : "";
                row["Employee"] = bill.Employee_ != null ? bill.Employee_.FullName : "";
            }

            BillGridView.DataSource = table;

            BillGridView.Columns["Id"].Visible        = false;
            BillGridView.Columns["Filter"].Visible    = false;
            BillGridView.Columns["Customer_"].Visible = false;
            BillGridView.Columns["Employee_"].Visible = false;

            BillGridView.Columns["CreatingDay"].HeaderText             = "Ngày khởi tạo";
            BillGridView.Columns["Customer"].HeaderText                = "Tên khách";
            BillGridView.Columns["Employee"].HeaderText                = "Tạo bởi";
            BillGridView.Columns["TotalPrice"].HeaderText              = "Tổng tiền";
            BillGridView.Columns["TotalPrice"].DefaultCellStyle.Format = "### ### ### ###";
        }