Пример #1
0
 public static BillDisplay BillModelToBillDisplay(BillModel bill)
 {
     return(new BillDisplay()
     {
         Id = bill.Id,
         Customer_ = LazyWorker <Customer> .Get(bill.CustomerId != null?bill.CustomerId.Value : 0),
         Employee_ = LazyWorker <Employee> .Get(bill.EmployeeId != null?bill.EmployeeId.Value : 0),
         CreatingDay = bill.CreatingDay
     });
 }
Пример #2
0
        private void NewBillButton_Click(object sender, EventArgs e)
        {
            BillModel bill = new BillModel()
            {
                CustomerId  = (CustomerComboBox.SelectedIndex == 0 ? null : (int?)CustomerComboBox.SelectedIndex),
                EmployeeId  = (EmployeeComboBox.SelectedIndex == 0 ? null : (int?)EmployeeComboBox.SelectedIndex),
                CreatingDay = DateTime.Today.Date
            };

            bill.Id = LazyWorker <BillModel> .Insert(bill);

            SetCurrentBill(LessLazyWorker.BillModelToBillDisplay(bill));
        }