public Tuple <APIMethodControl, string> DeleteCustomerPrivate(BasicStructure basic, string customerPrivateNumber) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var apc = new APIMethodControl(); var res = ""; var temp = FillBasic((int)FunctionList.DeleteCustomerPrivate, basic); temp.Add(customerPrivateNumber); var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString(text); if (keys[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[1]; apc.ErrorMessage = keys[2]; } else { apc.Succes = true; res = keys[0]; } return(Tuple.Create(apc, res)); } }
public Tuple <APIMethodControl, List <CustomerCompanyListItem> > GetCustomerCompanyNumbers(BasicStructure basic, DateTime?changeDateGreaterthan, int?maxAntal, int?startInterval) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var apc = new APIMethodControl(); var res = new List <CustomerCompanyListItem>(); var temp = FillBasic((int)FunctionList.GetCustomerCompanyNumbers, basic); if (changeDateGreaterthan != null) { temp.Add(Helpers.ConvertDateTimeToNovicellDateString(changeDateGreaterthan.Value)); temp.Add(Helpers.ConvertDateTimeToNovicellTime(changeDateGreaterthan.Value)); } else { temp.Add(""); temp.Add(""); } temp.Add(maxAntal?.ToString() ?? ""); temp.Add(startInterval?.ToString() ?? ""); var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString(text); if (keys.Any()) { if (keys[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[1]; apc.ErrorMessage = keys[2]; } else { apc.Succes = true; for (var i = 0; i < keys.Length; i += 2) { res.Add(new CustomerCompanyListItem() { CustomerCompanyNumber = keys[i], CompanyName = keys[i + 1] }); } } } else { apc.Succes = true; apc.Message = "No items returned!"; } return(Tuple.Create(apc, res)); } }
public Tuple <APIMethodControl, string> UpdateCustomerPrivate(BasicStructure basic, CustomerPrivate customerPrivate) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var apc = new APIMethodControl(); var res = ""; var temp = FillBasic((int)FunctionList.UpdateCustomerPrivate, basic); temp.Add(customerPrivate.CustomerPrivateNumber); temp.Add(customerPrivate.Brand); temp.Add(customerPrivate.FirstName); temp.Add(customerPrivate.LastName); temp.Add(customerPrivate.AdressLine1); temp.Add(customerPrivate.AdressLine2); temp.Add(customerPrivate.AdressLine3); temp.Add(customerPrivate.City); temp.Add(customerPrivate.ZipCode); temp.Add(customerPrivate.Country); temp.Add(customerPrivate.Email); temp.Add(customerPrivate.Phone); temp.Add(customerPrivate.DateOfBirth); temp.Add(customerPrivate.DriverLicenseNumber); temp.Add(customerPrivate.Comment); temp.Add(customerPrivate.Status.ToString()); temp.Add(customerPrivate.CommentToStatus); temp.Add((customerPrivate.CardType1)); temp.Add((customerPrivate.CardType2)); temp.Add((customerPrivate.CardType3)); temp.Add((customerPrivate.CompanyReference)); temp.Add(customerPrivate.AskNewsletter); temp.Add(customerPrivate.Newsletter); temp.Add(customerPrivate.Wintertires); temp.Add(customerPrivate.Wt_StarDate); temp.Add(customerPrivate.Wt_EndDate); temp.Add(customerPrivate.Wt_PricePrDay); temp.Add(customerPrivate.Wt_MaxPrice); var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString(text); if (keys[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[1]; apc.ErrorMessage = keys[2]; } else { apc.Succes = true; res = keys[0]; } return(Tuple.Create(apc, res)); } }
public Tuple <APIMethodControl, List <PriceListExtraItem> > GetPriceListExtra(BasicStructure basic, int locationId, string categoryId) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var priceEx = new List <PriceListExtraItem>(); var apc = new APIMethodControl(); var temp = FillBasic(basic); temp.Add(locationId.ToString()); temp.Add(categoryId.ToString()); temp.Add("EXTRA"); var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString(text); if ((keys.Length > 0) && (keys[0].ToLower() == errorstring)) { apc.Succes = false; apc.ErrorCode = keys[1]; apc.ErrorMessage = keys[2]; } else { apc.Succes = true; for (var i = 0; i < keys.Length; i += 4) { priceEx.Add(new PriceListExtraItem() { LocationId = keys[i + 0], ExtraProductId = Helpers.StringEmptyToInt(keys[i + 1]), ExtraDescription = keys[i + 2], ExtraPrice = keys[i + 3] }); } } return(Tuple.Create(apc, priceEx)); } }
public Tuple <APIMethodControl, DibsResultItem> DibsResult(BasicStructure basic, int bookingId, int paymentFlag, int paymentType, int paymentCode, int paymentAmount, int depositPaymentCode, int depositPaymentAmount) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var apc = new APIMethodControl(); var dibres = new DibsResultItem(); var temp = FillBasic(basic); temp.Add(bookingId.ToString()); temp.Add(paymentFlag.ToString()); temp.Add(paymentType.ToString()); temp.Add(paymentCode.ToString()); temp.Add(paymentAmount.ToString()); temp.Add(depositPaymentCode.ToString()); temp.Add(depositPaymentAmount.ToString()); var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString(text); if (keys[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[1]; apc.ErrorMessage = keys[2]; } else { apc.Succes = true; dibres.Result = keys[0]; dibres.OptionalTxt = keys[1]; } return(Tuple.Create(apc, dibres)); } }
/// <summary> /// GetFrontPageDefault /// </summary> /// <param name="basic"></param> /// <returns></returns> public Tuple <APIMethodControl, FrontPageDefault_PS> GetFrontPageDefault(BasicStructure basic) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var frontpagedefault = new FrontPageDefault_PS(); var temp = FillBasic(basic); var apc = new APIMethodControl(); var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString(text); if (keys[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[1]; apc.ErrorMessage = keys[2]; } else { apc.Succes = true; frontpagedefault.PickUpDate = keys[0]; frontpagedefault.PickupTime = keys[1]; frontpagedefault.ReturnDate = keys[2]; frontpagedefault.ReturnTime = keys[3]; frontpagedefault.MinAge = int.Parse(keys[4]); frontpagedefault.MaxAge = int.Parse(keys[5]); frontpagedefault.DefaultLocationNo = int.Parse(keys[6]); frontpagedefault.DefaultPickupTime = keys[7]; frontpagedefault.DefaultReturnTime = keys[8]; } return(Tuple.Create(apc, frontpagedefault));; } }
public Tuple <APIMethodControl, CustomerCompany> GetCustomerCompany(BasicStructure basic, string customerCompanyNumber) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var apc = new APIMethodControl(); var res = new CustomerCompany(); basic.CustomerId = customerCompanyNumber; var temp = FillBasic((int)FunctionList.GetCustomerCompany, basic); var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString(text); if (keys[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[1]; apc.ErrorMessage = keys[2]; } else { apc.Succes = true; res.CustomerCompanyNumber = keys[0]; res.Brand = keys[2]; res.CompanyName = keys[3]; res.AdressLine1 = keys[4]; res.AdressLine2 = keys[5]; res.AdressLine3 = keys[6]; res.City = keys[7]; res.ZipCode = keys[8]; res.Country = keys[9]; res.CompanyEmail = keys[10]; res.Phone = keys[11]; res.ContactName = keys[12]; res.ContactEmail = keys[13]; res.AgreementNumber = keys[14]; res.Comment = keys[15]; res.Status = (CustomerStatus)int.Parse(keys[16]); res.CommentToStatus = keys[17]; res.ChangeTimeStamp = keys[18]; res.GW_ContractNumber = keys[19]; res.GW_ParentContractNumber = keys[20]; res.IATANumber = keys[21]; res.DebitorNumber = keys[22]; res.CVRNumber = keys[23]; res.EANNumber = keys[24]; res.Fax = keys[25]; res.AccountResponsableSuperiorId = keys[26]; res.AccountResponsableLocaleId = keys[27]; res.BillingAddress1 = keys[28]; res.BillingAddress2 = keys[29]; res.BillingZipcode = keys[30]; res.BillingCity = keys[31]; res.BillingCountry = keys[32]; res.BillingEmail = keys[33]; res.CRMId = keys[34]; res.DiscountTerms = keys[35]; res.DiscountPercentEmployment = keys[36]; res.DiscountPercentTransport = keys[37]; res.DiscountPercentMiscellaneous = keys[38]; res.Insurance = keys[39]; res.RequisitionNumberMandatory = keys[40]; res.FullCredit = keys[41]; res.AttentionName = keys[42]; res.AskNewsletter = keys[43]; res.Newsletter = keys[44]; res.Wintertires = keys[45]; res.Wt_StarDate = keys[46]; res.Wt_EndDate = keys[47]; res.Wt_PricePrDay = keys[48]; res.Wt_MaxPrice = keys[49]; } return(Tuple.Create(apc, res)); } }
public Tuple <APIMethodControl, List <CustomerPrivate> > GetListCustomerPrivate(BasicStructure basic, List <string> customerPrivateNumbers) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var apc = new APIMethodControl(); var res = new List <CustomerPrivate>(); basic.CustomerId = ""; var temp = FillBasic((int)FunctionList.GetCustomerPrivate, basic); foreach (string number in customerPrivateNumbers) { temp.Add(number); } var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString(text); if (keys[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[1]; apc.ErrorMessage = keys[2]; } else { apc.Succes = true; for (var i = 0; i < keys.Length; i += 32) { res.Add(new CustomerPrivate() { CustomerPrivateNumber = keys[i], Brand = keys[i + 2], FirstName = keys[i + 3], LastName = keys[i + 4], AdressLine1 = keys[i + 5], AdressLine2 = keys[i + 6], AdressLine3 = keys[i + 7], City = keys[i + 8], ZipCode = keys[i + 9], Country = keys[i + 10], Email = keys[i + 11], Phone = keys[i + 12], DateOfBirth = keys[i + 13], DriverLicenseNumber = keys[i + 14], AgreementNumber = keys[i + 15], Comment = keys[i + 16], Status = (CustomerStatus)int.Parse(keys[i + 17]), CommentToStatus = keys[i + 18], ChangeTimeStamp = keys[i + 19], CRMId = keys[i + 20], CardType1 = keys[i + 21], CardType2 = keys[i + 22], CardType3 = keys[i + 23], CompanyReference = keys[i + 24], AskNewsletter = keys[i + 25], Newsletter = keys[i + 26], Wintertires = keys[i + 27], Wt_StarDate = keys[i + 28], Wt_EndDate = keys[i + 29], Wt_PricePrDay = keys[i + 30], Wt_MaxPrice = keys[i + 31] }); } } return(Tuple.Create(apc, res)); } }
public Tuple <APIMethodControl, CustomerPrivate> GetCustomerPrivate(BasicStructure basic, string customerPrivateNumber) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var apc = new APIMethodControl(); var res = new CustomerPrivate(); basic.CustomerId = customerPrivateNumber; var temp = FillBasic((int)FunctionList.GetCustomerPrivate, basic); var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString(text); if (keys[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[1]; apc.ErrorMessage = keys[2]; } else { apc.Succes = true; res.CustomerPrivateNumber = keys[0]; res.Brand = keys[2]; res.FirstName = keys[3]; res.LastName = keys[4]; res.AdressLine1 = keys[5]; res.AdressLine2 = keys[6]; res.AdressLine3 = keys[7]; res.City = keys[8]; res.ZipCode = keys[9]; res.Country = keys[10]; res.Email = keys[11]; res.Phone = keys[12]; res.DateOfBirth = keys[13]; res.DriverLicenseNumber = keys[14]; res.AgreementNumber = keys[15]; res.Comment = keys[16]; res.Status = (CustomerStatus)int.Parse(keys[17]); res.CommentToStatus = keys[18]; res.ChangeTimeStamp = keys[19]; res.CRMId = keys[20]; res.CardType1 = keys[21]; res.CardType2 = keys[22]; res.CardType3 = keys[23]; res.CompanyReference = keys[24]; res.AskNewsletter = keys[25]; res.Newsletter = keys[26]; res.Wintertires = keys[27]; res.Wt_StarDate = keys[28]; res.Wt_EndDate = keys[29]; res.Wt_PricePrDay = keys[30]; res.Wt_MaxPrice = keys[31]; } return(Tuple.Create(apc, res)); } }
public Tuple <APIMethodControl, string> UpdateCustomerCompany(BasicStructure basic, CustomerCompany customerCompany) { var apc = new APIMethodControl(); var res = ""; using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var temp = FillBasic((int)FunctionList.UpdateCustomerCompany, basic); temp.Add(customerCompany.CustomerCompanyNumber); temp.Add(customerCompany.Brand); temp.Add(customerCompany.CompanyName); temp.Add(customerCompany.AdressLine1); temp.Add(customerCompany.AdressLine2); temp.Add(customerCompany.AdressLine3); temp.Add(customerCompany.City); temp.Add(customerCompany.ZipCode); temp.Add(customerCompany.Country); temp.Add(customerCompany.CompanyEmail); temp.Add(customerCompany.Phone); temp.Add(customerCompany.ContactName); temp.Add(customerCompany.ContactEmail); temp.Add(customerCompany.AgreementNumber); temp.Add(customerCompany.Comment); temp.Add(customerCompany.Status.ToString()); temp.Add(customerCompany.CommentToStatus); temp.Add(customerCompany.IATANumber); temp.Add(customerCompany.DebitorNumber); temp.Add(customerCompany.CVRNumber); temp.Add(customerCompany.EANNumber); temp.Add(customerCompany.Fax); temp.Add(customerCompany.AccountResponsableSuperiorId); temp.Add(customerCompany.AccountResponsableLocaleId); temp.Add(customerCompany.BillingAddress1); temp.Add(customerCompany.BillingAddress2); temp.Add(customerCompany.BillingZipcode); temp.Add(customerCompany.BillingCity); temp.Add(customerCompany.BillingCountry); temp.Add(customerCompany.BillingEmail); temp.Add(customerCompany.CRMId); temp.Add(customerCompany.DiscountTerms); temp.Add(customerCompany.DiscountPercentEmployment); temp.Add(customerCompany.DiscountPercentTransport); temp.Add(customerCompany.DiscountPercentMiscellaneous); temp.Add(customerCompany.Insurance); temp.Add(customerCompany.RequisitionNumberMandatory); temp.Add(customerCompany.FullCredit); temp.Add(customerCompany.AttentionName); temp.Add(customerCompany.AskNewsletter); temp.Add(customerCompany.Newsletter); temp.Add(customerCompany.Wintertires); temp.Add(customerCompany.Wt_StarDate); temp.Add(customerCompany.Wt_EndDate); temp.Add(customerCompany.Wt_PricePrDay); temp.Add(customerCompany.Wt_MaxPrice); var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString(text); if (keys[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[1]; apc.ErrorMessage = keys[2]; } else { apc.Succes = true; res = keys[0]; } return(Tuple.Create(apc, res)); } }
public Tuple <APIMethodControl, List <CustomerCompany> > GetListCustomerCompany(BasicStructure basic, List <string> customerCompanyNumbers) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var apc = new APIMethodControl(); var res = new List <CustomerCompany>(); basic.CustomerId = ""; var temp = FillBasic((int)FunctionList.GetCustomerCompany, basic); foreach (string number in customerCompanyNumbers) { temp.Add(number); } var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString(text); if (keys[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[1]; apc.ErrorMessage = keys[2]; } else { apc.Succes = true; for (var i = 0; i < keys.Length; i += 50) { res.Add(new CustomerCompany() { CustomerCompanyNumber = keys[i], Brand = keys[i + 2], CompanyName = keys[i + 3], AdressLine1 = keys[i + 4], AdressLine2 = keys[i + 5], AdressLine3 = keys[i + 6], City = keys[i + 7], ZipCode = keys[i + 8], Country = keys[i + 9], CompanyEmail = keys[i + 10], Phone = keys[i + 11], ContactName = keys[i + 12], ContactEmail = keys[i + 13], AgreementNumber = keys[i + 14], Comment = keys[i + 15], Status = (CustomerStatus)int.Parse(keys[i + 16]), CommentToStatus = keys[i + 17], ChangeTimeStamp = keys[i + 18], GW_ContractNumber = keys[i + 19], GW_ParentContractNumber = keys[i + 20], IATANumber = keys[i + 21], DebitorNumber = keys[i + 22], CVRNumber = keys[i + 23], EANNumber = keys[i + 24], Fax = keys[i + 25], AccountResponsableSuperiorId = keys[i + 26], AccountResponsableLocaleId = keys[i + 27], BillingAddress1 = keys[i + 28], BillingAddress2 = keys[i + 29], BillingZipcode = keys[i + 30], BillingCity = keys[i + 31], BillingCountry = keys[i + 32], BillingEmail = keys[i + 33], CRMId = keys[i + 34], DiscountTerms = keys[i + 35], DiscountPercentEmployment = keys[i + 36], DiscountPercentTransport = keys[i + 37], DiscountPercentMiscellaneous = keys[i + 38], Insurance = keys[i + 39], RequisitionNumberMandatory = keys[i + 40], FullCredit = keys[i + 41], AttentionName = keys[i + 42], AskNewsletter = keys[i + 43], Newsletter = keys[i + 44], Wintertires = keys[i + 45], Wt_StarDate = keys[i + 46], Wt_EndDate = keys[i + 47], Wt_PricePrDay = keys[i + 48], Wt_MaxPrice = keys[i + 49], }); } } return(Tuple.Create(apc, res)); } }
public Tuple <APIMethodControl, List <PromotionInfo> > PromotionUpdate(BasicStructure basic, Price2 price) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var promotioninfos = new List <PromotionInfo>(); var apc = new APIMethodControl(); var temp = FillBasic(basic); temp.Add(price.locationId.ToString()); temp.Add(price.returnLocationId.ToString()); temp.Add(price.pickupDate); temp.Add(price.pickupTime); temp.Add(price.returnDate); temp.Add(price.returnTime); temp.Add(price.categoryId.ToString()); temp.Add(price.productId.ToString()); foreach (ExtraProduct ep in price.extras) { temp.Add(ep.id.ToString()); temp.Add(ep.numbUnit.ToString()); } var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString(text); if (keys[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[1]; apc.ErrorMessage = keys[2]; } else { apc.Succes = true; for (var i = 0; i < keys.Length; i += 20) { promotioninfos.Add(new PromotionInfo() { Total = keys[i + 0], DepositOnline = keys[i + 1], DepositCash = keys[i + 2], DepositCreditCard = keys[i + 3], TotalDepositOnline = keys[i + 4], TotalDepositCash = keys[i + 5], TotalDepositCreditCard = keys[i + 6], TotalExtraPrice = keys[i + 7], TotalExclusiveTotalExtraPrice = keys[i + 8], BookStatus = Helpers.StringEmptyToInt(keys[i + 9]), BookStatusText = keys[i + 10], PayCashOnCollectFlag = Helpers.StringEmptyToInt(keys[i + 11]), PayCardOnCollectFlag = Helpers.StringEmptyToInt(keys[i + 12]), PayOnlineFlag = Helpers.StringEmptyToInt(keys[i + 13]), DepositDescription = keys[i + 14], RentPricePrDay = keys[i + 15], Promotion = keys[i + 16], PromotionText = keys[i + 17], TotalExclPromotion = keys[i + 18], PickupText = keys[i + 19], }); } } return(Tuple.Create(apc, promotioninfos)); } }
/// <summary> /// Function 01 GetCarsList /// </summary> /// <param name="basic"></param> /// <param name="LocationId"></param> /// <returns></returns> public Tuple <APIMethodControl, List <CarListItem> > GetCarsList(BasicStructure basic, int LocationId) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var carListItems = new List <CarListItem>(); var apc = new APIMethodControl(); var temp = FillBasic(basic); temp.Add(LocationId.ToString()); var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString(text); if ((keys.Length > 1) && (keys[0] != string.Empty)) { for (var i = 0; i < keys.Length; i += 18) { Debug.WriteLine(string.Format("i={0},loc={1}", i, keys[i])); string _locationId = keys[i]; string _BilTypeKode = keys[i + 1]; string _BilTypeNavn = keys[i + 2]; string _BilGruppe = keys[i + 3]; string _BilGruppeNavn = keys[i + 4]; string _Evt_extra_beskr = keys[i + 5]; string _Evt_extra_beskr2 = keys[i + 6]; string _Kolonne1opl = keys[i + 7]; string _Kolonne2opl = keys[i + 8]; string _Kolonne3opl = keys[i + 9]; string _Kolonne4opl = keys[i + 10]; string _Kolonne5opl = keys[i + 11]; string _Kolonne6opl = keys[i + 12]; string _Kolonne7opl = keys[i + 13]; string _Kolonne8opl = keys[i + 14]; string _Kolonne9opl = keys[i + 15]; string _Kolonne10extra = keys[i + 16]; string _Kolonne11bilmodel = keys[i + 17]; carListItems.Add(new CarListItem() { Stationnr = _locationId , BilTypeKode = _BilTypeKode , BilTypeNavn = _BilTypeNavn , BilGruppe = _BilGruppeNavn , BilGruppeNavn = _BilGruppeNavn , Evt_extra_beskr = _Evt_extra_beskr , Evt_extra_beskr2 = _Evt_extra_beskr2 , Kolonne1opl = _Kolonne1opl , Kolonne2opl = _Kolonne2opl , Kolonne3opl = _Kolonne3opl , Kolonne4opl = _Kolonne4opl , Kolonne5opl = _Kolonne5opl , Kolonne6opl = _Kolonne6opl , Kolonne7opl = _Kolonne7opl , Kolonne8opl = _Kolonne8opl , Kolonne9opl = _Kolonne9opl , Kolonne10extra = _Kolonne10extra , Kolonne11bilmodel = _Kolonne11bilmodel }); } } if (keys[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[1]; apc.ErrorMessage = keys[2]; } else { apc.Succes = true; } return(Tuple.Create(apc, carListItems)); } }
/// <summary> /// SubmitRental /// </summary> /// <param name="basic"></param> /// <param name="rent"></param> /// <returns></returns> public Tuple <APIMethodControl, RentalInfo> SubmitRental(BasicStructure basic, Rental_PS rent) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var info = new RentalInfo(); var apc = new APIMethodControl(); var temp = FillBasic(basic); temp.Add(rent.locationId.ToString()); temp.Add(rent.returnLocationId.ToString()); temp.Add(rent.productId.ToString()); temp.Add(rent.pickupDate); temp.Add(rent.pickupTime); temp.Add(rent.returnDate); temp.Add(rent.returnTime); temp.Add(rent.categoryId.ToString()); temp.Add(rent.coRenterName.ToString()); temp.Add(rent.coRenterSurName.ToString()); temp.Add(rent.coRenterLicenseNo.ToString()); temp.Add(rent.coRenterBirthDay.ToString()); temp.Add(rent.rekvisitionNo.ToString()); temp.Add(rent.payType.ToString()); for (int i = 0; i < 10; i++) { try { temp.Add(rent.drivers[i].ToString()); } catch { temp.Add(""); } } temp.Add(rent.bookStatus.ToString()); temp.Add(rent.renterName.ToString()); temp.Add(rent.renterBirthDay.ToString()); temp.Add(rent.renterAddress.ToString()); temp.Add(rent.renterZipCity.ToString()); temp.Add(rent.renterPhone.ToString()); temp.Add(rent.renterEmail.ToString()); foreach (ExtraProduct ep in rent.extras) { temp.Add(ep.id.ToString()); temp.Add(ep.numbUnit.ToString()); } var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString(text); if (keys[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[1]; apc.ErrorMessage = keys[2]; } else { apc.Succes = true; info.ReservationNo = keys[0]; info.TotalPrice = keys[1]; info.DepositOnline = keys[2]; info.DepositPickupCash = keys[3]; info.DepositPickupCard = keys[4]; info.RentPlusDepositOnline = keys[5]; info.RentPlusDepositPickupCash = keys[6]; info.RentPlusDepositPickupCard = keys[7]; info.AddOnsTotalPrice = keys[8]; info.TotalPriceExclAddOnsTotalPrice = keys[9]; } return(Tuple.Create(apc, info)); } }
/// <summary> /// 03 GetAvailabillityList /// </summary> /// <param name="basic"></param> /// <param name="LocationId"></param> /// <param name="ProductId"></param> /// <param name="ReturnLlocationId"></param> /// <param name="CategoryId"></param> /// <param name="PickupDate"></param> /// <param name="ReturnDate"></param> /// <param name="PickupTime"></param> /// <param name="returnTime"></param> /// <param name="Age"></param> /// <returns></returns> public Tuple <APIMethodControl, List <AvailabillityItem_PS> > GetAvaiabillityList(BasicStructure basic, int locationId, int productId, int returnLocationId, string categoryId, string pickupDate, string returnDate, string pickupTime, string returnTime, int age) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var locationListItems = new List <AvailabillityItem_PS>(); var apc = new APIMethodControl(); var temp = FillBasic(basic); temp.Add(locationId.ToString()); temp.Add(productId.ToString()); temp.Add(returnLocationId.ToString()); temp.Add(categoryId.ToString()); temp.Add(pickupDate); temp.Add(returnDate); temp.Add(pickupTime); temp.Add(returnTime); temp.Add(age.ToString()); var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString2(text); if (keys[0].Data[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[0].Data[1]; apc.ErrorMessage = keys[0].Data[2]; } else { if (keys.Count > 0) { apc.Succes = true; foreach (ReceivedLine line in keys) { var ps = new AvailabillityItem_PS(); //for (int i = 0; i < line.ListInLIstIndex; i++) //{ ps.locationOut = int.Parse(line.Data[0]); ps.carType = line.Data[1]; ps.carGroup = line.Data[2]; ps.locationIn = int.Parse(line.Data[3]); ps.pickupDate = line.Data[4]; ps.returnDate = line.Data[5]; ps.pickupTime = line.Data[6]; ps.returnTime = line.Data[7]; ps.duration = int.Parse(line.Data[8]); ps.productId = int.Parse(line.Data[9]); ps.productName = line.Data[10]; ps.productInclText = line.Data[11]; ps.productFilRef = line.Data[12]; ps.productInclKm = line.Data[13]; ps.productExtraKm = line.Data[14]; ps.productDurableText = line.Data[15]; ps.pickupText = line.Data[16]; ps.returnText = line.Data[17]; ps.inviteText = line.Data[18]; ps.bookStatus = int.Parse(line.Data[19]); ps.bookStatusTekst = line.Data[20]; ps.rentPricePrDay = line.Data[21]; ps.rentTotalPrice = line.Data[22]; ps.payPickupCashFlag = int.Parse(line.Data[23]); ps.depositPickupCash = line.Data[24]; ps.payPickupCardFlag = int.Parse(line.Data[25]); ps.depositPickupCard = line.Data[26]; ps.payOnlineFlag = int.Parse(line.Data[27]); ps.depositDescription = line.Data[28]; var bcs = new List <object>(); for (int i = line.Data.Length - 1; i > line.ListInLIstIndex; i--) { if (line.Data[i].ToUpper() == "CHECKBOX") { //7 strings var chkbox = new Checkbox() { ProductId = line.Data[i - 7], Description = line.Data[i - 6], Enabled = Helpers.ConvertStringToBool(line.Data[i - 1]), Price = line.Data[i - 4], TypeName = "CHECKBOX" }; bcs.Add(chkbox); //Recalc i = i - 7; } if (line.Data[i].ToUpper() == "DROPDOWNEXTRA") { var ddlitem = new DropDownList() { TypeName = "DROPDOWNEXTRA" }; var ddllist = new List <ddlItem>(); int res = 0; do { int.TryParse(line.Data[i - 5], out res); var dditem0 = new ddlItem() { ElementId = line.Data[i - 3], ElementText = line.Data[i - 2], ElementPrice = line.Data[i - 1] }; ddllist.Add(dditem0); i = i - 3; } while (res <= 0); ddlitem.ddlItems = ddllist; ddlitem.SelectedElement = line.Data[i - 1]; ddlitem.NoOfElements = int.Parse(line.Data[i - 2]); ddlitem.Description = line.Data[i - 3]; ddlitem.ProductId = line.Data[i - 4]; bcs.Add(ddlitem); } } // var chkbox = new Checkbox() { ProductId = "12", Description = "3434", enabled = true, TypeName = "CHECKBOX" }; // bcs.Add(chkbox); // var dditem0 = new ddlItem() { ElementId = 1, ElementPrice = "90", ElementText = "ggg1" }; // var dditem1 = new ddlItem() { ElementId = 2, ElementPrice = "91", ElementText = "ggg2" }; // var dditem2 = new ddlItem() { ElementId = 3, ElementPrice = "92", ElementText = "ggg3" }; // var ddllist = new List<ddlItem>(); // ddllist.Add(dditem0); // ddllist.Add(dditem1); // ddllist.Add(dditem2); // var ddlitem = new DropDownList() { ProductId = "23", Description = "prod 23", TypeName = "DROPDOWN", ddlItems = ddllist }; // bcs.Add(ddlitem); ps.ekstras = bcs; locationListItems.Add(ps); //} } } } return(Tuple.Create(apc, locationListItems)); } }
/// <summary> /// Function 02 GetPriceList /// </summary> /// <param name="basic"></param> /// <param name="LocationId"></param> /// <param name="CategoryId"></param> /// <param name="Extra"></param> /// <returns></returns> public Tuple <APIMethodControl, List <PriceListItem> > GetPriceList(BasicStructure basic, int locationId, string categoryId) { using (var context = WebAPIManagerFactory.CreateContext(ip7913, port7913, _logfile)) { var priceListItems = new List <PriceListItem>(); var apc = new APIMethodControl(); var temp = FillBasic(basic); temp.Add(locationId.ToString()); temp.Add(categoryId.ToString()); var str = Helpers.EncodeString(temp.ToArray()); var text = context.GetData(str); var keys = Helpers.DecodeString2(text); if (keys[0].Data[0].ToLower() == errorstring) { apc.Succes = false; apc.ErrorCode = keys[0].Data[1]; apc.ErrorMessage = keys[0].Data[2]; } else { apc.Succes = true; foreach (ReceivedLine rl in keys) { var ppi = new List <PriceProductItem>(); string _locationId = rl.Data[0]; string _carType = rl.Data[1]; string _carGroup = rl.Data[2]; string _carGroupFileRef = rl.Data[3]; string _carGroupspecialTopText = rl.Data[4]; for (int i = rl.ListInLIstIndex; i < rl.Data.Length; i += 5) { string _code = rl.Data[i]; string _text = rl.Data[i + 1]; string _price = rl.Data[i + 2]; string _extrakmpris = rl.Data[i + 3]; string _evttekst = rl.Data[i + 4]; ppi.Add(new PriceProductItem() { Code = _code, Text = _text, Price = _price, ExtraKmPrice = _extrakmpris, EvtText = _evttekst }); } priceListItems.Add(new PriceListItem() { LocationId = _locationId, CarType = _carType, CarGroup = _carGroup, CarGroupFilRef = _carGroupFileRef, CarGroupSpecialTopText = _carGroupspecialTopText, CarGroupSpecialBottomText = "", PriceProductLines = ppi }); } } return(Tuple.Create(apc, priceListItems)); } }