예제 #1
0
        public override void Save()
        {
            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();
        }
예제 #2
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();
     }
 }