示例#1
0
        public bool Initialize(EXCEPTION exc, string prepCode, string strACT)
        {
            SetVariables(exc, prepCode, "CHANGEACT");
            var AskVal = "EMPTY";

            //Used thisform.r_act before
            if (!String.IsNullOrWhiteSpace(exception.ACT))
            {
                AskVal = exception.ACT;
            }

            //Update Exceptions Table.
            var fieldsToUpdate = new List <string>
            {
                "ACT"
            };

            exception.ACT = strACT;

            UpdateException(exception, fieldsToUpdate);

            //Update the related Pegasys frm table and transhist

            if (exception.ERR_CODE == "P200")
            {
                TransHistManager transHistManager = new TransHistManager();
                transHistManager.UpdateActByInvKeyId(exception.INV_KEY_ID, strACT);

                var rtnInv = GetPegasysInvoiceByKey(exception.INV_KEY_ID);

                if (rtnInv != null)
                {
                    fieldsToUpdate = new List <string>
                    {
                        "ACT"
                    };

                    rtnInv.ACT = strACT;

                    UpdatePegasysInvoice(rtnInv, fieldsToUpdate);
                }
            }
            else if (exception.ERR_CODE == "A200")
            {
                TransHistManager transHistManager = new TransHistManager();
                transHistManager.UpdateActByRRId(exception.RR_ID, strACT);

                var rtnRR = GetPegasysRRByKey(exception.RR_ID);

                if (rtnRR != null)
                {
                    fieldsToUpdate = new List <string>
                    {
                        "ACT"
                    };

                    rtnRR.ACT = strACT;

                    UpdatePegasysRR(rtnRR, fieldsToUpdate);
                }
            }
            else if (exception.ERR_CODE == "M200")
            {
                TransHistManager transHistManager = new TransHistManager();
                transHistManager.UpdateActByAeId(exception.AE_ID, strACT);

                var rtnAE = GetPegasysAEByKey(exception.AE_ID);

                if (rtnAE != null)
                {
                    fieldsToUpdate = new List <string>
                    {
                        "ACT"
                    };

                    rtnAE.ACT = strACT;

                    UpdatePegasysAE(rtnAE, fieldsToUpdate);
                }
            }

            //Insert a Transhist Record recording the change to Act number
            //Used thisform.r_act before
            var strCuffMemo = string.Format("ACT Number Changed from {0} to {1}.", exception.ACT, strACT);

            InsertTranshist(exception, "", strCuffMemo, "", prepCode);

            //Does not close out of the screen and enables the button
            //By returning true it should enable the button on the screen
            return(true);
            //THISFORM.cmdPoRequest1.ENABLED = true;
        }