private void btnOperation_Click(object sender, EventArgs e) { frmSelectOperation objSelectOperationForm; objSelectOperationForm = new frmSelectOperation(mobjItem.SelectedJob); objSelectOperationForm.ShowDialog(); if (objSelectOperationForm.FormStatus == FormStatus.Succeeded) { mobjItem.SelectedJob.SelectedOperation = objSelectOperationForm.SelectedOperation; SetOperationValues(); } }
private void btnShip_Click(object sender, EventArgs e) { frmSelectItemJobFromInventory objSelectItemJobFromInventoryForm; frmSelectItemJob objSelectItemJobForm; frmSelectOrder objSelectOrderForm; frmSelectOrderLine objSelectOrderReleaseForm; frmItemHistory objSelectItemHistoryForm; frmSelectOperation objSelectOperationForm; frmShipItem objShipItemForm; Item objItem; if (mobjItem == null) { MessageBox.Show("No item selected!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return; } else { objItem = new Item { ItemID = mobjItem.ItemID, IsSubItem = chkIsSubItem.Checked } }; //Case where Item IS MFG and item IS pulled from Inventory if (objItem.IsSubItem) { //use a select case statement to perform looping so that a user can walk up and down the decision tree; leverage an intcounter to do the walking and set it to negative to cancel out of //the decision tree. objSelectItemJobFromInventoryForm = new frmSelectItemJobFromInventory(objItem); objSelectItemJobFromInventoryForm.ShowDialog(); if (objSelectItemJobFromInventoryForm.FormStatus == FormStatus.Succeeded) { objItem.SelectedItemHistoryJob = objSelectItemJobFromInventoryForm.SelectedItemHistoryJob; objItem.SelectedJob = new Job { JobNumber = objItem.SelectedItemHistoryJob.JobNumber, JobOrderNumber = objItem.SelectedItemHistoryJob.JobOrderNumber }; objSelectOrderForm = new frmSelectOrder(objItem); objSelectOrderForm.ShowDialog(); if (objSelectOrderForm.FormStatus == FormStatus.Succeeded) { objItem.SelectedOrder = objSelectOrderForm.SelectedOrder; objItem.CustomerOrderNumber = objItem.SelectedOrder.CustomerOrderNumber; objSelectOrderReleaseForm = new frmSelectOrderLine(objItem); objSelectOrderReleaseForm.ShowDialog(); if (objSelectOrderReleaseForm.FormStatus == FormStatus.Succeeded) { objItem.SelectedOrderLine = objSelectOrderReleaseForm.SelectedOrderLine; objSelectItemHistoryForm = new frmItemHistory(objItem, true); objSelectItemHistoryForm.ShowDialog(); if (objSelectItemHistoryForm.FormStatus == FormStatus.Succeeded) { objItem.SelectedHistoryTransactions = objSelectItemHistoryForm.SelectedItemHistoryJobs; objSelectOperationForm = new frmSelectOperation(objItem.SelectedJob); objSelectOperationForm.ShowDialog(); if (objSelectOperationForm.FormStatus == FormStatus.Succeeded) { objItem.SelectedJob.SelectedOperation = objSelectOperationForm.SelectedOperation; objItem.IsPulledFromInventory = true; objShipItemForm = new frmShipItem(objItem); objShipItemForm.ShowDialog(); if (objShipItemForm.FormStatus == FormStatus.Succeeded) { MessageBox.Show("The Material Transaction completed Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } else if (objShipItemForm.FormStatus == FormStatus.Cancelled) { return; } else { MessageBox.Show(objShipItemForm.FormStatus.ToString() + " \r\nThe Material Transaction did NOT completed Successfully!", "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } } } } } } else { objSelectItemJobForm = new frmSelectItemJob(mobjItem); objSelectItemJobForm.ShowDialog(); if (objSelectItemJobForm.FormStatus == FormStatus.Succeeded) { objItem.SelectedJob = objSelectItemJobForm.SelectedJob; objSelectOrderForm = new frmSelectOrder(objItem); objSelectOrderForm.ShowDialog(); if (objSelectOrderForm.FormStatus == FormStatus.Succeeded) { objItem.SelectedOrder = objSelectOrderForm.SelectedOrder; objItem.CustomerOrderNumber = objItem.SelectedOrder.CustomerOrderNumber; objSelectOrderReleaseForm = new frmSelectOrderLine(objItem); objSelectOrderReleaseForm.ShowDialog(); if (objSelectOrderReleaseForm.FormStatus == FormStatus.Succeeded) { objItem.SelectedOrderLine = objSelectOrderReleaseForm.SelectedOrderLine; objSelectOperationForm = new frmSelectOperation(objItem.SelectedJob); objSelectOperationForm.ShowDialog(); if (objSelectOperationForm.FormStatus == FormStatus.Succeeded) { objItem.SelectedJob.SelectedOperation = objSelectOperationForm.SelectedOperation; objItem.IsPulledFromInventory = false; objShipItemForm = new frmShipItem(objItem); objShipItemForm.ShowDialog(); if (objShipItemForm.FormStatus == FormStatus.Succeeded) { MessageBox.Show("The Material Transaction completed Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } else if (objShipItemForm.FormStatus == FormStatus.Cancelled) { return; } else { MessageBox.Show(objShipItemForm.FormStatus.ToString() + " \r\nThe Material Transaction did NOT completed Successfully!", "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } } } } } }