コード例 #1
0
ファイル: ShipmentItem.cs プロジェクト: amr3afifi/BikersCode
        private void button3_Click(object sender, EventArgs e)
        {
            if (numericUpDown1.Value > 0 && !string.IsNullOrWhiteSpace(comboBox1.Text) && !string.IsNullOrWhiteSpace(comboBox2.Text))
            {
                int result = controllerObj.AddItemToShipment(id, Convert.ToInt32(comboBox2.Text), Convert.ToInt32(numericUpDown1.Value));
                if (result <= 0)
                {
                    MessageBox.Show("Item additon failed,Item may already exist");
                }

                else
                {
                    MessageBox.Show("Item added to order");
                    double Price = Convert.ToDouble(controllerObj.GetProductPrice(comboBox2.Text));
                    Price *= Convert.ToInt32(numericUpDown1.Value);
                    controllerObj.UpdateShipmentPrice(Price.ToString(), id.ToString());
                }
            }
            else
            {
                MessageBox.Show("Enter Correct values for quantity");
                return;
            }
        }