private void chkShowPreferredCU_CheckedChanged(object sender, EventArgs e) { try { string filter = string.Empty; if (chkShowPreferredCU.Checked == true) { IGTApplication oApp = GTClassFactory.Create <IGTApplication>(); CuCommonForms obj = new CuCommonForms(oApp); ADODB.Recordset rs = obj.GetPreferredCU(cmbAncillaryCategories.SelectedValue.ToString()); m_PreferredCUFilter = obj.GetPreferredCuFilterString(rs); if (string.IsNullOrEmpty(m_PreferredCUFilter)) { m_PreferredCUFilter = "'***NOTDefined***'"; } HandleCUDataFilters(); } else { m_PreferredCUFilter = null; HandleCUDataFilters(); } } catch (Exception ex) { throw ex; } }
private void button2_Click(object sender, EventArgs e) { IGTApplication oApp = GTClassFactory.Create <IGTApplication>(); CuCommonForms obj = new CuCommonForms(oApp); obj.MakePreferredCU(Convert.ToString(grdCU.SelectedRows[0].Cells[2].Value), Convert.ToString(grdCU.SelectedRows[0].Cells[0].Value), oApp.DataContext.DatabaseUserName); }
private void SetPreferredFilter() { IGTApplication oApp = GTClassFactory.Create <IGTApplication>(); CuCommonForms obj = new CuCommonForms(oApp); ADODB.Recordset rs = obj.GetPreferredCU(grdFilter.Rows[0].Cells[0].Value.ToString()); m_PreferredCUFilter = obj.GetPreferredCuFilterString(rs); }
private void btnMoreInfo_Click(object sender, EventArgs e) { try { IGTApplication oApp = GTClassFactory.Create <IGTApplication>(); CuCommonForms obj = new CuCommonForms(oApp); obj.ShowMoreInfoForm(Convert.ToString(grdCU.SelectedRows[0].Cells["CU"].Value), false, ((Convert.ToString(grdCU.SelectedRows[0].Cells["M/C"].Value) == "CU" || (Convert.ToString(grdCU.SelectedRows[0].Cells["M/C"].Value) == "ACU")) ? true : false)); } catch (Exception ex) { throw ex; } }
private void btnMoreInfo(object sender, EventArgs e) { try { IGTApplication oApp = GTClassFactory.Create <IGTApplication>(); CuCommonForms obj = new CuCommonForms(oApp); obj.ShowMoreInfoForm(Convert.ToString(m_selectedCUDataRecord["CU"]), true, (Convert.ToString(m_selectedCUDataRecord["M/C"]) == "CU" ? true : false)); } catch (Exception ex) { throw ex; } }
private void btnMakePreferred_Click(object sender, EventArgs e) { try { IGTApplication oApp = GTClassFactory.Create <IGTApplication>(); CuCommonForms obj = new CuCommonForms(oApp); obj.MakePreferredCU(Convert.ToString(grdCU.SelectedRows[0].Cells[1].Value), Convert.ToString(cmbAncillaryCategories.SelectedValue), oApp.DataContext.DatabaseUserName); } catch (Exception ex) { throw ex; } }
public bool Execute(object InputValue) { Int16 nCompNO = 0; string sFilterFieldName = ""; string sCUKeyfield = ""; string sCUKeyValue = ""; Boolean flagCUModified = false; Boolean flagPrimaryCU = true; string sExistingCU = string.Empty; string sExistingActivity = string.Empty; string sUnitCNO = string.Empty; string sUnitCID = string.Empty; string sCNoFieldName = string.Empty; bool bSignificantRecordFound = false; // Implement this method. // This method will call CUService to set the CU values try { m_oCUService = new CUService(m_iANO, m_bSignificantAncillary); m_oCUService.DataContext = m_oDataContext; m_oCUService.KeyObject = m_oFeature; if (m_sCUTypeConfigured == "PRIMARY") { flagPrimaryCU = true; m_sCUType = "CU"; m_sCUano = Convert.ToString(m_oCUService.CompUnitANO); m_CUCno = (short)m_oCUService.CUComponentCNO; if (!m_bSignificantAncillary) { m_componentName = "COMP_UNIT_N"; } } if (m_sCUTypeConfigured == "ANCILLARY") { flagPrimaryCU = false; m_sCUType = "ACU"; m_sCUano = Convert.ToString(m_oCUService.AncCompUnitANO); m_CUCno = (short)m_oCUService.AncillaryCUComponentCNO; m_componentName = "COMP_UNIT_ANCIL_N"; } sCNoFieldName = m_oCUService.CUField; sCUKeyfield = "CU_TYPE"; sCUKeyValue = m_sCUType; if (m_bReadOnly) { if (m_oFeature.CID <= 0) { MessageBox.Show("Nothing to review at this time.", "GTechnology", MessageBoxButtons.OK); } else { //Show More Info Form here CuCommonForms CuComomonForm = new CuCommonForms(m_oApp); CuComomonForm.ShowMoreInfoForm(Convert.ToString(m_oFeature.Components.GetComponent(m_CUCno).Recordset.Fields[sCNoFieldName].Value), true, true); } return(ProcessCUUpdate(flagCUModified, ref nCompNO, ref sFilterFieldName));; } ValidationConditions oValidateCUConditions = new ValidationConditions(m_oFeature, m_oDataContext, m_sCategoryFilter, m_sCUTypeConfigured, m_sIsAggregateFeature, m_componentName); CUAction CuActionSelected = CUAction.Selection; if (m_bSignificantAncillary) { bSignificantRecordFound = MoveSignificantAncillaryRecordset(); } CuActionSelected = oValidateCUConditions.GetCUAction(m_oFeature.Components.GetComponent(m_CUCno).Recordset.RecordCount > 0 ? Convert.ToString(m_oFeature.Components.GetComponent(m_CUCno).Recordset.Fields[sCNoFieldName].Value) : ""); //Identify the CU Action based on the conditions if (m_oFeature.Components.GetComponent(m_CUCno).Recordset.RecordCount > 0) { sExistingCU = Convert.ToString(m_oFeature.Components.GetComponent(m_CUCno).Recordset.Fields[sCNoFieldName].Value); } RemovalActivity removalActivitySelectedOnChageOutForm = RemovalActivity.NoValue; InstallActivity installActivitySelectedOnChageOutForm = InstallActivity.Novalue; if (CuActionSelected.Equals(CUAction.NoActionWRMismatches)) { m_oApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Cannot alter a CU installed by a different WR"); // MessageBox.Show("Cannot alter a CU installed by a different WR", "GTechnology", MessageBoxButtons.OK); return(true); } else if (CuActionSelected.Equals(CUAction.NoAction)) { m_oApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Cannot edit this CU code."); //MessageBox.Show("Cannot edit this CU code.", "GTechnology", MessageBoxButtons.OK); return(true); } if (!oValidateCUConditions.ValidateCUSelection(CuActionSelected, m_bSignificantAncillary, bSignificantRecordFound)) { return(true); //Validation conditions do not match and therefore return from here } if (CuActionSelected.Equals(CUAction.Changeout)) //This is a changeout operation { //ALM-1592-- Added a method to disable the "Replace with same CU" option if the CU is not found bool bReplacewithSameCU = ReplacewithSameCU(sExistingCU, m_sCategoryFilter); CuCommonForms CuComomonForm = new CuCommonForms(m_oApp, bReplacewithSameCU); CuComomonForm.ShowChangeOutForm(); removalActivitySelectedOnChageOutForm = CuComomonForm.RemovalActivitySelected; installActivitySelectedOnChageOutForm = CuComomonForm.InstallActivitySelected; if (CuComomonForm.CancelClicked) { return(true); //Cancel is clicked on Changeout Form so No Action required } if (installActivitySelectedOnChageOutForm == InstallActivity.DoNotInstall) { //Handle the setting of Removal Activity and return as there is no new installation needed m_oFeature.Components.GetComponent(m_CUCno).Recordset.Fields["ACTIVITY_C"].Value = (removalActivitySelectedOnChageOutForm == RemovalActivity.Remove ? "R" : "S"); m_oFeature.Components.GetComponent(m_CUCno).Recordset.Fields["WR_EDITED"].Value = m_oApp.DataContext.ActiveJob; return(ProcessCUUpdate(flagCUModified, ref nCompNO, ref sFilterFieldName)); } if (installActivitySelectedOnChageOutForm == InstallActivity.Replace || installActivitySelectedOnChageOutForm == InstallActivity.Select) { sExistingCU = Convert.ToString(m_oFeature.Components.GetComponent(m_CUCno).Recordset.Fields[sCNoFieldName].Value); sUnitCID = Convert.ToString(m_oFeature.Components.GetComponent(m_CUCno).Recordset.Fields["UNIT_CID"].Value); sUnitCNO = Convert.ToString(m_oFeature.Components.GetComponent(m_CUCno).Recordset.Fields["UNIT_CNO"].Value); m_oFeature.Components.GetComponent(m_CUCno).Recordset.Fields["WR_EDITED"].Value = m_oApp.DataContext.ActiveJob; sExistingActivity = Convert.ToString(m_oFeature.Components.GetComponent(m_CUCno).Recordset.Fields["ACTIVITY_C"].Value); m_oFeature.Components.GetComponent(m_CUCno).Recordset.Fields["ACTIVITY_C"].Value = (removalActivitySelectedOnChageOutForm == RemovalActivity.Remove ? "R" : "S"); } } if (m_oFeature.CID <= 0) //This is a clear case of Selection, Proceed as usual { if (DialogResult.OK == m_oCUService.Selection(flagPrimaryCU, sCUKeyfield, sCUKeyValue, m_sCategoryFilter)) { flagCUModified = true; } } else { if (DialogResult.OK == m_oCUService.Selection(flagPrimaryCU, m_oFeature.CID, sCUKeyfield, sCUKeyValue, m_sCategoryFilter, removalActivitySelectedOnChageOutForm, installActivitySelectedOnChageOutForm, sExistingCU, sExistingActivity, sUnitCID, sUnitCNO)) { flagCUModified = true; } } return(ProcessCUUpdate(flagCUModified, ref nCompNO, ref sFilterFieldName)); } catch (Exception ex) { MessageBox.Show("Error occured in CU Selection Foreign Query " + ex.Message, "G/Technology"); return(false); } }