Exemplo n.º 1
0
        private string CurrentBillToString()
        {
            string NewLine     = Environment.NewLine,
                   lazyNewLine = Environment.NewLine + Environment.NewLine;
            string result      = "Hóa đơn tính tiền" + lazyNewLine;

            result += "Thời gian xuất: " + DateTime.Now + NewLine;
            result += "------------------------------" + NewLine;
            foreach (DataRow row in ((DataTable)ServiceListGridView.DataSource).Rows)
            {
                var service = LazyWorker <ServiceMapped> .DataRowToObject(row);

                result += service.ServiceName + ": " +
                          StringUtilities.LazyFormat(service.Price) + " x " +
                          service.Count + " = " +
                          StringUtilities.LazyFormat(service.Price * service.Count) +
                          NewLine;
            }
            result += "------------------------------" + NewLine;
            result += "Tổng tiền: " + StringUtilities.LazyFormat(currentBill.TotalPrice) + lazyNewLine;
            result += "Tên khách hàng: " + currentBill.Customer_.FullName + lazyNewLine;
            result += "Nhân viên tạo hóa đơn: " + currentBill.Employee_.FullName + lazyNewLine;

            return(result);
        }
Exemplo n.º 2
0
        private void ServicesGridView_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            if ((ServiceGridView.SelectedRows.Count > 0 && ServiceGridView.SelectedRows[0] != null) ||
                ServiceGridView.Rows.Count == 1)
            {
                DataRowView rowView = (ServiceGridView.Rows.Count == 1)
                    ? (ServiceGridView.Rows[0].DataBoundItem as DataRowView)
                    : (ServiceGridView.SelectedRows[0].DataBoundItem as DataRowView);

                LoadOneService(LazyWorker <ServiceDisplay> .DataRowToObject(rowView.Row));

                SaveServiceButton.Enabled   = true;
                DeleteServiceButton.Enabled = true;
            }
        }
Exemplo 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 = "### ### ### ###";
        }