Esempio n. 1
0
        public WriteToLogPackage.OutputData ServiceLogWriter(WriteToLogPackage package)
        {
            var stra = new ServiceLogWriter(package);

            stra.Execute();
            return(stra.Package.Out);
        }
Esempio n. 2
0
        }         // GetOneLimitedBusinessData

        private ExperianLtd DownloadOneLimitedFromExperian(string regNumber, int customerId)
        {
            log.Debug("Downloading data from Experian for company {0} and customer {1}...", regNumber, customerId);

            string requestXml = GetResource("ExperianLib.Ebusiness.LimitedBusinessRequest.xml", regNumber);

            string newResponse = MakeRequest(requestXml);

            var pkg = new WriteToLogPackage(
                requestXml,
                newResponse,
                ExperianServiceType.LimitedData,
                customerId,
                companyRefNum: regNumber
                );

            Utils.WriteLog(pkg);

            log.Debug(
                "Downloading data from Experian for company {0} and customer {1} complete.",
                regNumber,
                customerId
                );

            return(pkg.Out.ExperianLtd);
        }         // DownloadOneLimitedFromExperian
Esempio n. 3
0
        public ServiceLogWriter(WriteToLogPackage oPackage)
        {
            this.serviceLogID = 0;
            this.customerID   = null;
            this.directorID   = null;

            this.repoLog = ObjectFactory.GetInstance <ServiceLogRepository>();

            Package = oPackage;
        }         // constructor
Esempio n. 4
0
        public void ServiceLogCreditSafeLtdData(string regNumber, int customerId)
        {
            Log.Debug("Downloading data from CreditSafe for company {0} and customer {1}...", regNumber, customerId);

            string uname      = CurrentValues.Instance.CreditSafeUserName;
            string pass       = CurrentValues.Instance.CreditSafePassword;
            string requestXml = GetResource("Ezbob.Backend.Strategies.CreditSafe.Tamplets.CreditSafeLtdRequestTemplate.xml", uname, pass, regNumber);

            CreditsafeServicesSoapClient client = new CreditsafeServicesSoapClient("CreditsafeServicesSoap");
            string newResponse = client.GetData(requestXml);

            var pkg = new WriteToLogPackage(requestXml, newResponse, ExperianServiceType.CreditSafeLtd, customerId, companyRefNum: regNumber);

            new ServiceLogWriter(pkg).Execute();

            Log.Debug("Downloading data from CreditSafe for company {0} and customer {1} complete.", regNumber, customerId);
        }//ServiceLogCreditSafeLtdData
Esempio n. 5
0
        public static WriteToLogPackage.OutputData WriteLog <TX, TY>(
            TX input,
            TY output,
            ExperianServiceType type,
            int customerId,
            int?directorId       = null,
            string firstname     = null,
            string surname       = null,
            DateTime?dob         = null,
            string postCode      = null,
            string companyRefNum = null
            )
            where TX : class
            where TY : class
        {
            string serializedInput;
            string serializedOutput;

            if (typeof(TX) == typeof(string) && typeof(TY) == typeof(string))
            {
                serializedInput  = input as string;
                serializedOutput = output as string;
            }
            else
            {
                serializedInput  = XSerializer.Serialize(input);
                serializedOutput = XSerializer.Serialize(output);
            }             // if

            var pkg = new WriteToLogPackage(
                serializedInput,
                serializedOutput,
                type,
                customerId,
                directorId,
                firstname,
                surname,
                dob,
                postCode,
                companyRefNum
                );

            return(WriteLog(pkg));
        }         // WriteLog
Esempio n. 6
0
        public void ServiceLogCreditSafeNonLtdData(int customerId)
        {
            SafeReader addressSR = this.m_oDB.GetFirst(
                "GetCompanyAddress",
                CommandSpecies.StoredProcedure,
                new QueryParameter("CustomerId", customerId)
                );
            SafeReader companySR = this.m_oDB.GetFirst(
                "GetCompanyName",
                CommandSpecies.StoredProcedure,
                new QueryParameter("CustomerId", customerId)
                );

            string companyName = companySR["CompanyName"];

            companyName = HttpUtility.HtmlEncode(companyName);
            if (string.IsNullOrEmpty(companyName))
            {
                Log.Info("CreditSafeNonLtd not retrieving data - customer has no company name.");
                return;
            }
            string companyId = companySR["CompanyId"];
            string address   = addressSR["Line1"];
            string postcode  = addressSR["Postcode"];
            string uname     = CurrentValues.Instance.CreditSafeUserName;
            string pass      = CurrentValues.Instance.CreditSafePassword;

            Log.Debug("Targeting data from CreditSafe for Company: {0} With CompanyId:{1} and CustomerId: {2}", companyName, companyId, customerId);

            string targetingRequest = GetResource("Ezbob.Backend.Strategies.CreditSafe.Tamplets.CreditSafeNonLtdSearchTemplate.xml", uname, pass, companyName, address, postcode);

            CreditsafeServicesSoapClient client = new CreditsafeServicesSoapClient("CreditsafeServicesSoap");
            string targetingResponse            = client.GetData(targetingRequest);

            var targetingPkg = new WriteToLogPackage(targetingRequest, targetingResponse, ExperianServiceType.CreditSafeNonLtdTargeting, customerId);

            new ServiceLogWriter(targetingPkg).Execute();

            XmlSerializer searchSerializer = new XmlSerializer(typeof(CreditSafeNonLtdSearchResponse), new XmlRootAttribute("xmlresponse"));
            CreditSafeNonLtdSearchResponse targetingResult = (CreditSafeNonLtdSearchResponse)searchSerializer.Deserialize(new StringReader(targetingResponse));

            try
            {
                xmlresponsesearchBody body = (xmlresponsesearchBody)targetingResult.Items[1];
                if (body.results != null && body.results.Length == 1)
                {
                    string companyNum = body.results[0].number;
                    Log.Debug("Downloading data from CreditSafeNonLtd for company {0} and customer {1}...", companyNum, customerId);
                    string requestXml  = GetResource("Ezbob.Backend.Strategies.CreditSafe.Tamplets.CreditSafeNonLtdRequestTemplate.xml", uname, pass, companyNum);
                    string newResponse = client.GetData(requestXml);
                    var    pkg         = new WriteToLogPackage(requestXml, newResponse, ExperianServiceType.CreditSafeNonLtd, customerId, companyRefNum: companyNum);
                    new ServiceLogWriter(pkg).Execute();
                    Log.Debug("Downloading data from CreditSafeNonLtd for company {0} and customer {1} complete.", companyNum, customerId);
                }//if
                else
                {
                    Log.Info("CreditSafeNonLtd Targeting failed for customer {0}", customerId);
                } //else
            }     //try
            catch (Exception ex)
            {
                Log.Error(ex, "failed to retrieve CreditSafe data for customerId:{0}", customerId);
            } //catch
        }     //ServiceLogCreditSafeNonLtdData
Esempio n. 7
0
        }         // WriteLog

        public static WriteToLogPackage.OutputData WriteLog(WriteToLogPackage package)
        {
            return(ObjectFactory.GetInstance <IEzServiceAccessor>().ServiceLogWriter(package));
        }         // WriteToLog
Esempio n. 8
0
 public WriteToLogPackage.OutputData ServiceLogWriter(WriteToLogPackage package)
 {
     //should not execute this strategy from web (only from service)
     this.m_oServiceClient.Instance.WriteToServiceLog(package.In.CustomerID, package.In.CustomerID, package.In);
     return(null);
 }