public void Save()
 {
     if (Enabled == false)
     {
         MainButtonText = "Update Receipt";
         Enabled        = true;
     }
     else
     if (CheckForm())
     {
         ReceiptModel rm = Receipt;
         rm.Number   = Number;
         rm.Customer = Customer.Id;
         rm.Amount   = (decimal)Amount;
         rm.Currency = Currency.Id;
         rm.Delivery = Delivery;
         if (Details != null && Details.Trim() != string.Empty)
         {
             rm.Details = Details.Trim();
         }
         if (Season != null)
         {
             rm.Season = Season.Id;
         }
         if (Facture != null)
         {
             rm.Facture = Facture.Id;
         }
         if (Cheque != null && Cheque.Trim() != string.Empty)
         {
             rm.Cheque = Cheque.Trim();
         }
         rm = rm.UpdateThis();
         if (rm.Facture != null && rm.Facture.ToString() != "0")
         {
             if (OldFacture != null)
             {
                 FactureModel fm = new FactureModel();
                 fm = fm.Get((int)OldFacture);
                 fm.ClearUnclear(false);
             }
             rm.ClearFacture();
         }
         System.Windows.MessageBox.Show("Receipt created successfully", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }
示例#2
0
 public void Save()
 {
     if (CheckForm())
     {
         ReceiptModel rm = new ReceiptModel()
         {
             Number   = Number,
             Customer = Customer.Id,
             Amount   = (decimal)Amount,
             Currency = Currency.Id,
             Delivery = Delivery
         };
         if (Details != null && Details.Trim() != string.Empty)
         {
             rm.Details = Details.Trim();
         }
         ;
         if (Season != null)
         {
             rm.Season = Season.Id;
         }
         if (Facture != null)
         {
             rm.Facture = Facture.Id;
         }
         if (Cheque != null && Cheque.Trim() != string.Empty)
         {
             rm.Cheque = Cheque.Trim();
         }
         rm = rm.SaveThis();
         if (rm.Facture != null && rm.Facture.ToString() != "0")
         {
             rm.ClearFacture();
         }
         MessageBox.Show("Receipt created successfully", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }