private bool CustomerIsOnCurrentSite(BaseInfo customerInfo) { var currentSiteID = SiteContext.CurrentSiteID; if (customerInfo.GetIntegerValue("CustomerSiteID", 0) == currentSiteID) { return(true); } var userID = customerInfo.GetIntegerValue("CustomerUserID", 0); return((userID > 0) && (UserSiteInfoProvider.GetUserSiteInfo(userID, currentSiteID) != null)); }
/// <summary> /// Redirects to the edit page of the saved product. /// </summary> private void RedirectToSavedProduct(BaseInfo product) { string url = ProductUIHelper.GetProductEditUrl(); // Creating product options of type other than products is redirected directly to form if (OptionCategoryID > 0) { var categoryInfo = OptionCategoryInfoProvider.GetOptionCategoryInfo(OptionCategoryID); if (categoryInfo != null) { url = "Product_Edit_General.aspx"; if (categoryInfo.CategoryType == OptionCategoryTypeEnum.Products) { url = UIContextHelper.GetElementUrl("cms.ecommerce", "ProductOptions.Options.Edit", false); } } } url = URLHelper.AddParameterToUrl(url, "siteId", SiteID.ToString()); url = URLHelper.AddParameterToUrl(url, "categoryId", OptionCategoryID.ToString()); url = URLHelper.AddParameterToUrl(url, "objectid", OptionCategoryID.ToString()); if (product is TreeNode) { int nodeId = product.GetIntegerValue("NodeID", 0); url = URLHelper.AddParameterToUrl(url, "nodeId", nodeId.ToString()); } else if (product is SKUInfo) { int skuId = product.GetIntegerValue("SKUID", 0); url = URLHelper.AddParameterToUrl(url, "productId", skuId.ToString()); // Select general tab if stan-alone SKU is saved if (OptionCategoryID == 0) { url = URLHelper.AddParameterToUrl(url, "tabName", "Products.General"); } } url = URLHelper.AddParameterToUrl(url, "saved", "1"); URLHelper.Redirect(url); }
/// <summary> /// Redirects to the edit page of the saved product. /// </summary> private void RedirectToSavedProduct(BaseInfo product) { string url = "Product_Edit_Frameset.aspx"; url = URLHelper.AddParameterToUrl(url, "siteId", SiteID.ToString()); url = URLHelper.AddParameterToUrl(url, "categoryId", OptionCategoryID.ToString()); if (product is TreeNode) { int nodeId = product.GetIntegerValue("NodeID", 0); url = URLHelper.AddParameterToUrl(url, "nodeId", nodeId.ToString()); } else if (product is SKUInfo) { int skuId = product.GetIntegerValue("SKUID", 0); url = URLHelper.AddParameterToUrl(url, "productId", skuId.ToString()); } url = URLHelper.AddParameterToUrl(url, "saved", "1"); URLHelper.Redirect(url); }
/// <summary> /// Redirects to the edit page of the saved product. /// </summary> private void RedirectToSavedProduct(BaseInfo product) { string url = ProductUIHelper.GetProductEditUrl(); if (OptionCategoryID > 0) { var categoryInfo = OptionCategoryInfoProvider.GetOptionCategoryInfo(OptionCategoryID); if (categoryInfo != null) { url = UIContextHelper.GetElementUrl(ModuleName.ECOMMERCE, "ProductOptions.Options.General", false); } } var categoryID = OptionCategoryID.ToString(); url = URLHelper.AddParameterToUrl(url, "siteId", SiteID.ToString()); url = URLHelper.AddParameterToUrl(url, "categoryId", categoryID); url = URLHelper.AddParameterToUrl(url, "parentobjectid", categoryID); if (product is TreeNode) { int nodeId = product.GetIntegerValue("NodeID", 0); url = URLHelper.AddParameterToUrl(url, "nodeId", nodeId.ToString()); } else if (product is SKUInfo) { var skuId = product.GetIntegerValue("SKUID", 0).ToString(); url = URLHelper.AddParameterToUrl(url, "productId", skuId); url = URLHelper.AddParameterToUrl(url, "objectid", skuId); // Select general tab if stan-alone SKU is saved if (OptionCategoryID == 0) { url = URLHelper.AddParameterToUrl(url, "tabName", "Products.General"); } } url = URLHelper.AddParameterToUrl(url, "saved", "1"); URLHelper.Redirect(UrlResolver.ResolveUrl(url)); }
private DataClassInfo FindDataClass(BaseInfo item) { switch (item.TypeInfo.ObjectType) { case BizFormInfo.OBJECT_TYPE: var classId = item.GetIntegerValue("FormClassID", 0); return(DataClassInfoProvider.GetDataClassInfo(classId)); case DocumentTypeInfo.OBJECT_TYPE_DOCUMENTTYPE: case CustomTableInfo.OBJECT_TYPE_CUSTOMTABLE: var className = item.GetStringValue("ClassName", string.Empty); return(DataClassInfoProvider.GetDataClassInfo(className)); } return(null); }
/// <summary> /// Validates whether the column value is unique, and provides an optional error message. /// </summary> /// <typeparam name="T">The type of object to validate.</typeparam> /// <param name="columnName">The name of the column to validate.</param> /// <param name="uniqueText">The column text.</param> /// <param name="resourceKey">The resource key of the error message.</param> /// <param name="errorMessage">The error message.</param> private void Validate <T>(string columnName, string uniqueText, string resourceKey, ref string errorMessage) where T : BaseInfo, new() { int siteId = SiteContext.CurrentSiteID; BaseInfo info = Control.EditedObject as BaseInfo; if (info != null && siteId > 0 && !String.IsNullOrWhiteSpace(uniqueText)) { int identifier = info.GetIntegerValue(info.TypeInfo.IDColumn, 0); ObjectQuery <T> query = new ObjectQuery <T>().Where(columnName, QueryOperator.Equals, uniqueText).OnSite(siteId); if (identifier > 0) { query.Where(info.TypeInfo.IDColumn, QueryOperator.NotEquals, identifier); } if (query.Count > 0) { errorMessage = ResHelper.GetString(resourceKey); } } }
private bool CustomerIsOnCurrentSite(BaseInfo customerInfo) { var currentSiteID = SiteContext.CurrentSiteID; if (customerInfo.GetIntegerValue("CustomerSiteID", 0) == currentSiteID) { return true; } var userID = customerInfo.GetIntegerValue("CustomerUserID", 0); return (userID > 0) && (UserSiteInfoProvider.GetUserSiteInfo(userID, currentSiteID) != null); }