public BrandPublishHandler(string Url) { config = (BrandConfigurationSection)ConfigurationManager.GetSection("publish/brandPublish"); Logger = LogManager.GetLogger(config.Logger); dal = new BrandDataAccess(config); PageParameter = GetParameter(Url); PageFileName = GetPageFileName(); }
private BrandPageParameter GetParameter(string Url) { BrandPageParameter parm = null; string pattern = @"brand(_|-)+(?<brandid>\d+)((_|-)+(?<pageIndex>\d+))?((_|-)+c(?<cateid>\d+))?((_|-)+o(?<order>\d+))?"; Match match = Regex.Match(Url, pattern); if (match.Success) { parm = new BrandPageParameter(); parm.BrandID = Convert.ToInt32(match.Groups["brandid"].Value); if (match.Groups["pageIndex"].Success) { parm.PageIndex = Convert.ToInt32(match.Groups["pageIndex"].Value); } if (match.Groups["cateid"].Success) { parm.CategoryID = Convert.ToInt32(match.Groups["cateid"].Value); } if (match.Groups["order"].Success) { parm.OrderType = Convert.ToInt32(match.Groups["order"].Value); } } if (parm.PageIndex == 0) { parm.PageIndex = 1; } if (parm.OrderType == 0) { parm.OrderType = 1; } return(parm); }
private BrandPageParameter GetParameter(string Url) { BrandPageParameter parm = null; string pattern = @"brand(_|-)+(?<brandid>\d+)((_|-)+(?<pageIndex>\d+))?((_|-)+c(?<cateid>\d+))?((_|-)+o(?<order>\d+))?"; Match match = Regex.Match(Url, pattern); if (match.Success) { parm = new BrandPageParameter(); parm.BrandID = Convert.ToInt32(match.Groups["brandid"].Value); if (match.Groups["pageIndex"].Success) parm.PageIndex = Convert.ToInt32(match.Groups["pageIndex"].Value); if (match.Groups["cateid"].Success) parm.CategoryID = Convert.ToInt32(match.Groups["cateid"].Value); if (match.Groups["order"].Success) parm.OrderType = Convert.ToInt32(match.Groups["order"].Value); } if (parm.PageIndex == 0) parm.PageIndex = 1; if (parm.OrderType == 0) parm.OrderType = 1; return parm; }