Ejemplo n.º 1
0
        private void btnDone_Click(object sender, EventArgs e)
        {
            try
            {
                dbconnection.Open();

                RecordOfferQuantityInOfferStorage(Convert.ToInt16(txtOfferQuantity.Text), Convert.ToInt32(txtOffersID.Text));
                RecordOfferQuantityInStorage(Convert.ToDouble(txtOfferQuantity.Text), Convert.ToInt32(txtOffersID.Text));
                increaseItemsQuantityInDB(Convert.ToDouble(txtOfferQuantity.Text), Convert.ToInt32(txtOffersID.Text));

                MessageBox.Show("تم");

                dataGridView1.Rows.Clear();
                comStore.Text              = "";
                txtStoreID.Text            = "";
                txtOfferQuantity.Text      = "";
                txtTotalQuantityOffer.Text = "";
                txtOffersID.Text           = "";
                comOffers.Text             = "";
                offerStorage.DisplayOffer();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            dbconnection.Close();
        }
Ejemplo n.º 2
0
        private void btnDone_Click(object sender, EventArgs e)
        {
            try
            {
                dbconnection.Open();
                double q = OfferCollect(Convert.ToInt32(txtOffersID.Text));
                double quntityRequest = Convert.ToDouble(txtOfferQuantity.Text);
                if (quntityRequest <= q)
                {
                    RecordOfferQuantityInOferStorage(Convert.ToInt32(txtOffersID.Text), Convert.ToInt16(txtOfferQuantity.Text));
                    RecordOfferQuantityInStorage(Convert.ToDouble(txtOfferQuantity.Text), Convert.ToInt32(txtOffersID.Text));
                    decreaseItemsQuantityInDB(Convert.ToDouble(txtOfferQuantity.Text), Convert.ToInt32(txtOffersID.Text));

                    MessageBox.Show("تم");
                    // dataGridView1.Rows.Clear();
                    offerStorage.DisplayOffer();
                }
                else
                {
                    MessageBox.Show("الكمية المطلوبة غير متاحة");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            dbconnection.Close();
        }