コード例 #1
0
 //get info about order to store if changes are made
 private void getOrderInfo()
 {
     if (orderNoTextBox.Text != "")
     {
         order.orderNo = Convert.ToInt32(orderNoTextBox.Text);
     }
     if (order.orderNo > 0)
     {
         if (showNoTextBox.Text != "")
         {
             order.showNo     = Convert.ToInt32(showNoTextBox.Text);
             txtShowName.Text = DatabaseAccess.getShowNameByNo(order.showNo);
         }
         else
         {
             txtShowName.Text = "";
         }
         if (customerNoTextBox.Text != "")
         {
             order.customerNo = Convert.ToInt32(customerNoTextBox.Text);
             Customer customer = DatabaseAccess.getCustomerByNo(order.customerNo);
             txtName.Text = customer.firstName + " " + customer.lastName + " (" + customer.customerNo + ")";
             getCustomerCredit();
         }
         else
         {
             txtName.Text = "";
         }
         order.orderDate = orderDateDateTimePicker.Value;
         order.notes     = txtNotes.Text;
         if (subtotalTextBox.Text != "")
         {
             order.subtotal = Convert.ToDecimal(subtotalTextBox.Text);
         }
         if (discountTextBox.Text != "")
         {
             order.discount = Convert.ToDecimal(discountTextBox.Text);
         }
         if (txtNewTotal.Text != "")
         {
             order.newSubtotal = Convert.ToDecimal(txtNewTotal.Text);
         }
         order.taxable = taxableCheckBox.Checked;
         if (taxTextBox.Text != "")
         {
             order.tax = Convert.ToDecimal(subtotalTextBox.Text);
         }
         if (totalTextBox.Text != "")
         {
             order.total = Convert.ToDecimal(totalTextBox.Text);
         }
         order.amountPaid   = nudAmountPaid.Value;
         cbPaidFull.Checked = (order.amountPaid >= order.total);
         order.paymentType  = (PaymentType)Enum.Parse(typeof(PaymentType), paymentTypeComboBox.Text);
         order.checkNo      = txtCheckNo.Text;
         txtAmountDue.Text  = (order.total - order.amountPaid).ToString("f2");
         getExistingItems();
     }
 }