/// <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)); }
public void Save() { if (!(Page.Request.CurrentExecutionFilePath ?? string.Empty).Contains("editContent.aspx")) { return; } int currentId; int.TryParse(Page.Request.QueryString["id"], out currentId); var currentDoc = new Document(currentId); // Get the current property type var propertyTypeId = ((DefaultData)this._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); int newStock; int.TryParse(_txtStock.Text, out newStock); if (currentId != 0) { UWebshopStock.UpdateStock(currentId, newStock, false, storeAlias); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (!(Page.Request.CurrentExecutionFilePath ?? string.Empty).Contains("editContent.aspx")) { return; } int currentId; int.TryParse(Page.Request.QueryString["id"], out currentId); var orderCount = UWebshopStock.GetOrderCount(currentId); _lblOrderCount = new Label { Text = orderCount.ToString(CultureInfo.InvariantCulture) }; if (ContentTemplateContainer != null) { ContentTemplateContainer.Controls.Add(_lblOrderCount); } }
public void Install() { try { Log.Instance.LogDebug("uWebshop Installer InstallOrderTable Start: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt")); uWebshopOrders.InstallOrderTable(); Log.Instance.LogDebug("uWebshop Installer InstallOrderTable End: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt")); } catch { Log.Instance.LogError("uWebshopOrders.InstallOrderTable()"); } try { Log.Instance.LogDebug("uWebshop Installer AddStoreOrderReferenceIdToExistingOrders Start: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt")); new OrderTableUpdater().AddStoreOrderReferenceIdToExistingOrders(); Log.Instance.LogDebug("uWebshop Installer AddStoreOrderReferenceIdToExistingOrders End: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt")); } catch { Log.Instance.LogError("AddStoreOrderReferenceIdToExistingOrders"); } try { Log.Instance.LogDebug("uWebshop Installer InstallStockTable Start: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt")); UWebshopStock.InstallStockTable(); Log.Instance.LogDebug("uWebshop Installer InstallStockTable End: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt")); } catch { Log.Instance.LogError("uWebshopOrders.InstallStockTable()"); } try { Log.Instance.LogDebug("uWebshop Installer InstallCouponsTable Start: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt")); IO.Container.Resolve <ICouponCodeService>().InstallCouponsTable(); Log.Instance.LogDebug("uWebshop Installer InstallCouponsTable End: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt")); } catch { Log.Instance.LogError("uWebshopOrders.InstallCouponsTable()"); } Log.Instance.LogDebug("uWebshop Installer InstalluWebshopDocumentTypes Start: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt")); _cmsInstaller.Install(); Log.Instance.LogDebug("uWebshop Installer InstalluWebshopDocumentTypes End: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt")); }
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); } }
public static bool EditNodeProperties() { var editNodeId = HttpContext.Current.Request["editNodeId"]; var storeAlias = HttpContext.Current.Request["storeAlias"]; var sender = HttpContext.Current.Request["Id"]; if (!string.IsNullOrEmpty(editNodeId)) { int nodeId; int.TryParse(editNodeId, out nodeId); if (nodeId != 0) { bool publish = false; //var contentService = ApplicationContext.Current.Services.ContentService; var doc = IO.Container.Resolve <ICMSChangeContentService>().GetById(nodeId); //var doc = new Document(nodeId);//contentService.GetById(nodeId); foreach (var key in HttpContext.Current.Request.Form.AllKeys) { if (key != null && !key.StartsWith("ctl00$") && !key.StartsWith("body_TabView") && !key.StartsWith("__EVENT") && !key.StartsWith("__VIEWSTATE") && !key.StartsWith("__ASYNCPOST") && doc.HasProperty(key)) { var value = HttpContext.Current.Request.Form[key]; if (!key.StartsWith("stock")) { if (!string.IsNullOrEmpty(value)) { doc.SetValue(key, value); //doc.SetValue(key, value); publish = true; } } else { if (Product.IsAlias(doc.ContentTypeAlias) || ProductVariant.IsAlias(doc.ContentTypeAlias)) { int newStockInt; int.TryParse(value, out newStockInt); UWebshopStock.UpdateStock(nodeId, newStockInt, false, storeAlias); } } } } if (publish) { //contentService.SaveAndPublish(doc, 0, true); doc.SaveAndPublish(); //doc.Save(); //doc.Publish(new User(0)); BasePage.Current.ClientTools.ChangeContentFrameUrl(string.Concat("editContent.aspx?id=", sender)); return(true); } } } return(false); }
public int GetStockForUwebshopEntityWithId(int id, string storeAlias = null) { return(UWebshopStock.GetStock(id, storeAlias)); }
public void ReturnStock(int itemId, int stockToReturn, bool updateOrderCount = true, string storeAlias = null) { UWebshopStock.ReturnStock(itemId, stockToReturn, updateOrderCount, storeAlias); }
public void ReplaceStock(int productId, int newStock, bool updateOrderCount, string storeAlias = null) { UWebshopStock.ReplaceStock(productId, newStock, updateOrderCount, storeAlias); }
public void SetOrderCount(int itemId, int orderCountToUpdate, string storeAlias = null) { UWebshopStock.SetOrderCount(itemId, orderCountToUpdate, storeAlias); }
public void SubstractStock(int itemId, int delta, bool updateOrderCount = true, string storeAlias = null) { UWebshopStock.SubstractStock(itemId, delta, updateOrderCount, storeAlias); }
public int GetOrderCount(int id, string storeAlias = null) { return(UWebshopStock.GetOrderCount(id, storeAlias)); }