/// <summary> /// Override ParsePathInfo to determine action and optional parameters. /// </summary> protected override void ParsePathInfo() { base.ParsePathInfo(); if (base.ModuleParams.Length > 0) { // First pathinfo parameter is the module action. try { this._currentAction = (ShopModuleAction)Enum.Parse(typeof(ShopModuleAction), base.ModuleParams[0], true); switch(this._currentAction) { case ShopModuleAction.ShopCategoryList: this.CurrentShopCategoryId = Int32.Parse(base.ModuleParams[1]); break; case ShopModuleAction.ShopView: this.CurrentShopId = Int32.Parse(base.ModuleParams[1]); break; case ShopModuleAction.ShopEditProduct: this.CurrentShopId = Int32.Parse(base.ModuleParams[1]); this.CurrentShopProductId = Int32.Parse(base.ModuleParams[3]); break; case ShopModuleAction.ShopViewProduct: this.CurrentShopId = Int32.Parse(base.ModuleParams[1]); this.CurrentShopProductId = Int32.Parse(base.ModuleParams[3]); break; case ShopModuleAction.ShopEditComment: this.CurrentShopId = Int32.Parse(base.ModuleParams[1]); this.CurrentShopProductId = Int32.Parse(base.ModuleParams[3]); this.QuoteProduct = 0; if (base.ModuleParams[5] == "") { this.CurrentShopCommentId = -1; } else { this.CurrentShopCommentId = Int32.Parse(base.ModuleParams[5]); } break; case ShopModuleAction.ShopProfile: case ShopModuleAction.ShopViewProfile: this.CurrentUserId = Int32.Parse(base.ModuleParams[1]); break; } } catch (ArgumentException ex) { throw new Exception("Error when parsing module action: " + base.ModuleParams[0], ex); } catch (Exception ex) { throw new Exception("Error when parsing module parameters: " + base.ModulePathInfo, ex); } } }
public ShopModule(ISessionManager sessionManager) { _sessionManager = sessionManager; ISession session = this._sessionManager.OpenSession(); this._currentAction = ShopModuleAction.ShopList; _categorySortBy = CategorySortBy.Name; _categorySortASC = true; _shopSortBy = ShopSortBy.Name; _shopSortASC = true; _shopProductSortBy = ShopProductSortBy.DateCreated; _productSortASC = true; this._shopthemepath = UrlHelper.GetApplicationPath() + "Modules/Shop/Images/Standard/"; this.ReadSectionSettings(); }