static void aMain(string[] args) { InsuranceWebService insuranceWebService = new InsuranceWebService(); var insRequest = new InsuranceRequest(); var mySession = new SessionRequest(); var myBank = new BankRequest(); var myPolicy = new PolicyRequest(); var myClient = new ClientRequest(); var myVehicle = new VehicleRequest(); var myLoan = new LoanRequest(); mySession.Username = ""; mySession.AuthenticationKey = ""; mySession.Bordereaux = false; mySession.Account = ""; mySession.GuaranteeWarrantyDate = new DateTime(); mySession.PaidByCard = true; mySession.DeliveryDate = new DateTime(); mySession.LoanProvided = false; myClient.FirstName = ""; myClient.Surname = ""; myClient.Title = ""; myClient.HouseNumber = ""; myClient.Address = ""; myClient.Postcode = ""; myClient.Email = ""; myClient.Telephone = ""; //Optional myClient.DateOfBirth = new DateTime(); //END Optional myClient.IsCompany = false; myPolicy.Description = ""; myPolicy.Plan = ""; myPolicy.GrossPremium = 0; myPolicy.Product = ""; myPolicy.CoverPeriod = 0; //Optional myPolicy.DatePISupplied = new DateTime(); myPolicy.ExternalReference = ""; myPolicy.DateCustomerConfirmed = new DateTime(); //END Optional myPolicy.PaidByCard = false; myVehicle.Make = ""; myVehicle.Model = ""; myVehicle.Registration = ""; myVehicle.Price = 0; myVehicle.Mileage = 0; myVehicle.DateRegistered = new DateTime(); myVehicle.EngineSize = 0; myVehicle.MOTDate = new DateTime(); myVehicle.Fuel = ""; myVehicle.NewVehicle = false; myVehicle.Motorcycle = false; myBank.AccountName = ""; myBank.AccountNumber = ""; myBank.PaperlessDDI = false; myBank.PayeeAddress = ""; myBank.PayeeFirstName = ""; myBank.PayeeSurname = ""; myBank.PayeeHouseNumber = ""; myBank.PayeePostcode = ""; myBank.PayeeTitle = ""; myBank.SortCode = ""; myBank.PolicyHolderPaying = false; //Optional myLoan.Advance = 0; myLoan.AdvanceRentals = 0; myLoan.LoanPayment = 0; myLoan.LoanTerm = 0; //END Optional myLoan.BorrowerName = ""; myLoan.Lender = ""; insRequest.Session = mySession; insRequest.Vehicle = myVehicle; insRequest.Client = myClient; insRequest.Policy = myPolicy; insRequest.Bank = myBank; insRequest.Loan = myLoan; var response = insuranceWebService.CreatePolicyByInsuranceRequest(insRequest); if (response.Success) { Console.WriteLine("Success"); } else { Console.WriteLine("Fail"); } Console.ReadKey(); }
public Response CreatePolicyByInsuranceRequest(Dictionary <string, object> parameters) { try { var insReq = new InsuranceRequest(); var sess = new SessionRequest(); var vehicle = new VehicleRequest(); var client = new ClientRequest(); var policy = new PolicyRequest(); var bank = new BankRequest(); var loan = new LoanRequest(); sess.Username = (String)parameters["username"]; sess.AuthenticationKey = (String)parameters["sess.AuthenticationKey"]; sess.Bordereaux = (bool)parameters["bordereaux"]; sess.Account = (String)parameters["account"]; sess.GuaranteeWarrantyDate = (DateTime)parameters["guarenteewarrantydate"]; sess.PaidByCard = (bool)parameters["paidbycard"]; sess.DeliveryDate = (DateTime)parameters["deliverydate"]; sess.LoanProvided = (bool)parameters["loanprovided"]; client.FirstName = (String)parameters["firstname"]; client.Surname = (String)parameters["surname"]; client.Title = (String)parameters["title"]; client.HouseNumber = (String)parameters["housenumber"]; client.Address = (String)parameters["address"]; client.Postcode = (String)parameters["postcode"]; client.Email = (String)parameters["email"]; client.Telephone = (String)parameters["telephone"]; client.IsCompany = (bool)parameters["iscompany"]; client.DateOfBirth = (DateTime)parameters["dateofbirth"]; policy.Description = (String)parameters["description"]; policy.Plan = (String)parameters["plan"]; policy.GrossPremium = (decimal)parameters["grosspremium"]; policy.Product = (String)parameters["product"]; policy.CoverPeriod = (int)parameters["coverperiod"]; policy.DatePISupplied = (DateTime)parameters["datepisupplied"]; policy.ExternalReference = (String)parameters["externalreference"]; policy.DateCustomerConfirmed = (DateTime)parameters["datecustomerconfirmed"]; vehicle.Make = (String)parameters["make"]; vehicle.Model = (String)parameters["model"]; vehicle.Registration = (String)parameters["registration"]; vehicle.Price = (decimal)parameters["price"]; vehicle.Mileage = (int)parameters["mileage"]; vehicle.DateRegistered = (DateTime)parameters["dateregistered"]; vehicle.EngineSize = (int)parameters["enginesize"]; vehicle.MOTDate = (DateTime)parameters["motdate"]; vehicle.Fuel = (String)parameters["fuel"]; vehicle.NewVehicle = (bool)parameters["newvehicle"]; vehicle.Motorcycle = (bool)parameters["motorcycle"]; bank.AccountName = (String)parameters["accountname"]; bank.AccountNumber = (String)parameters["accountnumber"]; bank.PaperlessDDI = (bool)parameters["paperlessddi"]; bank.PayeeAddress = (String)parameters["payeeaddress"]; bank.PayeeFirstName = (String)parameters["payeefirstname"]; bank.PayeeSurname = (String)parameters["payeesurname"]; bank.PayeeAddress = (String)parameters["payeehousenumber"]; bank.PayeePostcode = (String)parameters["payeepostcode"]; bank.PayeeTitle = (String)parameters["payeetitle"]; bank.SortCode = (String)parameters["sortcode"]; bank.PolicyHolderPaying = (bool)parameters["policyholderpaying"]; loan.Advance = (decimal)parameters["advance"]; loan.AdvanceRentals = (int)parameters["advancerentals"]; loan.LoanPayment = (decimal)parameters["loanpayment"]; loan.LoanTerm = (int)parameters["loanterm"]; loan.BorrowerName = (String)parameters["borrowername"]; loan.Lender = (String)parameters["lender"]; insReq.Session = sess; insReq.Client = client; insReq.Policy = policy; insReq.Vehicle = vehicle; insReq.Bank = bank; insReq.Loan = loan; var response = insuranceWebService.CreatePolicyByInsuranceRequest(insReq); return(MethodRespToObject(response)); } catch (Exception e) { Console.WriteLine(e.InnerException.Message); return(null); } }