예제 #1
0
        public bool SendEnvAsOrder(int orderId, MySqlDataReader dr, string filePath)
        {
            dataset    = dr;
            errorMsg   = "";
            resultsLog = new List <string>();

            // 1. dbInfo to class/XML

            orderXml = null;
            OrderData2Xml(orderId);

            orderXml.Order.ServiceId = ServiceOption.Item102;

            // 2. sendEnvFile

            if (!SendOrderRequest(orderId, "eo"))
            {
                return(false);
            }

            envDocId = orderResponse.Tracking.DocId;  //env order is the Parent Doc Id in CMS for all subsequent orders

            envOrderHeader           = orderXml.Header;
            envOrderHeader.MessageId = Guid.NewGuid().ToString();

            envFileWasSent = UploadEnvFile(orderId, filePath);

            return(errorMsg.IsStrEmpty());
        }
예제 #2
0
        private void OrderData2Xml(int orderId)
        {
            flds = new Dictionary <string, int>(200, StringComparer.InvariantCultureIgnoreCase);
            for (int i = 0; i < dataset.FieldCount; i++)
            {
                var name = dataset.GetName(i);
                if (flds.ContainsKey(name))
                {
                    nof.Add("dupSqlCol: " + name);
                }
                else
                {
                    flds.Add(name, i);
                }
            }

            IsOrderAnUpdate = dr_GetString("RequestStatus", "").ToLower() == "dispute";

            var o = new CreateOrderRqType();
            var h = new RequestHdrType();

            orderXml        = new CreateOrderRq();
            orderXml.Order  = o;
            orderXml.Header = h;

            h.IsTest           = config.IsTest;
            h.SourceApp        = dr_GetString("SourceApp");
            h.TargetApp        = dr_GetString("TargetApp");
            h.AppInstance      = dr_GetString("AppInstance");
            h.AppInstanceLogin = config.userId;
            h.AppInstancePwd   = config.passwd;
            h.Timestamp        = DateTime.Now;
            h.MessageId        = dr_GetString("MessageId");                  // Guid.NewGuid().ToString();
            h.CorrelationId    = dr_GetString("CorrelationId");              // Guid.NewGuid().ToString();
            h.SequenceKey      = dr_GetString("SequenceKey");                // Guid.NewGuid().ToString();
            h.SequenceNumber   = dr_GetString("SequenceNumber").ToIntDef(1); // 1;

            o.GroupId             = config.groupId;
            o.GroupIdSpecified    = true;
            o.ProcPrsnPk          = config.procPrsnPk;
            o.ProcPrsnPkSpecified = true;

            o.ProcComments = dr_GetString("ProcComments");
            o.OrderInfo    = new OrderInfoType()
            {
                LoanNumber             = dr_GetString("LoanNumber"),
                Reference1             = dr_GetString("Reference1"),
                Reference2             = dr_GetString("Reference2"),
                IsRushOrder            = dr_GetString("IsRushOrder").IsTrue(),
                IsFHA                  = dr_GetString("IsFHA").IsTrue(),
                SubLoanType            = dr_GetString("SubLoanType").StringToEnum <SubLoanTypeOption>(SubLoanTypeOption.Item203),
                SubLoanTypeSpecified   = dr_GetString("SubLoanTypeSpecified").IsTrue(),
                LoanClassificationCode = dr_GetString("LoanClassificationCode"),
                OrderAttributeCode     = dr_GetString("OrderAttributeCode").ToStringDef("").Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries),
                CostCenterCode         = dr_GetString("CostCenterCode"),
                IsHighValue            = dr_GetString("IsHighValue").IsTrue(),
                GovernmentCaseNumber   = dr_GetString("GovernmentCaseNumber"),
                DueToCustomer          = dr_GetString("DueToCustomer").ToDateDef(DateTime.Now.AddDays(5)),
                DueToCustomerSpecified = dr_GetString("DueToCustomerSpecified").IsTrue(),
                DueFromVendor          = dr_GetString("DueFromVendor").ToDateDef(DateTime.Now.AddDays(5)),
                DueFromVendorSpecified = dr_GetString("DueFromVendorSpecified").IsTrue(),
                ClosingDt              = dr_GetString("ClosingDt").ToDateDef(DateTime.Now.AddDays(5)),
                ClosingDtSpecified     = dr_GetString("ClosingDtSpecified").IsTrue(),
                CustomerPk             = config.customerPk,
                CustomerPkSpecified    = true,
                LoanOfficer            = dr_GetString("LoanOfficer").ToIntDef(0),
                LoanOfficerSpecified   = dr_GetString("LoanOfficerSpecified").IsTrue(),
                Channel                = dr_GetString("Channel").StringToEnum <ChannelOption>(ChannelOption.Item1),
                ApplicantFirstName     = dr_GetString("ApplicantFirstName"),
                ApplicantMiddleInitial = dr_GetString("ApplicantMiddleInitial"),
                ApplicantLastName      = dr_GetString("ApplicantLastName"),
                ApplicantCompanyName   = dr_GetString("ApplicantCompanyName"),
            };

            string amgr = dr_GetString("AMFirstName").IsStrEmpty() ? "" : ", {0} {1}, {2} {3}".FormatWith(
                dr_GetString("AMFirstName"),
                dr_GetString("AMLastName"),
                dr_GetString("AMPhone"),
                dr_GetString("AMEmail")
                );

            o.PropertyAddress = new AddressInfoType()
            {
                RequireNormalization      = dr_GetString("RequireNormalization").IsTrue(),
                UnstructuredStreetAddress = dr_GetString("UnstructuredStreetAddress"),
                StreetNo          = dr_GetString("StreetNo", ""),
                Prefix            = dr_GetString("Prefix", ""),
                Street            = dr_GetString("Street", ""),
                Suffix            = dr_GetString("Suffix", ""),
                UnitNo            = dr_GetString("UnitNo", ""),
                City              = dr_GetString("City", ""),
                County            = dr_GetString("County", ""),
                State             = dr_GetString("State").StringToEnum <State>(State.CA),
                Zip               = dr_GetString("Zip", ""),
                AccessInstruction = "{0}{1}".FormatWith(dr_GetString("AccessInstruction", "").Left(2850), amgr)
            };
            o.PropertyTypeId                 = dr_GetString("PropertyTypeId");
            o.LoanPurposeId                  = dr_GetString("LoanPurposeId").StringToEnum <LoanPurposeOption>(LoanPurposeOption.Item);
            o.HpmlOrder                      = dr_GetString("HpmlOrder ").IsTrue();
            o.HpmlOrderSpecified             = dr_GetString("HpmlOrderSpecified").IsTrue();
            o.OccupancyTypeId                = dr_GetString("OccupancyTypeId").StringToEnum <OccupancyTypeOption>(OccupancyTypeOption.VAC);
            o.OwnerEstimate                  = dr_GetString("OwnerEstimate").ToDecimalDef(0);
            o.OwnerEstimateSpecified         = dr_GetString("OwnerEstimateSpecified").IsTrue();
            o.SalesPrice                     = dr_GetString("SalesPrice").ToDecimalDef(0);
            o.SalesPriceSpecified            = dr_GetString("SalesPriceSpecified").IsTrue();
            o.OriginalPurchasePrice          = dr_GetString("OriginalPurchasePrice").ToDecimalDef(0);
            o.OriginalPurchasePriceSpecified = dr_GetString("OriginalPurchasePriceSpecified").IsTrue();
            o.LoanAmount                     = dr_GetString("LoanAmount").ToDecimalDef(0);
            o.LoanAmountSpecified            = dr_GetString("LoanAmountSpecified").IsTrue();
            o.OutstandingLien                = dr_GetString("OutstandingLien   ").ToDecimalDef(0);
            o.OutstandingLienSpecified       = dr_GetString("OutstandingLienSpecified").IsTrue();
            o.CustomerPrice                  = dr_GetString("CustomerPrice").ToDecimalDef(0);
            o.CustomerPriceSpecified         = dr_GetString("CustomerPriceSpecified").IsTrue();
            o.ProviderFee                    = dr_GetString("ProviderFee").ToDecimalDef(0);
            o.ProviderFeeSpecified           = dr_GetString("ProviderFeeSpecified").IsTrue();
            o.ServiceId                      = dr_GetString("ServiceId").StringToEnum <ServiceOption>(ServiceOption.Item1);
            o.ServiceProviderID              = null;//dr_GetString( "ServiceProviderID"       );

            o.BorrowerContact = new ContactType()
            {
                Name           = dr_GetString("Contact_Name"),
                ContactTypeId  = dr_GetString("Contact_ContactTypeId").StringToEnum <ContactTypeIdOption>(ContactTypeIdOption.E),
                StreetAddress  = dr_GetString("Contact_StreetAddress"),
                City           = dr_GetString("Contact_City"),
                State          = dr_GetString("Contact_State").StringToEnum <State>(State.CA),
                StateSpecified = dr_GetString("Contact_StateSpecified").IsTrue(),
                Zip            = dr_GetString("Contact_Zip"),
                County         = dr_GetString("Contact_County"),
                Phone          = dr_GetString("Contact_Phone").JustInt("", false),
                PhoneExt       = null, //dr_GetString( "Contact_PhoneExt" ).JustInt( "", false ),
                AltPhone       = null, //kdr_GetString( "Contact_AltPhone" ).JustInt( "", false ),
                AltPhoneExt    = null, //dr_GetString( "Contact_AltPhoneExt" ).JustInt( "", false ),
                CellPhone      = null, //dr_GetString( "Contact_CellPhone" ).JustInt( "", false ),
                Pager          = null, //dr_GetString( "Contact_Pager" ).JustInt( "", false ),
                Fax            = dr_GetString("Contact_Fax").JustInt("", false),
                Email          = dr_GetString("Contact_Email"),
                CanContact     = dr_GetString("Contact_CanContact").IsTrue()
            };
            //o.AlternateContact                    = // AltContactType[]
            o.MCRequired                          = dr_GetString("MCRequired").IsTrue();
            o.MCRequiredSpecified                 = dr_GetString("MCRequiredSpecified").IsTrue();
            o.IsBorrowerCC                        = dr_GetString("IsBorrowerCC").IsTrue();
            o.IsBorrowerCCSpecified               = dr_GetString("IsBorrowerCCSpecified").IsTrue();
            o.PaymentParty                        = null;
            o.ParentDocID                         = null;
            o.ByPassDupChk                        = dr_GetString("ByPassDupChk").IsTrue();
            o.ByPassDupChkSpecified               = dr_GetString("ByPassDupChkSpecified").IsTrue();
            o.UsePreviousServiceProvider          = dr_GetString("UsePreviousServiceProvider").IsTrue();
            o.UsePreviousServiceProviderSpecified = dr_GetString("UsePreviousServiceProviderSpecified").IsTrue();
            o.UsePreviousReviewer                 = dr_GetString("UsePreviousReviewer").IsTrue();
            o.UsePreviousReviewerSpecified        = dr_GetString("UsePreviousReviewerSpecified").IsTrue();
            o.UsePreviousOrderAttributes          = dr_GetString("UsePreviousOrderAttributes").IsTrue();
            o.UsePreviousOrderAttributesSpecified = dr_GetString("UsePreviousOrderAttributesSpecified").IsTrue();
            o.CustomerID                          = null;//dr_GetString( "CustomerID" );
            o.BatchName = dr_GetString("BatchName");

            // following s/not happend.  all dbCols -> xmlFields s/be accounted for
            if (nof != null && nof.Count > 0 && config.saveTempFiles)
            {
                string fname   = respOrdFileName.FormatWith(DateTime.Now.ToString(ts), orderId).Replace("response", "nof");
                string tmpFile = Path.Combine(config.tempFileDir, fname);
                File.WriteAllText(tmpFile, String.Join("\n", nof.ToArray()));
            }

            if (IsOrderAnUpdate)
            {
                vendorOrderNo                          = dr_GetString("vendorOrderNo");
                updOrderXml                            = new UpdateOrderStatusRq();
                updOrderXml.Header                     = h;
                updOrderXml.OrderStatusUpdate          = new UpdateOrderStatusRqType();
                updOrderXml.OrderStatusUpdate.DocId    = dr_GetString("vendorOrderNo");
                updOrderXml.OrderStatusUpdate.StatusId = "N";

                amgr = dr_GetString("AMFirstName", "").IsStrEmpty() ? "" : "{0} {1}".FormatWith(dr_GetString("AMFirstName"), dr_GetString("AMLastName"));

                updOrderCommentXml                    = new AddOrderCommentRQ();
                updOrderCommentXml.Header             = h;
                updOrderCommentXml.Comment            = new OrderCommentType();
                updOrderCommentXml.Comment.Author     = amgr;
                updOrderCommentXml.Comment.PostDate   = DateTime.Parse(dr_GetString("requestModified"));
                updOrderCommentXml.Comment.Comment    = dr_GetString("reason_for_return", "").Left(4000);
                updOrderCommentXml.Comment.ViewRights = OrderCommentTypeViewRights.ServiceProvider;
                updOrderCommentXml.Comment.Subject    = "Revisions Requested";
                updOrderCommentXml.Comment.DocId      = dr_GetString("vendorOrderNo");
            }
        }