示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static int GetMultiStoreStock(int id)
        {
            // todo: multi store validation
            var currentStore = GetCurrentStore();

            return(currentStore != null && currentStore.UseStoreSpecificStock ? UWebshopStock.GetStock(id, currentStore.Alias) : UWebshopStock.GetStock(id));
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);



            int currentId;

            int.TryParse(Page.Request.QueryString["id"], out currentId);

            if (!(Page.Request.CurrentExecutionFilePath ?? string.Empty).Contains("editContent.aspx"))
            {
                return;
            }

            if (currentId == 0)
            {
                return;
            }
            var currentDoc = new Document(currentId);

            // Get the current property type
            var propertyTypeId = ((DefaultData)_data).PropertyId;

            var property = currentDoc.GenericProperties.FirstOrDefault(x => x.Id == propertyTypeId);

            var propertyAlias = property.PropertyType.Alias;
            // test if the property alias contains an shopalias

            var storeAlias = GetStoreAliasFromProperyAlias(propertyAlias);


            var stock = UWebshopStock.GetStock(currentId, storeAlias);

            _txtStock = new TextBox {
                Text = stock.ToString(CultureInfo.InvariantCulture)
            };

            if (ContentTemplateContainer != null)
            {
                ContentTemplateContainer.Controls.Add(_txtStock);
            }
        }
示例#3
0
 public int GetStockForUwebshopEntityWithId(int id, string storeAlias = null)
 {
     return(UWebshopStock.GetStock(id, storeAlias));
 }