Exemple #1
0
        // GET api/storefloor
        //public IEnumerable<string> Get()
        //{
        //    return new string[] { "value1", "value2" };
        //}

        public IHttpActionResult Get([FromUri] string loginId = "", [FromUri] string type = "", [FromUri]  string cuCode = "")
        {
            dynamic result;

            if (type == "cu")
            {
                Member member = MembershipService.GetUserByUserName(loginId).MemberDetail;
                string pernr  = member.Empno;
                result = CUService.GetAllCU(loginId, pernr);
            }
            else
            {
                result = CUService.GetAllPC(cuCode);
            }

            return(Ok(result));
        }
Exemple #2
0
        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);
            }
        }