Example #1
0
 private void DontSaveAndClear_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("All Unsaved Purchase Information will be Lost!", "Warning", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
     {
         purchase = new Data.Purchase();
         InitializeFields();
     }
 }
Example #2
0
 private void DontSaveAndClose_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("All Unsaved Purchase Information will be Lost!", "Warning", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
     {
         purchase = null;
         //Close();
     }
 }
 private void DontSaveAndClose_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("All Unsaved Purchase Information will be Lost!", "Warning", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
     {
         purchase = null;
         //Close();
     }
 }
 private void DontSaveAndClear_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("All Unsaved Purchase Information will be Lost!", "Warning", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
     {
         purchase = new Data.Purchase();
         InitializeFields();
     }
 }
Example #5
0
 public PurchaseEditor(int partyid, int employee)
 {
     this.employee = employee;
     InitializeComponent();
     purchase = new Data.Purchase();
     InitializeFields();
     purchase.Customer.PartyId = partyid;
     itemselector = new Controls.ItemSelector();
     ItemsContentControl.Content = itemselector;
     itemselector.itemsupdated  += new Shell.Controls.ItemSelector.ItemsUpdated(itemselector_itemsupdated);
 }
 public PurchaseEditor(int partyid, int employee)
 {
     this.employee = employee;
     InitializeComponent();
     purchase = new Data.Purchase();
     InitializeFields();
     purchase.Customer.PartyId = partyid;
     itemselector = new Controls.ItemSelector();
     ItemsContentControl.Content = itemselector;
     itemselector.itemsupdated += new Shell.Controls.ItemSelector.ItemsUpdated(itemselector_itemsupdated);
 }
Example #7
0
 private void PrintAndDoMore_Click(object sender, RoutedEventArgs e)
 {
     PreSavePurchase();
     if (PurchaseIsValid())
     {
         bool saved = SavePurchase();
         if (saved)
         {
             Print();
             Data.Party p = purchase.Customer;
             purchase          = new Data.Purchase();
             purchase.Customer = p;
             InitializeFields();
         }
     }
     else
     {
         MessageBox.Show("Purchase Failed Validation.  Please Correct and try again.");
     }
 }
 private void PrintAndDoMore_Click(object sender, RoutedEventArgs e)
 {
     PreSavePurchase();
     if (PurchaseIsValid())
     {
         bool saved = SavePurchase();
         if (saved)
         {
             Print();
             Data.Party p = purchase.Customer;
             purchase = new Data.Purchase();
             purchase.Customer = p;
             InitializeFields();
         }
     }
     else
     {
         MessageBox.Show("Purchase Failed Validation.  Please Correct and try again.");
     }
 }
Example #9
0
        public int PurchaseSave(Purchase purchase, int employee)
        {
            //purchase.Customer.PartyId = PartySave(purchase.Customer, employee);

            SqlConnection conn = new SqlConnection(connectionString);
            conn.Open();
            SqlCommand cmd = new SqlCommand("PurchaseSave", conn);
            cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter purchaseidparam = cmd.Parameters.Add("@PurchaseId", SqlDbType.Int);
            if (purchase.PurchaseId == 0)
                purchaseidparam.Direction = ParameterDirection.Output;
            else
                purchaseidparam.Direction = ParameterDirection.Input;
            purchaseidparam.Value = purchase.PurchaseId;
            cmd.Parameters.AddWithValue("@EmployeeId", employee);
            cmd.Parameters.AddWithValue("@PurchaseDate", purchase.Date);
            cmd.Parameters.AddWithValue("@CustomerId", purchase.Customer.PartyId);
            cmd.Parameters.AddWithValue("@Location", purchase.Location);
            cmd.Parameters.AddWithValue("@ItemsXml", purchase.ItemsXml);

            try
            {
                cmd.ExecuteNonQuery();
                return Int32.Parse(purchaseidparam.Value.ToString());
            }
            catch (Exception Ex)
            {
                throw new Exception("PurchaseSave: Failed to save Pawn", Ex);
            }
        }