public MerchantsAdditionalInfo RetrieveMerchantDataEntry(Int64 merchantId) { MerchantsAdditionalInfo merchantsdemodel = null; DataSet merchantsinfo = (new DataAccess.DataAccess()).ExecuteDataSet("avz_mrc_spretrieveMerchantDataEntry", new { merchantId = merchantId }); if (merchantsinfo.Tables[0].Rows.Count > 0) { merchantsdemodel = new MerchantsAdditionalInfo(); merchantsdemodel.merchantName = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["merchantName"]); merchantsdemodel.legalName = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["legalName"]); merchantsdemodel.businessName = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["businessName"]); merchantsdemodel.businessTypeId = Convert.ToInt32(merchantsinfo.Tables[0].Rows[0]["businessTypeId"]); merchantsdemodel.businessWebSite = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["businessWebSite"]); merchantsdemodel.rentAmount = Convert.ToDouble(merchantsinfo.Tables[0].Rows[0]["rentAmount"]); merchantsdemodel.annualSales = string.IsNullOrEmpty(merchantsinfo.Tables[0].Rows[0]["annualSales"].ToString()) ? 0 : Convert.ToDouble(merchantsinfo.Tables[0].Rows[0]["annualSales"]); merchantsdemodel.loanAmountRequired = string.IsNullOrEmpty(merchantsinfo.Tables[0].Rows[0]["loanAmountRequired"].ToString()) ? 0 : Convert.ToDouble(merchantsinfo.Tables[0].Rows[0]["loanAmountRequired"]); merchantsdemodel.rnc = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["rnc"]); merchantsdemodel.industryTypeId = Convert.ToInt32(merchantsinfo.Tables[0].Rows[0]["industryTypeId"]); merchantsdemodel.assignedSales = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["assignedSales"]); merchantsdemodel.salesRepId = Convert.ToInt32(merchantsinfo.Tables[0].Rows[0]["salesRepId"]); merchantsdemodel.taskName = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["taskName"]); merchantsdemodel.workFlowName = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["workFlowName"]); if (merchantsinfo.Tables[0].Rows[0]["workflowId"].ToString() != null && merchantsinfo.Tables[0].Rows[0]["workflowId"].ToString() != "") merchantsdemodel.workflowId = Convert.ToInt32(merchantsinfo.Tables[0].Rows[0]["workflowId"]); merchantsdemodel.assigneduserId = Convert.ToInt32(merchantsinfo.Tables[0].Rows[0]["assigneduserId"]); if (merchantsinfo.Tables[0].Rows[0]["assignedDate"].ToString() != null && merchantsinfo.Tables[0].Rows[0]["assignedDate"].ToString() != "") merchantsdemodel.assignedDate = Convert.ToDateTime(merchantsinfo.Tables[0].Rows[0]["assignedDate"]); if (merchantsinfo.Tables[0].Rows[0]["businessStartDate"].ToString() != null && merchantsinfo.Tables[0].Rows[0]["businessStartDate"].ToString() != "") merchantsdemodel.businessStartDate = Convert.ToDateTime(merchantsinfo.Tables[0].Rows[0]["businessStartDate"]); if (merchantsinfo.Tables[0].Rows[0]["merchantId"].ToString() != null && merchantsinfo.Tables[0].Rows[0]["merchantId"].ToString() != "") merchantsdemodel.merchantId = Convert.ToInt32(merchantsinfo.Tables[0].Rows[0]["merchantId"]); if (merchantsinfo.Tables[0].Rows[0]["bankId"].ToString() != null && merchantsinfo.Tables[0].Rows[0]["bankId"].ToString() != "") merchantsdemodel.BankID = Convert.ToInt32(merchantsinfo.Tables[0].Rows[0]["bankId"]); merchantsdemodel.propertyType = string.IsNullOrEmpty(merchantsinfo.Tables[0].Rows[0]["propertyType"].ToString()) ? 0 : Convert.ToInt32(merchantsinfo.Tables[0].Rows[0]["propertyType"]); merchantsdemodel.accountNumber = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["accountNumber"]); merchantsdemodel.accountName = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["accountName"]); merchantsdemodel.BankCode = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["bankcode"]); merchantsdemodel.AnnualSalesCalcFile = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["AnnualSalesCalcFile"]); merchantsdemodel.contractId = Convert.ToInt64(string.IsNullOrEmpty(merchantsinfo.Tables[0].Rows[0]["contractId"].ToString()) == false ? merchantsinfo.Tables[0].Rows[0]["contractId"].ToString() : "0"); if (merchantsinfo.Tables[0].Rows[0]["primarySalesRepId"].ToString() != null && merchantsinfo.Tables[0].Rows[0]["primarySalesRepId"].ToString() != "") merchantsdemodel.PsalesRepId = Convert.ToInt32(merchantsinfo.Tables[0].Rows[0]["primarySalesRepId"]); if (merchantsinfo.Tables[0].Rows[0]["secondarySalesRepId"].ToString() != null && merchantsinfo.Tables[0].Rows[0]["secondarySalesRepId"].ToString() != "") merchantsdemodel.SecsalesRepId = Convert.ToInt32(merchantsinfo.Tables[0].Rows[0]["secondarySalesRepId"]); if (merchantsinfo.Tables[0].Rows[0]["typeofadvances"].ToString() != null && merchantsinfo.Tables[0].Rows[0]["typeofadvances"].ToString() != "") merchantsdemodel.TypeOfAdvanceId = Convert.ToInt32(merchantsinfo.Tables[0].Rows[0]["typeofadvances"]); Address merchantsaddress = new Address(); merchantsaddress.phone1 = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["phone1"]); merchantsaddress.phone2 = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["phone2"]); merchantsaddress.addressLine1 = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["addressLine1"]); merchantsaddress.addressLine2 = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["addressLine2"]); merchantsaddress.country = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["country"]); merchantsaddress.city = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["city"]); merchantsaddress.state = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["state"]); merchantsaddress.stateId = string.IsNullOrEmpty(merchantsinfo.Tables[0].Rows[0]["stateId"].ToString()) ? 0 : Convert.ToInt64(merchantsinfo.Tables[0].Rows[0]["stateId"]); merchantsaddress.email = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["email"]); merchantsaddress.zipId = Convert.ToString(merchantsinfo.Tables[0].Rows[0]["zipId"]); if (merchantsinfo.Tables[0].Rows[0]["addressId"].ToString() != null && merchantsinfo.Tables[0].Rows[0]["addressId"].ToString() != "") merchantsaddress.addressId = Convert.ToInt32(merchantsinfo.Tables[0].Rows[0]["addressId"]); merchantsdemodel.address = merchantsaddress; // Owner's Information if (merchantsinfo.Tables[1].Rows.Count > 0) { List<OwnerModel> ownermodellist = new List<OwnerModel>(); for (int i = 0; i < merchantsinfo.Tables[1].Rows.Count; i++) { OwnerModel ownermodel = new OwnerModel(); if (merchantsinfo.Tables[1].Rows[i]["contactId"].ToString() != null && merchantsinfo.Tables[1].Rows[i]["contactId"].ToString() != "") ownermodel.contactId = Convert.ToInt64(merchantsinfo.Tables[1].Rows[i]["contactId"]); if (merchantsinfo.Tables[1].Rows[i]["ownerId"].ToString() != null && merchantsinfo.Tables[1].Rows[i]["ownerId"].ToString() != "") ownermodel.ownerId = Convert.ToInt64(merchantsinfo.Tables[1].Rows[i]["ownerId"]); if (merchantsinfo.Tables[1].Rows[i]["addressId"].ToString() != null && merchantsinfo.Tables[1].Rows[i]["addressId"].ToString() != "") ownermodel.addressId = Convert.ToInt64(merchantsinfo.Tables[1].Rows[i]["addressId"]); ownermodel.merchantId = merchantId; ownermodel.ownerFirstName = Convert.ToString(merchantsinfo.Tables[1].Rows[i]["ownerFirstName"]); ownermodel.ownerLastName = Convert.ToString(merchantsinfo.Tables[1].Rows[i]["ownerLastName"]); if (merchantsinfo.Tables[1].Rows[i]["ownerDOB"].ToString() != null && merchantsinfo.Tables[1].Rows[i]["ownerDOB"].ToString() != "") ownermodel.ownerDOB = Convert.ToDateTime(merchantsinfo.Tables[1].Rows[i]["ownerDOB"]); ownermodel.PassportNumber = Convert.ToString(merchantsinfo.Tables[1].Rows[i]["passportnbr"]); ownermodel.phone1 = Convert.ToString(merchantsinfo.Tables[1].Rows[i]["phone1"]); ownermodel.CellNumber = Convert.ToString(merchantsinfo.Tables[1].Rows[i]["phone2"]); ownermodel.ssn = Convert.ToString(merchantsinfo.Tables[1].Rows[i]["ssn"]); ownermodel.addressLine1 = Convert.ToString(merchantsinfo.Tables[1].Rows[i]["addressLine1"]); ownermodel.addressLine2 = Convert.ToString(merchantsinfo.Tables[1].Rows[i]["addressLine2"]); ownermodel.country = Convert.ToString(merchantsinfo.Tables[1].Rows[i]["country"]); ownermodel.city = Convert.ToString(merchantsinfo.Tables[1].Rows[i]["city"]); ownermodel.state = Convert.ToString(merchantsinfo.Tables[1].Rows[i]["state"]); ownermodel.stateId = Convert.ToString(merchantsinfo.Tables[1].Rows[i]["stateId"]); ownermodel.zip = Convert.ToString(merchantsinfo.Tables[1].Rows[i]["zip"]); ownermodel.email = Convert.ToString(merchantsinfo.Tables[1].Rows[i]["email"]); ownermodel.Authorized = Convert.ToBoolean(merchantsinfo.Tables[1].Rows[i]["IsAuthorized"]); ownermodellist.Add(ownermodel); } merchantsdemodel.owners = ownermodellist; } //Processor Information if (merchantsinfo.Tables[2].Rows.Count > 0) { List<MerchantProcessorModel> processors = new List<MerchantProcessorModel>(); for (int i = 0; i < merchantsinfo.Tables[2].Rows.Count; i++) { MerchantProcessorModel processormodel = new MerchantProcessorModel(); if (merchantsinfo.Tables[2].Rows[i]["processorId"].ToString() != null && merchantsinfo.Tables[2].Rows[i]["processorId"].ToString() != "") processormodel.processorId = Convert.ToInt32(merchantsinfo.Tables[2].Rows[i]["processorId"]); if (merchantsinfo.Tables[2].Rows[i]["processorTypeId"].ToString() != null && merchantsinfo.Tables[2].Rows[i]["processorTypeId"].ToString() != "") processormodel.processorTypeId = Convert.ToInt32(merchantsinfo.Tables[2].Rows[i]["processorTypeId"]); processormodel.processorName = Convert.ToString(merchantsinfo.Tables[2].Rows[i]["processorname"]); if (merchantsinfo.Tables[2].Rows[i]["processorNumber"].ToString() != null && merchantsinfo.Tables[2].Rows[i]["processorNumber"].ToString() != "") processormodel.processorNumber = Convert.ToString(merchantsinfo.Tables[2].Rows[i]["processorNumber"]); if (merchantsinfo.Tables[2].Rows[i]["firstprocessedDate"].ToString() != null && merchantsinfo.Tables[2].Rows[i]["firstprocessedDate"].ToString() != "") processormodel.firstprocessedDate = Convert.ToDateTime(merchantsinfo.Tables[2].Rows[i]["firstprocessedDate"]); processors.Add(processormodel); } merchantsdemodel.processor = processors; } if (merchantsinfo.Tables[3].Rows.Count > 0) { List<MerchantBankStatement> statements = new List<MerchantBankStatement>(); for (int i = 0; i < merchantsinfo.Tables[3].Rows.Count; i++) { MerchantBankStatement statementmodel = new MerchantBankStatement(); if (merchantsinfo.Tables[3].Rows[i]["StatementId"].ToString() != null && merchantsinfo.Tables[3].Rows[i]["StatementId"].ToString() != "") statementmodel.StatementId = Convert.ToInt32(merchantsinfo.Tables[3].Rows[i]["StatementId"]); if (merchantsinfo.Tables[3].Rows[i]["StatementMonthId"].ToString() != null && merchantsinfo.Tables[3].Rows[i]["StatementMonthId"].ToString() != "") statementmodel.StatementMonthId = Convert.ToInt32(merchantsinfo.Tables[3].Rows[i]["StatementMonthId"]); statementmodel.StatementYear = Convert.ToString(merchantsinfo.Tables[3].Rows[i]["Statementyear"]); if (merchantsinfo.Tables[3].Rows[i]["amount"].ToString() != null && merchantsinfo.Tables[3].Rows[i]["amount"].ToString() != "") statementmodel.Amount = Convert.ToDouble(merchantsinfo.Tables[3].Rows[i]["amount"]); statements.Add(statementmodel); } merchantsdemodel.BankStatements = statements; } if (merchantsinfo.Tables[4].Rows.Count > 0) { int i = 0; MerchantLandLord LandlordInformationmodel = new MerchantLandLord(); if (merchantsinfo.Tables[4].Rows[i]["landlordcompany"].ToString() != null && merchantsinfo.Tables[4].Rows[i]["landlordcompany"].ToString() != "") LandlordInformationmodel.CompanyName = Convert.ToString(merchantsinfo.Tables[4].Rows[i]["landlordcompany"]); if (merchantsinfo.Tables[4].Rows[i]["landlordId"].ToString() != null && merchantsinfo.Tables[4].Rows[i]["landlordId"].ToString() != "") LandlordInformationmodel.LandlordId = Convert.ToInt32(merchantsinfo.Tables[4].Rows[i]["landlordId"]); LandlordInformationmodel.FirstName = Convert.ToString(merchantsinfo.Tables[4].Rows[i]["firstname"]); LandlordInformationmodel.LastName = Convert.ToString(merchantsinfo.Tables[4].Rows[i]["lastname"]); LandlordInformationmodel.PhoneNumber = Convert.ToString(merchantsinfo.Tables[4].Rows[i]["telephone"]); merchantsdemodel.LandlordInformation = LandlordInformationmodel; } if (merchantsinfo.Tables[5].Rows.Count > 0) { List<MerchantTradeReference> traderefs = new List<MerchantTradeReference>(); for (int i = 0; i < merchantsinfo.Tables[5].Rows.Count; i++) { MerchantTradeReference traderef = new MerchantTradeReference(); if (merchantsinfo.Tables[5].Rows[i]["TradeRefId"].ToString() != null && merchantsinfo.Tables[5].Rows[i]["TradeRefId"].ToString() != "") traderef.ReferenceId = Convert.ToInt32(merchantsinfo.Tables[5].Rows[i]["TradeRefId"]); traderef.ReferenceName = Convert.ToString(merchantsinfo.Tables[5].Rows[i]["Name"]); traderef.PhoneNumber = Convert.ToString(merchantsinfo.Tables[5].Rows[i]["PhoneNumber"]); traderefs.Add(traderef); } merchantsdemodel.TradeReference = traderefs; } } return merchantsdemodel; }
/// <summary> /// /// </summary> /// <param name="merhantId"></param> /// <returns></returns> public MerchantInformationOfferModel RetrieveMerchantCreditInformation(Int64 merchantId, Int64 contractId) { MerchantInformationOfferModel model = new MerchantInformationOfferModel(); DataSet merchantInformation; long maxtrun = 0; merchantInformation = new DataAccess.DataAccess().ExecuteDataSet("avz_cc_spRetrieveMerchantCreditInformation", new { merchantId = merchantId, contractId = contractId }); if (merchantInformation.Tables[0].Rows.Count > 0) { Address adr = new Address(); if (!string.IsNullOrEmpty(merchantInformation.Tables[0].Rows[0]["averagemccv"].ToString())) model.avgmccv = Convert.ToDouble(merchantInformation.Tables[0].Rows[0]["averagemccv"].ToString()); if (!string.IsNullOrEmpty(merchantInformation.Tables[0].Rows[0]["grossAnnualSales"].ToString())) model.yearlysales = Convert.ToDouble(merchantInformation.Tables[0].Rows[0]["grossAnnualSales"].ToString()); if (!string.IsNullOrEmpty(merchantInformation.Tables[0].Rows[0]["score"].ToString())) model.score = Convert.ToDouble(merchantInformation.Tables[0].Rows[0]["score"].ToString()); if (!string.IsNullOrEmpty(merchantInformation.Tables[0].Rows[0]["maxprice"].ToString())) { model.maxturn = Convert.ToInt64(merchantInformation.Tables[0].Rows[0]["maxprice"].ToString()); maxtrun = Convert.ToInt64(merchantInformation.Tables[0].Rows[0]["maxprice"].ToString()); } if (!string.IsNullOrEmpty(merchantInformation.Tables[0].Rows[0]["salestaken"].ToString())) { model.salestaken = Convert.ToInt64(merchantInformation.Tables[0].Rows[0]["salestaken"].ToString()); } model.reason = merchantInformation.Tables[0].Rows[0]["reason"].ToString(); model.finalscore = merchantInformation.Tables[0].Rows[0]["finalscore"].ToString(); model.businessName = merchantInformation.Tables[0].Rows[0]["businessName"].ToString(); if (!string.IsNullOrEmpty(merchantInformation.Tables[0].Rows[0]["IsOffersSent"].ToString())) { model.IsOffersEmailSent = Convert.ToBoolean(merchantInformation.Tables[0].Rows[0]["IsOffersSent"]); } adr.addressLine1 = merchantInformation.Tables[0].Rows[0]["address1"].ToString(); adr.addressLine2 = merchantInformation.Tables[0].Rows[0]["address2"].ToString(); adr.country = merchantInformation.Tables[0].Rows[0]["country"].ToString(); adr.state = merchantInformation.Tables[0].Rows[0]["state"].ToString(); adr.city = merchantInformation.Tables[0].Rows[0]["city"].ToString(); model.address = adr; } if (merchantInformation.Tables[1].Rows.Count > 0) { List<SalesRepresentative> sales = new List<SalesRepresentative>(); for (int i = 0; i < merchantInformation.Tables[1].Rows.Count; i++) { SalesRepresentative rep = new SalesRepresentative(); rep.email = merchantInformation.Tables[1].Rows[0]["email"].ToString(); rep.salesrepname = merchantInformation.Tables[1].Rows[0]["name"].ToString(); sales.Add(rep); } model.salesRepresentative = sales; } if (merchantInformation.Tables[2].Rows.Count > 0) { List<MinPrice> price = new List<MinPrice>(); for (int i = 0; i < merchantInformation.Tables[2].Rows.Count; i++) { MinPrice pri = new MinPrice(); pri.score = merchantInformation.Tables[2].Rows[i]["score"].ToString(); pri.maxtime = Convert.ToInt64(merchantInformation.Tables[2].Rows[i]["MaxTime"].ToString()); pri.minprice = Convert.ToDouble(merchantInformation.Tables[2].Rows[i]["Minprice"].ToString()); price.Add(pri); } model.turnminprice = price; } IList<OfferModel> offers = RetrieveOffers(merchantId, contractId); //foreach (var item in offers) //{ // item.maxprice = maxtrun; //} //if (offers.Count == 0) //{ // OfferModel of = new OfferModel(); // of.maxprice = maxtrun; // offers.Add(of); //} model.offers = offers.ToList(); return model; }