private void PopulateStateDropDown() { dnlMunicipal.Enabled = false; dnlTown.Enabled = false; Providers.Interfaces.IShippingProvider provider = null; if (Locale == "es-AR") { provider = ProductsBase.GetShippingProvider() as ShippingProvider_AR; } if (provider != null) { var states = provider.GetStatesForCountry(this.CountryCode); if (Locale == "es-AR") { var arStates = new List <string>(); if (states != null && states.Count > 0) { foreach (var province in states) { string[] state = province.Split('-'); arStates.Add(state[0]); } states = arStates; } } dnlState.DataSource = states; dnlState.DataBind(); dnlState.Items.Insert(0, new ListItem(GetLocalResourceObject("Select.Text") as string, "0")); dnlState.SelectedIndex = 0; } }
public void OnPickupPreferenceDeleted(object sender, EventArgs e) { var args = e as DeliveryOptionEventArgs; if (args != null) { _pickupRrefList = (Page as ProductsBase).GetShippingProvider() .GetPickupLocationsPreferences((Page as ProductsBase).DistributorID, (Page as ProductsBase).CountryCode); if (_pickupRrefList.Count > 0) { PickupLocationPreference_V01 pref = _pickupRrefList.First(); updateShippingInfo(ProductsBase.ShippingAddresssID, pref.PickupLocationID, DeliveryOptionType.PickupFromCourier); } else { ProductsBase.ClearCart(); } populateDropdown(); } // ucShippingInfoControl.Hide(); reload(); if (_pickupRrefList.Count == 0) { setAddressByNickName(null); ProductsBase.ClearCart(); } }
private void PopulateTownDropDown(DropDownList dnlTown) { Providers.Interfaces.IShippingProvider provider = null; if (Locale == "es-AR") { provider = ProductsBase.GetShippingProvider() as ShippingProvider_AR; } if (provider != null) { string stateSelected = dnlState.SelectedValue; var towns = (Thread.CurrentThread.CurrentCulture.Name == "es-MX") ? provider.GetStreetsForCity(CountryCode, stateSelected, dnlMunicipal.SelectedValue) : provider.GetCountiesForCity(CountryCode, stateSelected, dnlMunicipal.SelectedValue); dnlTown.DataSource = towns; dnlTown.DataBind(); dnlTown.Items.Insert(0, new ListItem(GetLocalResourceObject("Select.Text") as string, "0")); dnlTown.Enabled = true; dnlTown.SelectedIndex = 0; } if (Locale == "es-AR") { // If AR disable the neightborhood dropdown when no data dnlTown.Enabled = dnlTown.Items.Count > 1; } }
protected override bool setAddressByNickName(ShippingAddress_V01 address, HtmlGenericControl pAddress, DropDownList deliveryType) { pAddress.Visible = address != null; if (address != null) { DeliveryOptionType option = getDeliveryOptionTypeFromDropdown(deliveryType); if ((option == DeliveryOptionType.Unknown && CheckNoDeliveryType(deliveryType)) || option == DeliveryOptionType.ShipToCourier) { option = DeliveryOptionType.Shipping; } pAddress.InnerHtml = ProductsBase.GetShippingProvider() .FormatShippingAddress(new DeliveryOption(address), option, ShoppingCart != null && ShoppingCart.DeliveryInfo != null ? ShoppingCart.DeliveryInfo.Description : string.Empty, true); if (CheckNoDeliveryType(deliveryType) && !string.IsNullOrEmpty(pAddress.InnerHtml)) { return(true); } } else { pAddress.InnerHtml = ""; } return(false); }
protected override void showHideAddressLink() { lnAddAddress.Visible = ProductsBase.GetShippingProvider().NeedEnterAddress(DistributorID, Locale) && ShoppingCart.DeliveryInfo == null; if ((_shippingAddresses.Count == 0 && getDeliveryOptionTypeFromDropdown(DeliveryType) == DeliveryOptionType.Shipping) || (_pickupRrefList.Count == 0 && getDeliveryOptionTypeFromDropdown(DeliveryType) == DeliveryOptionType.Pickup)) { lnAddAddress.Visible = true; } if (lnAddAddress.Visible == false) { if (IsStatic == false) { pnlDeliveryOptionSelection.Visible = !lnAddAddress.Visible; divNicknameInfoAndLink.Visible = true; } } else { pnlReadonlyDeliveryOptionSelection.Visible = false; divNicknameInfoAndLink.Visible = false; lnAddAddress.Text = getDeliveryOptionTypeFromDropdown(DeliveryType) == DeliveryOptionType.Shipping ? (string)GetLocalResourceObject("AddShippingAddress") : (string)GetLocalResourceObject("SelectPickup"); } }
private void loadAddressEditMode() { int id = 0; if (DropdownNickName.SelectedIndex >= 0) { if (int.TryParse(DropdownNickName.SelectedValue, out id)) { DeliveryOption deliveryOption = getSelectedAddress(id, (DeliveryOptionType) Enum.Parse(typeof(DeliveryOptionType), DeliveryType.SelectedValue)); if (deliveryOption != null) { pAddress.InnerHtml = ProductsBase.GetShippingProvider() .FormatShippingAddress(deliveryOption, getDeliveryOptionTypeFromDropdown( DeliveryType), ShoppingCart != null && ShoppingCart.DeliveryInfo != null ? ShoppingCart.DeliveryInfo .Description : string.Empty, true); } } } }
private void RenderDeletePickupView() { lblHeader.Visible = false; divAddPickUp.Visible = false; divDeletePickUp.Visible = true; HideSelected(); btnContinue.Text = GetLocalResourceObject("btnDeleteResource.Text") as string; var shipAddr = new ShippingAddress_V01(); shipAddr.Address = new Address_V01(); shipAddr.Address.Country = CountryCode; var deliveryType = HLConfigManager.Configurations.PickupOrDeliveryConfiguration.AllowPickUpFromCourier ? DeliveryOptionType.PickupFromCourier : DeliveryOptionType.ShipToCourier; List <PickupLocationPreference_V01> pickUpLocationPreferences = ProductsBase.GetShippingProvider() .GetPickupLocationsPreferences(DistributorID, CountryCode, Locale, deliveryType); PickupLocationPreference_V01 selectedPickupPreference = pickUpLocationPreferences.Find (p => p.PickupLocationID == WorkedUponDeliveryOptionId); lblName.Text = PickupLocationDescription; lblDeleteIsPrimaryText.Text = selectedPickupPreference.IsPrimary ? GetLocalResourceObject("PrimaryYes.Text") as string : GetLocalResourceObject("PrimaryNo.Text") as string; lblDeleteNicknameText.Text = selectedPickupPreference.PickupLocationNickname; divLocation.Visible = false; divPrimary.Visible = false; btnContinue.Enabled = true; if (pickUpLocationPreferences.Count == 1) { lblErrors.Text = GetLocalResourceObject("LastPickupAddress.Text") as string; } }
private void UpdateViewChanges(int selected) { var pickupLocationId = GetSelected(selected); if (pickupLocationId < 0) { lblErrors.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoPickUpLocation"); return; } bool isPrimary = cbMakePrimary.Checked; bool isSession = !HLConfigManager.Configurations.CheckoutConfiguration.SavePickupFromCourierPreferences; string nickName = ViewState["DisplayName"] as string ?? string.Empty; string branchName = ViewState["BranchName"] as string ?? string.Empty; int returnId = ProductsBase.GetShippingProvider() .SavePickupLocationsPreferences(DistributorID, isSession, pickupLocationId, nickName, nickName, CountryCode, isPrimary, branchName); if (returnId == -2) //duplicate nickname { lblErrors.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "DuplicateAddressNickname"); return; } if (returnId == -3) //duplicate pickuplocation { lblErrors.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "DuplicatePickupLocation"); return; } OnPickupPreferenceCreated(this, new DeliveryOptionEventArgs(returnId, branchName)); }
protected void Page_Load(object sender, EventArgs e) { _page = Page as ProductsBase; _paymentsConfig = HLConfigManager.Configurations.PaymentsConfiguration; _enableInstallments = _paymentsConfig.EnableInstallments; installmentCards = new List <CardInfo>(); GetCardsList(); if (_cards != null) { installmentCards = _cards.Card.FindAll(c => c.InstallmentFees.Count > 0); if (!IsPostBack) { if (installmentCards.Count > 0) { ddlCards.DataSource = installmentCards; ddlCards.DataBind(); RecalcPage(); upInstallments.Update(); onPaymentInfoChanged(this, null); } } } }
/// <summary> /// ProcessAddShippingSubmit - click on continue on new shipping address /// </summary> /// <param name="button"></param> protected void ProcessAddShippingSubmit() { bool isNicknameEntered = false; string distributorID = DistributorID; string locale = Locale; bool toSession = cbSaveThis.Checked ? false : true; WorkedUponAddress.ID = -1; IShippingProvider shippingProvider = (this.Page as ProductsBase).GetShippingProvider(); var addressList = GetShippingAddressesFromDeliveryOptions( shippingProvider.GetShippingAddresses(distributorID, locale)); // EMPTY IS ALLOWED OTHERWISE YOU COULD GET BUG 24224 for duplicates // if (!this.txtNickname.Text.Equals(String.Empty)) { WorkedUponAddress.Alias = txtNickname.Text.Trim(); isNicknameEntered = true; } try { //1) Submit validated chnages to Shippping Provider WorkedUponAddress.ID = ProductsBase.GetShippingProvider().SaveShippingAddress (distributorID, locale, WorkedUponAddress , toSession , true , isNicknameEntered); } finally { } if (WorkedUponAddress.ID == -2) //duplicateShippingAddress { trError.Visible = true; blErrors.Items.Add( new ListItem(PlatformResources.GetGlobalResourceString("ErrorMessage", "AddressExists"))); return; } if (WorkedUponAddress.ID == -3) //duplicateNickName { trError.Visible = true; blErrors.Items.Add( new ListItem(PlatformResources.GetGlobalResourceString("ErrorMessage", "DuplicateAddressNickname"))); return; } else { WorkedUponAddress.DisplayName = WorkedUponAddress.Alias == string.Empty ? shippingProvider.GetAddressDisplayName(WorkedUponAddress) : WorkedUponAddress.Alias; ShoppingCart.CopyInvoiceStatus = ServiceProvider.CatalogSvc.CopyInvoiceStatus.success; Session["IsCopingFromInvoice"] = null; OnShippingAddressCreated(this, new ShippingAddressEventArgs(distributorID, WorkedUponAddress, false, false)); //popup_AddEditShippingControl.Hide(); } }
private void PopulateStateDropDown() { dnlState.Items.Clear(); var states = new List <string>(); var provider = ProductsBase.GetShippingProvider(); if (provider != null) { if (ProductsBase.CountryCode == "US") { var providerUS = ProductsBase.GetShippingProvider() as ShippingProvider_US; if (providerUS != null) { states = providerUS.GetStatesForCountryToDisplay(ProductsBase.CountryCode); } } else { states = provider.GetStatesForCountry(ProductsBase.CountryCode); } if (states.Count > 0) { var items = (from state in states select new ListItem { Text = state, Value = state.Substring(0, 2) }).ToArray(); dnlState.Items.AddRange(items); dnlState.Items.Insert(0, new ListItem(GetLocalResourceObject("Select.Text") as string, "0")); dnlState.SelectedIndex = 0; } } }
protected virtual bool hasNoPreference() { IShippingProvider ShippingProvider = ProductsBase.GetShippingProvider(); List <DeliveryOption> shippingAddresses = ShippingProvider.GetShippingAddresses(DistributorID, Locale); return(shippingAddresses == null || shippingAddresses.Count == 0); }
/// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary> /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param> /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> public static void BindService(grpc::ServiceBinderBase serviceBinder, ProductsBase serviceImpl) { serviceBinder.AddMethod(__Method_GetProducts, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod <global::OrdersService.FilterProductDto, global::OrdersService.ProductDto>(serviceImpl.GetProducts)); serviceBinder.AddMethod(__Method_GetProduct, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::OrdersService.ProductIdDto, global::OrdersService.ProductDto>(serviceImpl.GetProduct)); serviceBinder.AddMethod(__Method_Add, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::OrdersService.AddedProductDto, global::OrdersService.ProductDto>(serviceImpl.Add)); serviceBinder.AddMethod(__Method_Update, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::OrdersService.ProductDto, global::OrdersService.UpdatedResultDto>(serviceImpl.Update)); serviceBinder.AddMethod(__Method_Delete, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::OrdersService.ProductIdDto, global::OrdersService.UpdatedResultDto>(serviceImpl.Delete)); }
/// <summary>Creates service definition that can be registered with a server</summary> /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> public static grpc::ServerServiceDefinition BindService(ProductsBase serviceImpl) { return(grpc::ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_GetProducts, serviceImpl.GetProducts) .AddMethod(__Method_GetProduct, serviceImpl.GetProduct) .AddMethod(__Method_Add, serviceImpl.Add) .AddMethod(__Method_Update, serviceImpl.Update) .AddMethod(__Method_Delete, serviceImpl.Delete).Build()); }
public void OnShowBackorderMessages(object sender, EventArgs e) { var args = e as ShowBackorderMessagesEventArgs; if (args != null) { ProductsBase.ShowBackorderMessage(args.BackorderMessages); } }
/// <summary> /// The do cart empty. /// </summary> private void doCartEmpty() { if (ShoppingCart != null) { if (!ShoppingCart.CartItems.Count.Equals(0)) { ProductsBase.ClearCart(); } } }
protected string getAmountString(decimal amount, bool useAlternateCurrencySymbol) { string symbol = GetSymbol(useAlternateCurrencySymbol); return(HLConfigManager.Configurations.CheckoutConfiguration.CurrencySymbolPosition == CheckoutConfiguration.CurrencySymbolLayout.Leading ? (HLConfigManager.Configurations.CheckoutConfiguration.UseUSPricesFormat ? symbol + amount.ToString("N", CultureInfo.GetCultureInfo("en-US")) : symbol + string.Format(ProductsBase.GetPriceFormat(amount), amount)) : string.Format(ProductsBase.GetPriceFormat(amount), amount) + symbol); }
private void OrderSubmitted(Order_V01 order, string orderNumber) { var currentSession = SessionInfo; currentSession.OrderNumber = orderNumber; if (ShoppingCart.CustomerOrderDetail != null) { SettleCustomerOrderPayment(orderNumber); } SessionInfo.SetSessionInfo(DistributorID, Locale, currentSession); ProductsBase.ResetInventoryView(); }
private void PopulatePickupInfoDataList() { Providers.Interfaces.IShippingProvider provider = null; if (Thread.CurrentThread.CurrentCulture.Name == "es-MX") { provider = ProductsBase.GetShippingProvider() as ShippingProvider_MX; } else if (Thread.CurrentThread.CurrentCulture.Name == "es-AR") { provider = ProductsBase.GetShippingProvider() as ShippingProvider_AR; } if (provider != null) { var shippingAddress = new ShippingAddress_V02(); var address = new Address_V01(); address.PostalCode = ViewState["PostalCode"].ToString(); shippingAddress.Address = address; List <DeliveryOption> pickupOptions = provider.GetDeliveryOptions(DeliveryOptionType.Pickup, shippingAddress); if (pickupOptions != null) { divLocations.Visible = true; dlPickupInfo.DataSource = ( from o in pickupOptions orderby o.Description select new { ID = o.Id, IsPickup = true, Description = new Func <string>(() => { GetImage(o.Description.ToUpper()); return(o.Description.ToUpper().ToString()); })(), BranchName = o.Name, o.FreightCode, Warehouse = o.WarehouseCode, o.Address } ); dlPickupInfo.DataBind(); } if (pickupOptions.Count.Equals(0)) { divLocations.Visible = false; } } }
protected override void LoadData() { _shippingAddresses = ShippingProvider.GetShippingAddresses(DistributorID, Locale); _pickupLocations = ShippingProvider.GetDeliveryOptions(DeliveryOptionType.Pickup, ShippingProvider.GetDefaultAddress()); if (HLConfigManager.Configurations.PickupOrDeliveryConfiguration.AllowPickUpFromCourier) { _pickupRrefList = ProductsBase.GetShippingProvider() .GetPickupLocationsPreferences(DistributorID, CountryCode); } }
private void PopulateMunicipalDropDown(DropDownList dnlMunicipal) { Providers.Interfaces.IShippingProvider provider = null; if (Locale == "es-AR") { provider = ProductsBase.GetShippingProvider() as ShippingProvider_AR; } if (provider != null) { dnlMunicipal.DataSource = provider.GetCitiesForState(CountryCode, dnlState.SelectedValue); dnlMunicipal.DataBind(); dnlMunicipal.Items.Insert(0, new ListItem(GetLocalResourceObject("Select.Text") as string, "0")); dnlMunicipal.Enabled = true; dnlMunicipal.SelectedIndex = 0; } }
protected override void loadData() { _shippingAddresses = ShippingProvider.GetShippingAddresses(DistributorID, Locale); // Retrieve the pickupoption from the cache, not hardcoded to pickup, unless nothing is loaded, so use default _pickupLocations = ShippingProvider.GetDeliveryOptions(DeliveryOptionType.Pickup, ShippingProvider.GetDefaultAddress()); _pickupRrefList = ProductsBase.GetShippingProvider() .GetPickupLocationsPreferences(DistributorID, CountryCode); // Showing the right options according xml configurations. if (!HLConfigManager.Configurations.PickupOrDeliveryConfiguration.AllowPickUpFromCourier && DeliveryType.Items.FindByValue("PickupFromCourier") != null) { DeliveryType.Items.Remove(DeliveryType.Items.FindByValue("PickupFromCourier")); } }
protected void DeleteSKUSFromCart(object sender, EventArgs e) { if (!skuList.Any()) { List <string> messagesx = new List <string>(); messagesx = (List <string>)Session["messagesToShow"]; var skus = messagesx.Where(c => c.Contains("-SKU:")).Distinct().ToList(); foreach (var sku in skus) { skuList.Add(sku.Replace("-SKU:", "")); } } ProductsBase.DeleteItemsFromCart(skuList); Session["showedMessages"] = null; addPromoSkuPopupExtender.Hide(); }
private void RenderDeletePickupView() { lblHeader.Visible = false; divAddPickupLocation.Visible = false; divDeletePickupLocation.Visible = true; List <PickupLocationPreference_V01> pickUpLocationPreferences = ProductsBase.GetShippingProvider().GetPickupLocationsPreferences(DistributorID, CountryCode, Locale, DeliveryOptionType.PickupFromCourier); PickupLocationPreference_V01 selectedPickupPreference = pickUpLocationPreferences.Find(p => p.PickupLocationID == WorkedUponDeliveryOptionId); //lblDeleteNicknameText.Text = selectedPickupPreference.PickupLocationNickname; if (pickUpLocationPreferences.Count == 1 && ShoppingCart.CartItems.Count > 0) { lblErrors.Text = GetLocalResourceObject("LastPickupAddress.Text") as string; } }
private void PopulatePickupInfoDataList() { var provider = ProductsBase.GetShippingProvider() as ShippingProvider_PT; if (provider != null) { var shippingAddress = new ShippingAddress_V02 { Address = new Address_V01 { Country = "PT", StateProvinceTerritory = dnlRegion.Text } }; var pickupOptions = provider.GetDeliveryOptions(DeliveryOptionType.PickupFromCourier, shippingAddress); if (pickupOptions != null) { divLocations.Visible = true; dlPickupInfo.DataSource = ( from o in pickupOptions where o.State == dnlRegion.Text select new { ID = o.Id, IsPickup = true, IsWaldos = false, BranchName = o.Description, o.FreightCode, Warehouse = o.WarehouseCode, o.Address, o.Information } ); dlPickupInfo.DataBind(); } if (pickupOptions.Count.Equals(0)) { divLocations.Visible = false; } } }
public void OnShippingInfoNotFilled(object sender, EventArgs e) { if (ProductsBase.NeedEnterAddress()) { AddAddressClicked(lnAddAddress, e); } else { DeliveryOptionType currentOption = getDeliveryOptionTypeFromDropdown(DeliveryType); string message = PlatformResources.GetGlobalResourceString("ErrorMessage", "ShippingNickNameNotPopulated"); if (currentOption == DeliveryOptionType.Pickup) { message = PlatformResources.GetGlobalResourceString("ErrorMessage", "PickUpNickNameNotPopulated"); } (ProductsBase.Master as OrderingMaster).Status.AddMessage(message); } }
protected void Page_Load(object sender, EventArgs e) { if (IsChinaApp) { string msgChk24h = GetLocalResourceObject("ProductsChkOutWithin24Hours") as string; lblChkout24hMessage.Text = msgChk24h.Replace("\r\n", @"<br/>").Replace(" ", @" "); if (IsPostBack) { if ((AddToCartControlList != null) && (AddToCartControlList.Count > 0)) { var postbackCause = Request.Params["__EVENTTARGET"]; if (!string.IsNullOrWhiteSpace(postbackCause)) { var postbackCtrl = this.Page.FindControl(postbackCause); if (postbackCtrl != null) { if (AddToCartControlList.Any(x => x == postbackCtrl)) { var deliveryTypeUiId = Page.Request.Form["uiId_BrGrOrderQuickView_DeliveryType"]; // Ordering\Controls\BrGrOrderQuickView.ascx if (!string.IsNullOrWhiteSpace(deliveryTypeUiId)) { var deliveryType = Page.Request.Form[deliveryTypeUiId]; bool noDeliveryInfo = ProductsBase.NoDeliveryOptionInfo(); if ((deliveryType != null)) { if ((deliveryType == "Shipping") || ((deliveryType.Length >= 6) && (deliveryType.Substring(0, 6) == "Pickup") && !noDeliveryInfo) ) { // Shipping - ticket 140747 Chkout24hPopupExtender.Show(); } } } } } } } } } }
private void DisplayRemainingValuesFOP(string DSSubType, bool Refresh, PurchasingLimits_V01 limits) { trRemainingVal.Visible = true; ShoppingCart.EmailValues.RemainingVolume = string.Empty; decimal cartVolume = ShoppingCart.VolumeInCart; if (null != limits) { decimal remaining = (limits.RemainingVolume - cartVolume); if (remaining < 0) { remaining = 0; } lblRemainingValDisplay.Text = GetLocalResourceObject("RemainingVolume").ToString(); lblRemainingVal.Text = ProductsBase.GetVolumePointsFormat(remaining); ShoppingCart.EmailValues.RemainingVolume = lblRemainingVal.Text; } }
//[Publishes(MyHLEventTypes.QuoteRetrieved)] //public event EventHandler MXQuoteRetrieved; //[Publishes(MyHLEventTypes.WarehouseChanged)] //public event EventHandler MXOnWarehouseChanged; #region page load protected void Page_Load(object sender, EventArgs e) { _shippingAddresses = Providers.Shipping.ShippingProvider.GetShippingProvider(CountryCode) .GetShippingAddresses(DistributorID, Locale); _pickupRrefList = ProductsBase.GetShippingProvider() .GetPickupLocationsPreferences(DistributorID, CountryCode); SetPredefinedPickUpOption(); //User Story 176424 Message to inform "some addresses are updated, please add again your addresses" var showMessage = HttpContext.Current.Session["showMessageOnPage"]; if (showMessage != null && (string)showMessage == "True" && HLConfigManager.Configurations.DOConfiguration.ShowDeletedAddressesMessage) { (Master as OrderingMaster).ShowMessage((string)GetLocalResourceObject("Title"), (string)GetLocalResourceObject("Message")); HttpContext.Current.Session["showMessageOnPage"] = null; } if (IsStatic) { showStatic(); } else { showEdit(); } setInventoryView(); showHideAddressLink(); showTitle(); showShiptoOrPickup(IsStatic); setLinksVisiblity(); if (pAddress != null && string.IsNullOrEmpty(pAddress.InnerHtml)) { if (ShoppingCart.DeliveryInfo != null && ShoppingCart.DeliveryInfo.Address != null) { setAddressByNickName(ShoppingCart.DeliveryInfo.Address); } } }
public static List <ProductsBase> ProductList() { List <ProductsBase> PBList = new List <ProductsBase>(); foreach (DataRow dr in ProductTable().Rows) //use the ProductTable method above { ProductsBase PB = new ProductsBase(); PB.ProductID = (int)dr["ProductID"]; PB.ProductName = (string)dr["ProductName"]; PB.SupplierID = dr["SupplierID"] as int?; PB.CategoryID = dr["CategoryID"] as int?; PB.UnitPrice = dr["UnitPrice"] as decimal?; PB.QuantityPerUnit = dr["QuantityPerUnit"] as string; PB.UnitsInStock = dr["UnitsInStock"] as short?; PB.UnitsOnOrder = dr["UnitsOnOrder"] as short?; PB.ReorderLevel = dr["ReorderLevel"] as short?; PB.Discontinued = (bool)dr["Discontinued"]; PBList.Add(PB); } return(PBList); }