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"); } } }
private void shpDelete_Click(object sender, EventArgs e) { if (this.shpIdTxt.Text == "" || this.shpProTxt.Text == "" || this.comboBox2.Text == "") { MessageBox.Show("Insert the data"); } else { int shipId = Convert.ToInt32(this.shpIdTxt.Text); ShipmentRepository sr = new ShipmentRepository(); if (sr.Delete(shipId)) { List <ShipmentR> iList = sr.GetAllShipment(); this.dataGrid3.DataSource = iList; this.shpIdTxt.Text = ""; this.shpProTxt.Text = ""; this.comboBox2.Text = ""; } else { MessageBox.Show("Can Not Delete Shipment", "Delete Error"); } } }
private void shipmentTab_Click(object sender, EventArgs e) { this.dataGrid2.Visible = false; this.dataGrid3.Visible = true; this.dataGrid4.Visible = false; this.groupBox1.Visible = false; this.groupBox2.Visible = true; this.groupBox3.Visible = false; this.groupBox4.Visible = false; this.groupBox5.Visible = false; ShipmentRepository shipment = new ShipmentRepository(); List <ShipmentR> allShipment = shipment.GetAllShipment(); this.dataGrid3.DataSource = allShipment; }