Пример #1
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            var dialog = MessageBox.Show("Do you really want to cancel this order and begin a new one?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (dialog == DialogResult.OK)
            {
                Purshase.CancelSaleOrder(this.id_purshase);
                InitializeSale();
            }
        }
Пример #2
0
 public override void Cancel()
 {
     try
     {
         var dialog = MessageBox.Show("Do you really want to cancel the order?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (dialog == DialogResult.OK)
         {
             Purshase.CancelSaleOrder(this.id_purshase);
             MessageBox.Show("Order Cancelled!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             this.Close();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("There was a problem cancelling de order", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #3
0
 public override void Save()
 {
     if (ckbCancelOrder.Checked)
     {
         try
         {
             Purshase.CancelSaleOrder(txtIdPurshase.Text);
             MessageBox.Show("The order has been cancel.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
             var dialog = MessageBox.Show("Do you want to process a new order?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
             if (dialog == DialogResult.OK)
             {
                 Initialize();
             }
             else
             {
                 this.Close();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         string        id_product    = dgvProducts.Rows[dgvProducts.SelectedCells[0].RowIndex].Cells[0].Value.ToString();
         string        name          = dgvProducts.Rows[dgvProducts.SelectedCells[0].RowIndex].Cells[1].Value.ToString();
         string        mark          = dgvProducts.Rows[dgvProducts.SelectedCells[0].RowIndex].Cells[2].Value.ToString();
         double        price         = double.Parse(dgvProducts.Rows[dgvProducts.SelectedCells[0].RowIndex].Cells[3].Value.ToString());
         int           quantity      = int.Parse(dgvProducts.Rows[dgvProducts.SelectedCells[0].RowIndex].Cells[4].Value.ToString());
         double        amount        = double.Parse(dgvProducts.Rows[dgvProducts.SelectedCells[0].RowIndex].Cells[5].Value.ToString());
         double        total_amount  = double.Parse(txtCurrentAmount.Text);
         var           product       = new Purshase_Product(id_product, name, mark, price, quantity, amount, total_amount);
         ReturnDetails returnDetails = new ReturnDetails(txtIdPurshase.Text, product);
         returnDetails.updateQuantity = new ReturnDetails.UpdateQuantity(UpdateQuantityEventHandler);
         returnDetails.ShowDialog();
     }
 }