private bool DeleteShipmentEntry() { //sol_ShipmentAdjustment = sol_Shipment_Sp.SelectByRBillNumber(textBoxRBill.Text); sol_StageList = sol_Stage_Sp._SelectAllByShipmentID(sol_ShipmentAdjustment.ShipmentID); //I-InProgress; P-Picked S-Shipped if (sol_StageList != null && sol_StageList.Count() > 0 ) { return(true); } sol_Shipment_Sp.Delete(sol_ShipmentAdjustment.ShipmentID); //bool flagDelete = true; //foreach (Sol_Stage st in sol_StageList) //{ // if (st.Status != "V") // { // flagDelete = false; // break; // } //} //if(flagDelete) // sol_Shipment_Sp.UpdateStatus(sol_ShipmentAdjustment.ShipmentID, "D"); return(true); }
private void buttonVoidShipment_Click(object sender, EventArgs e) { if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolModifyContainer", true)) { return; } ListView.SelectedListViewItemCollection selectedItems = listViewCurrentShipment.SelectedItems; if (selectedItems.Count < 1) { MessageBox.Show("Please select a Shipment"); return; } bool firstTime = true; //int stageId = 0; string shipNumber = ""; //selected items foreach (ListViewItem item in selectedItems) { try { //stageId = Int32.Parse(item.SubItems[0].Text); shipNumber = item.SubItems[0].Text; } catch { continue; } if (firstTime) { firstTime = false; if (MessageBox.Show("Are you sure you want to delete shipment:" + item.SubItems[0].Text + "?", "Delete Shipment", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != System.Windows.Forms.DialogResult.Yes) { return; } } sol_Shipment = sol_Shipment_Sp.SelectByRBillNumber(shipNumber); sol_StageList = sol_Stage_Sp._SelectAllByShipmentID(sol_Shipment.ShipmentID); //I-InProgress; P-Picked S-Shipped if (sol_StageList.Count > 0) { MessageBox.Show("Shipment is not empty, cannot void it!"); return; } //delete it sol_Shipment_Sp.Delete(sol_Shipment.ShipmentID); } //refresh list or remove item above??? ReadCurrentShipments(); }