Exemplo n.º 1
0
        public EpiResponse SOUpdate(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, SOHd objSOHd)
        {
            EndpointBindingType bindingType = EndpointBindingType.BasicHttp;
            EpiResponse         objEpiRes   = new EpiResponse()
            {
                Company       = objSOHd.Company
                , COTOrderNum = objSOHd.COTOrderNum
                , CustId      = objSOHd.CustId
            };

            try
            {
                builder.Path = $"{Config.environment}/Erp/BO/SalesOrder.svc";
                svcSalesOrder.SalesOrderSvcContractClient SOClient = GetClient <svcSalesOrder.SalesOrderSvcContractClient, svcSalesOrder.SalesOrderSvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                SOClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));


                var ds = new svcSalesOrder.SalesOrderTableset();
                if (objSOHd.EpiOrderNum > 0)
                {
                    ds = SOClient.GetByID(objSOHd.EpiOrderNum);

                    ds.OrderDtl.ForEach(f => f.RowMod = "D");

                    SOClient.Update(ref ds);
                }
                else
                {
                    SOClient.GetNewOrderHed(ref ds);
                    bool IContinue;
                    SOClient.OnChangeofSoldToCreditCheck(0, objSOHd.CustId, ref ds, out IContinue);
                    SOClient.ChangeSoldToID(ref ds);
                    SOClient.ChangeCustomer(ref ds);

                    int custNum = ds.OrderHed[0].CustNum;
                    if (!string.IsNullOrEmpty(objSOHd.ShipToNum))
                    {
                        ds.OrderHed[0].ShipToNum = objSOHd.ShipToNum;
                        SOClient.ChangeShipToID(ref ds);
                    }
                    ds.OrderHed[0].OrderDate      = objSOHd.OrderDate;
                    ds.OrderHed[0].NeedByDate     = objSOHd.ReqShipDate;
                    ds.OrderHed[0].OrderComment   = objSOHd.OrderComments == null ? "" : objSOHd.OrderComments;
                    ds.OrderHed[0].ShipComment    = objSOHd.OrderComments == null ? "" : objSOHd.OrderComments;
                    ds.OrderHed[0].InvoiceComment = objSOHd.OrderComments == null ? "" : objSOHd.OrderComments;
                    ds.OrderHed[0].PONum          = objSOHd.PONum == "P" ? "P" : "";
                    ds.OrderHed[0].OrderHeld      = true;

                    ds.OrderHed[0].UserDefinedColumns["WEMOrdNum_c"] = objSOHd.COTOrderNum;
                    ds.OrderHed[0].UserDefinedColumns["IntenalInstructionRemarks_c"] = objSOHd.InternalRemarks == null ? "" : objSOHd.InternalRemarks;
                    ds.OrderHed[0].UserDefinedColumns["InvRemarks_c"]       = objSOHd.OrderComments == null ? "" : objSOHd.OrderComments;
                    ds.OrderHed[0].UserDefinedColumns["PromotionRemarks_c"] = objSOHd.PromotionRemarks == null ? "" : objSOHd.PromotionRemarks;
                    ds.OrderHed[0].UserDefinedColumns["ManualSONum_c"]      = objSOHd.ManualSO;
                    ds.OrderHed[0].UserDefinedColumns["Promotion_c"]        = objSOHd.Promotion;

                    ds.OrderHed[0].UserDefinedColumns["CheckBox02"] = objSOHd.BulkOrder; // BulkOrder

                    ds.OrderHed[0].UserDefinedColumns["ShortChar10"] = objSOHd.COTOrderNum.ToString();
                    ds.OrderHed[0].UserDefinedColumns["Character01"] = objSOHd.InternalRemarks == null ? "" : objSOHd.InternalRemarks;

                    SOClient.Update(ref ds);
                }

                int iOrderNum = ds.OrderHed[0].OrderNum;
                objEpiRes.EpiOrderNum = iOrderNum;
                string PartNum = ""; decimal Qty = 0; string UOM = ""; decimal UnitPrice = 0;
                int    totLnRows = objSOHd.SODtl.Count();
                int    currLnRow = 0;
                foreach (var rowSODtl in objSOHd.SODtl)
                {
                    int loopCnt = 1;
                    int rowFOC  = 0;
                    if (rowSODtl.OrderQty > 0 && rowSODtl.FOCQty > 0)
                    {
                        loopCnt = 2;
                    }

                    if (loopCnt == 2)
                    {
                        totLnRows++;
                    }
                    while (rowFOC < loopCnt)
                    {
                        SOClient.GetNewOrderDtl(ref ds, iOrderNum);
                        int currentIndex = ds.OrderDtl.Count - 1;
                        currLnRow++;
                        //Not require as per Chuah's mail
                        if (currLnRow == totLnRows)
                        {
                            ds.OrderDtl[currentIndex].OrderComment = objSOHd.OrderComments == null ? "" : objSOHd.OrderComments;
                        }
                        bool   Sub1                 = false;
                        bool   Phantom              = false;
                        string UOMCode              = string.Empty;
                        string rowType              = string.Empty;
                        bool   KitType              = false;
                        Guid   guid                 = new Guid("00000000-0000-0000-0000-000000000000");
                        bool   removekitcomponent   = false;
                        bool   suppressprompt       = false;
                        bool   getPartXInfo         = true;
                        bool   checkPartRev         = true;
                        bool   checkChangeKitParent = true;
                        string questionstring       = string.Empty;
                        string warningmsg           = string.Empty;
                        bool   multiplematch        = false;
                        bool   promttoexplode       = false;
                        string configpartmessage    = string.Empty;
                        string subPartMessage       = string.Empty;
                        string explodeBOMErrMsg     = string.Empty;
                        string msgType              = string.Empty;
                        bool   multiSubAvail        = false;
                        bool   runQtyAvail          = false;
                        PartNum = rowSODtl.PartNum;

                        SOClient.ChangePartNumMaster(ref PartNum, ref Sub1, ref Phantom, ref UOMCode,
                                                     guid, rowType, KitType, removekitcomponent, suppressprompt, getPartXInfo, checkPartRev,
                                                     checkChangeKitParent, ref ds, out questionstring, out warningmsg,
                                                     out multiplematch, out promttoexplode, out configpartmessage, out subPartMessage,
                                                     out explodeBOMErrMsg, out msgType, out multiSubAvail, out runQtyAvail);

                        if (string.IsNullOrEmpty(rowSODtl.UOM))
                        {
                            UOM = ds.OrderDtl[currentIndex].SalesUM;
                        }
                        else
                        {
                            UOM = rowSODtl.UOM;
                        }

                        int    pdDimConvFac        = 1;
                        string pcNegQtyAction      = string.Empty;
                        string opWarningMsg        = string.Empty;
                        string sellingQtyChangeMsg = string.Empty;
                        bool   IsFOCItem           = false;
                        if (loopCnt == 2)
                        {
                            if (rowFOC == 0)
                            {
                                Qty = rowSODtl.OrderQty;
                            }
                            else
                            {
                                Qty       = rowSODtl.FOCQty;
                                IsFOCItem = true;
                            }
                        }
                        else
                        {
                            if (rowSODtl.OrderQty > 0)
                            {
                                Qty = rowSODtl.OrderQty;
                            }
                            else if (rowSODtl.FOCQty > 0)
                            {
                                Qty       = rowSODtl.FOCQty;
                                IsFOCItem = true;
                            }
                            else
                            {
                                //Something not right
                            }
                        }



                        SOClient.ChangeSellingQtyMaster(ref ds, Qty, false, false, true, true, false,
                                                        true, PartNum, "", "", "", UOM, pdDimConvFac, out pcNegQtyAction, out opWarningMsg,
                                                        out sellingQtyChangeMsg);

                        if (rowSODtl.SellingPrice > 0)
                        {
                            //ds.OrderDtl[currentIndex].UnitPrice = rowSODtl.SellingPrice;
                            //ds.OrderDtl[currentIndex].DocUnitPrice = rowSODtl.SellingPrice;
                            //ds.OrderDtl[currentIndex].DspUnitPrice = rowSODtl.SellingPrice;
                            //ds.OrderDtl[currentIndex].DocDspUnitPrice = rowSODtl.SellingPrice;
                            //SOClient.ChangeUnitPrice(ref ds);
                        }

                        //ds.OrderDtl[currentIndex].LockQty = true;
                        if (objSOHd.BulkOrder)
                        {
                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number14"] = Qty;
                        }
                        else
                        {
                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number01"] = Qty;
                        }



                        //saras
                        if (!IsFOCItem)
                        {
                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number03"] = rowSODtl.SellingPrice;

                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number04"] = rowSODtl.ProposedSellingPrice > 0 ? rowSODtl.ProposedSellingPrice : rowSODtl.SellingPrice; // PropposeSellingPrice

                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number13"] = rowSODtl.BasePrice;
                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number05"] = rowSODtl.ProposedBasePrice > 0 ? rowSODtl.ProposedBasePrice : rowSODtl.BasePrice; // ProposeBasePrice
                        }
                        else
                        {
                            //if (IsFOCItem)
                            //{
                            // //ds.OrderDtl[currentIndex].UserDefinedColumns["UnitPrice"] = 0.0000m.ToString();
                            // ds.OrderDtl[currentIndex].UserDefinedColumns["UnitPrice"] = decimal.Zero;
                            // ds.OrderDtl[currentIndex].UserDefinedColumns["Number03"] = decimal.Zero;
                            // }
                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number03"] = rowSODtl.SellingPrice;

                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number04"] = decimal.Zero;;  // PropposeSellingPrice

                            //ds.OrderDtl[currentIndex].UserDefinedColumns["UnitPrice"] = decimal.Zero;  // UnitPrice

                            //ds.OrderDtl[currentIndex].UserDefinedColumns["Number13"] = 0;
                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number05"] = decimal.Zero; // ProposeBasePrice

                            ds.OrderDtl[currentIndex].UnitPrice       = decimal.Zero;
                            ds.OrderDtl[currentIndex].DocUnitPrice    = decimal.Zero;
                            ds.OrderDtl[currentIndex].DspUnitPrice    = decimal.Zero;
                            ds.OrderDtl[currentIndex].DocDspUnitPrice = decimal.Zero;
                            SOClient.ChangeUnitPrice(ref ds);
                        }

                        string cRepMsg                 = string.Empty;
                        string cRespMsgOrdRel          = string.Empty;
                        bool   lCheckForOrderChangedMs = false;
                        bool   lcheckForResponse       = false;
                        string cTableName              = "OrderDtl";
                        int    iCustNum                = ds.OrderHed[0].CustNum;
                        bool   lweLicensed             = false;
                        string cResponseMsg            = "";
                        string cCreditShipAction       = "";
                        string cDisplayMsg             = "";
                        string cCompliantMsg           = "";
                        string cResponseMsgOrdRel      = "";


                        SOClient.MasterUpdate(lCheckForOrderChangedMs, lcheckForResponse, cTableName, iCustNum, iOrderNum, lweLicensed, ref ds, out cResponseMsg, out cCreditShipAction, out cDisplayMsg, out cCompliantMsg, out cResponseMsgOrdRel);


                        int iOrderLine = ds.OrderDtl.Max(m => m.OrderLine);

                        if (!IsFOCItem)
                        {
                            int relRowCnt = 0;
                            foreach (var rowSORel in rowSODtl.SORel.Where(w => w.OrderRelQty > 0))
                            {
                                if (relRowCnt > 0)
                                {
                                    SOClient.GetNewOrderRel(ref ds, iOrderNum, iOrderLine);
                                    int relIndex = ds.OrderRel.Count - 1;
                                    if (ds.OrderRel[relIndex].SellingReqQty != rowSORel.OrderRelQty)
                                    {
                                        ds.OrderRel[relIndex].SellingReqQty = rowSORel.OrderRelQty;
                                        ds.OrderRel[relIndex].OurReqQty     = rowSORel.OrderRelQty;
                                        //_svcSalesOrder.ChangeSellingReqQty(ref dsSalesOrder, rowSORel.RelQty);
                                    }

                                    if (ds.OrderRel[relIndex].ShipToNum != rowSORel.ShipToNum)
                                    {
                                        ds.OrderRel[relIndex].ShipToNum = rowSORel.ShipToNum;
                                    }
                                    if (ds.OrderRel[relIndex].NeedByDate != rowSORel.ShipByDate)
                                    {
                                        ds.OrderRel[relIndex].NeedByDate = rowSORel.ShipByDate;
                                    }
                                    SOClient.ChangeOrderRelShipTo(ref ds);
                                }
                                else
                                {
                                    int relIndex = ds.OrderRel.Count - 1;
                                    if (ds.OrderRel[relIndex].SellingReqQty != rowSORel.OrderRelQty)
                                    {
                                        ds.OrderRel[relIndex].SellingReqQty = rowSORel.OrderRelQty;
                                        ds.OrderRel[relIndex].OurReqQty     = rowSORel.OrderRelQty;
                                        //_svcSalesOrder.ChangeSellingReqQty(ref dsSalesOrder, rowSORel.RelQty);
                                    }
                                    if (ds.OrderRel[relIndex].ShipToNum != rowSORel.ShipToNum)
                                    {
                                        ds.OrderRel[relIndex].ShipToNum = rowSORel.ShipToNum;
                                    }
                                    if (ds.OrderRel[relIndex].NeedByDate != rowSORel.ShipByDate)
                                    {
                                        ds.OrderRel[relIndex].NeedByDate = rowSORel.ShipByDate;
                                    }
                                    ds.OrderRel[relIndex].RowMod = "U";
                                    SOClient.ChangeOrderRelShipTo(ref ds);
                                }

                                SOClient.Update(ref ds);


                                relRowCnt++;
                            }
                        }
                        else
                        {
                            int relRowCnt = 0;
                            foreach (var rowSORel in rowSODtl.SORel.Where(w => w.FOCRelQty > 0))
                            {
                                if (relRowCnt > 0)
                                {
                                    SOClient.GetNewOrderRel(ref ds, iOrderNum, iOrderLine);
                                    int relIndex = ds.OrderRel.Count - 1;
                                    if (ds.OrderRel[relIndex].SellingReqQty != rowSORel.FOCRelQty)
                                    {
                                        ds.OrderRel[relIndex].SellingReqQty = rowSORel.FOCRelQty;
                                        ds.OrderRel[relIndex].OurReqQty     = rowSORel.FOCRelQty;
                                        //_svcSalesOrder.ChangeSellingReqQty(ref dsSalesOrder, rowSORel.RelQty);
                                    }

                                    if (ds.OrderRel[relIndex].ShipToNum != rowSORel.ShipToNum)
                                    {
                                        ds.OrderRel[relIndex].ShipToNum = rowSORel.ShipToNum;
                                    }
                                    if (ds.OrderRel[relIndex].NeedByDate != rowSORel.ShipByDate)
                                    {
                                        ds.OrderRel[relIndex].NeedByDate = rowSORel.ShipByDate;
                                    }
                                    SOClient.ChangeOrderRelShipTo(ref ds);
                                }
                                else
                                {
                                    int relIndex = ds.OrderRel.Count - 1;
                                    if (ds.OrderRel[relIndex].SellingReqQty != rowSORel.FOCRelQty)
                                    {
                                        ds.OrderRel[relIndex].SellingReqQty = rowSORel.FOCRelQty;
                                        ds.OrderRel[relIndex].OurReqQty     = rowSORel.FOCRelQty;
                                        //_svcSalesOrder.ChangeSellingReqQty(ref dsSalesOrder, rowSORel.RelQty);
                                    }
                                    if (ds.OrderRel[relIndex].ShipToNum != rowSORel.ShipToNum)
                                    {
                                        ds.OrderRel[relIndex].ShipToNum = rowSORel.ShipToNum;
                                    }
                                    if (ds.OrderRel[relIndex].NeedByDate != rowSORel.ShipByDate)
                                    {
                                        ds.OrderRel[relIndex].NeedByDate = rowSORel.ShipByDate;
                                    }
                                    ds.OrderRel[relIndex].RowMod = "U";
                                    SOClient.ChangeOrderRelShipTo(ref ds);
                                }

                                SOClient.Update(ref ds);

                                relRowCnt++;
                            }
                        }

                        rowFOC++;
                    }
                }

                //ds.OrderHed[0].UserDefinedColumns["CheckBox01"] = true;//Approved
                ds.OrderHed[0].UserDefinedColumns["CheckBox04"] = true; //Submit Order
                ds.OrderHed[0].RowMod = "U";                            //Submit Order
                SOClient.Update(ref ds);
            }
            catch (Exception ex)
            {
                objEpiRes.ErrMsg = ex.Message.ToString();
            }

            return(objEpiRes);
        }
Exemplo n.º 2
0
        public EpiResponse Process(SOHd objSOHd)
        {
            EndpointBindingType bindingType = EndpointBindingType.BasicHttp;
            string epicorUserID             = Config.epicorUserID;      //"manager";
            string epiorUserPassword        = Config.epiorUserPassword; //"finlucky08";
            Guid   sessionId = Guid.Empty;

            svcSession.SessionModSvcContractClient sessionModClient = null;

            string scheme = "https";

            if (bindingType == EndpointBindingType.SOAPHttp)
            {
                scheme = "http";
            }
            UriBuilder builder = new UriBuilder(scheme, Config.hostName);

            builder.Path = $"{Config.environment}/Ice/Lib/SessionMod.svc";

            EpiResponse objEpiRes = null;

            try
            {
                sessionModClient = GetClient <svcSession.SessionModSvcContractClient, svcSession.SessionModSvcContract>
                                   (
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType
                                   );



                sessionId = sessionModClient.Login();

                builder.Path     = $"{Config.environment}/Ice/Lib/SessionMod.svc";
                sessionModClient = GetClient <svcSession.SessionModSvcContractClient, svcSession.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType);

                sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));



                string newCompany             = string.Empty;
                string plant                  = string.Empty;
                string siteID                 = string.Empty;
                string siteName               = string.Empty;
                string workstationID          = string.Empty;
                string workstationDescription = string.Empty;
                string employeeID             = string.Empty;
                string countryGroupCode       = string.Empty;
                string countryCode            = string.Empty;
                string tenantID               = string.Empty;


                sessionModClient.SetCompany(objSOHd.Company, out siteID, out siteName, out workstationID, out workstationDescription, out employeeID, out countryGroupCode, out countryCode, out tenantID);
                sessionModClient.SetPlant(Config.Plant);

                if (sessionId != Guid.Empty)
                {
                    //Call the Require function
                    objEpiRes = SOUpdate(epicorUserID, epiorUserPassword, builder, sessionId, objSOHd);
                }
                else
                {
                    throw new Exception($"Error : Sessionid is Empty!");
                }
            }
            catch (Exception ex)
            {
                objEpiRes        = new EpiResponse();
                objEpiRes.ErrMsg = $"Epicor (SalesOrderEntry) Error : {ex.Message.ToString()}";
            }
            finally
            {
                if (sessionId != Guid.Empty)
                {
                    sessionModClient.Logout();
                }
            }
            return(objEpiRes);
        }
Exemplo n.º 3
0
        public EpiResponse CreateSO(int COTOrderNo)
        {
            EpiResponse objEpiRes = null;

            SqlClass.Conn = ConfigurationManager.ConnectionStrings["Finsoft"].ToString();
            StringBuilder strBuilder = new StringBuilder();

            strBuilder.AppendLine("Select a.OrderHedID as COTOrderNum,b.CompanyName as Company,a.CustNum,a.CustID,c.ShipToNum ");
            strBuilder.AppendLine(" ,a.[Owner] as SalesRep ,a.OrderComments,a.InternalRemarks,a.PromotionRemarks,a.ManualSO,d.Title as Promotion,a.OrderType as PONum,a.OrderDate,a.ReqShipDate,a.BulkOrder,isnull(a.EpiOrderNum,0) as EpiOrderNum from OrderHed a ");
            strBuilder.AppendLine(" left join Company b on a.CompanyID=b.CompanyID left join vwShipTo c on a.ShipToSysRowID=c.SysRowID left join Promotion d on a.PromotionID=d.PromotionID ");
            strBuilder.AppendLine($" Where a.OrderHedID={COTOrderNo} ");

            string errMsg = string.Empty;
            SOHd   SOHd   = SqlClass.SelectQry <SOHd>(strBuilder.ToString(), ref errMsg).FirstOrDefault();

            strBuilder.Clear();

            strBuilder.AppendLine(" select a.[Description] + ', ' AS 'data()' ");
            strBuilder.AppendLine(" from Promotion a inner join OrderPromotions b ");
            strBuilder.AppendLine($" on a.PromotionID=b.PromotionID where b.OrderHedID = {COTOrderNo} FOR XML PATH('') ");
            object promoRem = SqlClass.ExecutScalarQry(strBuilder.ToString(), ref errMsg);

            if (promoRem != null)
            {
                SOHd.Promotion = promoRem.ToString();
                SOHd.Promotion.Trim(' ', ',');
            }
            strBuilder.Clear();
            strBuilder.AppendLine("Select a.OrderHedID as COTOrderNum,a.OrderDtlID as COTOrderLineNum ");
            strBuilder.AppendLine(" ,a.PartNum,a.OrderQty,a.FOCQty,a.UOM,a.BasePrice,a.SellingPrice,a.ProposedBasePrice,a.ProposedSellingPrice ");
            strBuilder.AppendLine($" from OrderDtl a Where a.OrderHedID={COTOrderNo} ");

            IEnumerable <SODtl> SODtl = SqlClass.SelectQry <SODtl>(strBuilder.ToString(), ref errMsg);


            foreach (var dtl in SODtl)
            {
                strBuilder.Clear();
                strBuilder.AppendLine("Select a.OrderDtlID as COTOrderLineNum,a.OrderRelID as COTOrderRelNum,b.ShipToNum ");
                strBuilder.AppendLine(" ,a.OrderRelQty,a.FOCRelQty,a.ShipByDate ");
                strBuilder.AppendLine(" from OrderRel a left join vwShipTo b on a.ShipToSysRowID=b.SysRowID ");
                strBuilder.AppendLine($" Where a.OrderDtlID={dtl.COTOrderLineNum} ");
                if (SOHd.BulkOrder)
                {
                    strBuilder.AppendLine($" Order by a.ShipByDate desc ");
                }

                IEnumerable <SORel> SORel = SqlClass.SelectQry <SORel>(strBuilder.ToString(), ref errMsg);
                dtl.SORel = SORel.ToList();
            }
            SOHd.SODtl = SODtl.ToList();

            //Call Epicor BO
            if (SOHd != null)
            {
                Update upd = new Update();
                objEpiRes = upd.Process(SOHd);

                //
                if (string.IsNullOrEmpty(objEpiRes.ErrMsg) && objEpiRes.EpiOrderNum > 0)
                {
                    int maxCount = GetMaxApprovalQueuesID();

                    maxCount += 1;

                    ApprovalQueue approvalQueue = new ApprovalQueue();

                    approvalQueue.CompanyID       = SOHd.Company;
                    approvalQueue.ApprovalQueueID = maxCount.ToString();
                    approvalQueue.ModuleID        = "SO";
                    approvalQueue.DocumentNo      = objEpiRes.EpiOrderNum.ToString();
                    approvalQueue.ApprovalStatus  = "Approved";
                    approvalQueue.ApprovalStage   = "Queue";
                    approvalQueue.SupplierID      = "";
                    approvalQueue.Remarks         = "COT Order Approved";
                    approvalQueue.SubmitDate      = DateTime.Now;
                    approvalQueue.ProceedDate     = Convert.ToDateTime("01/01/1900");

                    string ErMsg = InsertApprovalQueue(approvalQueue);
                    if (!string.IsNullOrEmpty(ErMsg))
                    {
                        objEpiRes.ErrMsg = string.Format("Not Inserted to Approval Queue due to {0}", ErMsg);
                    }
                }
            }

            return(objEpiRes);
        }