Esempio n. 1
0
        private void shpUpdate_Click(object sender, EventArgs e)
        {
            if (this.shpIdTxt.Text == "" || this.shpProTxt.Text == "" || this.comboBox2.Text == "")
            {
                MessageBox.Show("Insert the data");
            }
            else
            {
                ShipmentR i = new ShipmentR();

                i.ShipmentId       = Convert.ToInt32(this.shpIdTxt.Text);
                i.ShipmentProgress = Convert.ToInt32(this.shpProTxt.Text);
                i.Status           = this.comboBox2.GetItemText(this.comboBox2.SelectedItem);

                ShipmentRepository sr = new ShipmentRepository();
                if (sr.Update(i))
                {
                    List <ShipmentR> iList = sr.GetAllShipment();
                    this.dataGrid3.DataSource = iList;

                    this.shpIdTxt.Text  = "";
                    this.shpProTxt.Text = "";
                    this.comboBox2.Text = "";
                }
                else
                {
                    MessageBox.Show("Can Not Update Shipment", "Update Error");
                }
            }
        }
Esempio n. 2
0
        private void ShipOrderbtn_Click(object sender, EventArgs e)
        {
            ShipmentR i = new ShipmentR();

            i.OrderId          = this.orderIdTxt.Text;
            i.ShipmentProgress = 0;
            i.Status           = "";
            ShipmentRepository shipRepo = new ShipmentRepository();

            //insert into shipment table if the product is sufficient in inventory
            if (Convert.ToInt32(this.quantityTxt.Text) <= Convert.ToInt32(this.textBox7.Text))
            {
                if (shipRepo.Insert(i))
                {
                    //---------------update the volume in inventory after successful shipment-----------------//

                    int latestVolume       = Convert.ToInt32(this.textBox7.Text) - Convert.ToInt32(this.quantityTxt.Text);
                    InventoryRepository ir = new InventoryRepository();
                    if (ir.updateInventory(this.productIdTxt.Text, latestVolume))
                    {
                        MessageBox.Show("One Row Updated in Inventory");
                    }
                    else
                    {
                        MessageBox.Show("Can't update inventory", "Update Error");
                    }

                    //---------------Update and hide From Order Tabel after Shipment-----------------//
                    OrderRepository or = new OrderRepository();

                    if (or.updateStatus(this.orderIdTxt.Text))
                    {
                        MessageBox.Show("Order Updated");
                    }
                    else
                    {
                        MessageBox.Show("unSuccessfull order update", "Update Error");
                    }

                    MessageBox.Show("Succsfull ", "Shipment");

                    //---------------refresh the order Grid-----------------//

                    List <OrderR> order = new List <OrderR>();
                    order = or.GetAllOrder();
                    this.dataGrid2.DataSource = order;

                    this.orderIdTxt.Text      = "";
                    this.productIdTxt.Text    = "";
                    this.productNameTxt.Text  = "";
                    this.quantityTxt.Text     = "";
                    this.addressTxt.Text      = "";
                    this.employeeNameTxt.Text = "";
                }
                else
                {
                    MessageBox.Show("Can Not Ship Order", "Ship Error");
                }
            }
            else
            {
                MessageBox.Show("Unsufficient amount of Product", "Available Error");
            }
        }