void BindData()
    {
        string id = Request.QueryString["ID"];

        if (string.IsNullOrEmpty(id))
        {
            clProduct.Visible   = true;
            ucpProducts.Visible = false;
        }
        else
        {
            #region -Bind Datas(Private)-
            clProduct.Visible = false;
            int catId = int.Parse(GlobalSettings.Decrypt(id));
            cnProduct.CategoryID  = catId;
            cllProduct.CategoryID = catId;
            cslProduct.CategoryID = catId;
            #endregion

            #region -BindData-
            ProductQuery query = new ProductQuery();
            query.CategoryID  = catId;
            ucpProducts.Query = query;
            #endregion
        }
    }
    public override void OnPageLoaded()
    {
        string industryName = string.Empty, industryAbstract = string.Empty;
        string id = Request.QueryString["ID"];

        if (!string.IsNullOrEmpty(id))
        {
            int             pid = int.Parse(GlobalSettings.Decrypt(id));
            ProductIndustry pi  = ProductIndustries.GetProductIndustry(pid);
            if (null != pi)
            {
                industryName     = pi.IndustryName;
                industryAbstract = pi.IndustryAbstract;
            }
        }

        if (string.IsNullOrEmpty(industryName))
        {
            industryName = "所有行业";
            this.AddKeywords(industryName);
            this.AddDescription("分组显示所有行业列表,选择行业导航到对应行业的产品列表。");
            this.ShortTitle = industryName;
        }
        else
        {
            this.AddKeywords(industryName);
            this.AddDescription(string.Format("显示{0}行业的产品列表。{1}{2}", industryName, industryAbstract, string.Format(" 关键字: {0}", industryName)));
            this.ShortTitle = industryName;
        }
        this.SetTitle();

        this.AddJavaScriptInclude("scripts/pages/sortby.aspx.js", false, false);
    }
Ejemplo n.º 3
0
    public override void OnPageLoaded()
    {
        int     nid     = int.Parse(GlobalSettings.Decrypt(Request.QueryString["ID"]));
        Article article = ArticleManager.GetArticle(nid);

        //构建资讯的关键字标签
        StringBuilder sb = new StringBuilder();

        //添加资讯关键字
        sb.Append(article.Keywords.Replace(';', ','));
        sb.Append(",");
        //添加资讯副标题
        if (!string.IsNullOrEmpty(article.SubTitle))
        {
            sb.AppendFormat("{0},", article.SubTitle);
        }
        //添加资讯所属分类的关键字
        sb.Append(null == article.CategoryObject ? string.Empty : article.CategoryObject.Name);

        //设置页面关键字标签
        this.AddKeywords(sb.ToString());

        //设置资讯页面描述信息为资讯简述/名称+关键字列表
        this.AddDescription((string.IsNullOrEmpty(article.Abstract) ? article.Title : article.Abstract) + " 关键字: " + sb.ToString());

        //设置资讯页面标题为名称+" - "+关键字组合标题名
        this.ShortTitle = article.Title + " - " + sb.ToString();
        SetTitle();

        AddJavaScriptInclude("Scripts/Pages/newsDetail.aspx.js", false, false);
    }
    public override void OnPageLoaded()
    {
        string brandName = string.Empty, brandGroup = string.Empty, brandAbstract = string.Empty;
        string id = Request.QueryString["ID"];

        if (!string.IsNullOrEmpty(id))
        {
            int          brandId = int.Parse(GlobalSettings.Decrypt(id));
            ProductBrand pb      = ProductBrands.GetProductBrand(brandId);
            if (null != pb)
            {
                brandName     = pb.BrandName;
                brandGroup    = pb.BrandGroup;
                brandAbstract = pb.BrandAbstract;
            }
        }

        if (string.IsNullOrEmpty(brandName))
        {
            brandName = "所有品牌";
            this.AddKeywords(brandName);
            this.AddDescription("分组显示所有品牌列表,选择品牌导航到对应品牌的产品列表。");
            this.ShortTitle = brandName;
        }
        else
        {
            this.AddKeywords(string.Format("{0},{1}", brandName, brandGroup));
            this.AddDescription(string.Format("显示{0}品牌的产品列表。{1}{2}", brandName, brandAbstract, string.Format(" 关键字: {0},{1}", brandName, brandGroup)));
            this.ShortTitle = brandName + " - " + brandGroup;
        }
        this.SetTitle();


        this.AddJavaScriptInclude("scripts/pages/sortby.aspx.js", false, false);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (User.Identity.IsAuthenticated)
        {
            throw new HHException(ExceptionType.Failed, "您已经登录,请勿重复操作!");
        }
        HttpCookie c = HHCookie.GetCookie("HHOnline-UserInfo");

        if (c != null)
        {
            string uid = GlobalSettings.Decrypt(c.Values["UserName"]);
            string pwd = GlobalSettings.Decrypt(c.Values["Password"]);
            base.ExecuteJs("window.$userinfo={uid:'" + uid + "',pwd:'" + pwd + "'};", false);
        }
        string oldUrl = string.Empty;

        if (Request.UrlReferrer != null)
        {
            oldUrl = Request.UrlReferrer.ToString();
        }
        base.ExecuteJs("window.$url='" + oldUrl + "';", true);
    }
    void BindData()
    {
        string id = Request.QueryString["ID"];

        if (string.IsNullOrEmpty(id))
        {
            hpvlList.Visible    = true;
            ucpProducts.Visible = false;
            this.ShortTitle     = "所有品牌";
        }
        else
        {
            #region -Bind Data(Private)-
            hpvlList.Visible = false;
            int BrandID = int.Parse(GlobalSettings.Decrypt(id));
            vnProduct.BrandID = BrandID;
            hpblList.BrandID  = BrandID;

            ProductBrand pb = ProductBrands.GetProductBrand(BrandID);
            if (pb == null)
            {
                this.ShortTitle = pb.BrandName;
            }
            else
            {
                this.ShortTitle = "品牌";
            }
            this.SetTitle();
            #endregion

            #region -BindData-
            ProductQuery query = new ProductQuery();
            query.BrandID     = BrandID;
            ucpProducts.Query = query;
            #endregion
        }
    }
    void BindData()
    {
        string id = Request.QueryString["ID"];

        if (string.IsNullOrEmpty(id))
        {
            hpilProduct.Visible = true;
            ucpProducts.Visible = false;
        }
        else
        {
            hpilProduct.Visible = false;
            int pid = int.Parse(GlobalSettings.Decrypt(id));
            inProduct.IndustryID  = pid;
            illProduct.IndustryID = pid;
            islProduct.IndustryID = pid;

            #region -BindData-
            ProductQuery query = new ProductQuery();
            query.IndustryID  = pid;
            ucpProducts.Query = query;
            #endregion
        }
    }
    public override void OnPageLoaded()
    {
        string        catName = string.Empty, catRelated = string.Empty;
        StringBuilder sbRelated = new StringBuilder();

        string          id = Request.QueryString["ID"];
        ProductCategory pc = null;

        if (!string.IsNullOrEmpty(id))
        {
            int catId = int.Parse(GlobalSettings.Decrypt(id));
            pc = ProductCategories.GetCategory(catId);
            if (pc != null)
            {
                catName = pc.CategoryName;
            }
        }

        if (!string.IsNullOrEmpty(catName))
        {
            //获取子分类
            List <ProductCategory> childCategories = ProductCategories.GetChidCategories(pc.CategoryID);
            if (null == childCategories || 0 == childCategories.Count)
            {
            }
            else
            {
                foreach (ProductCategory pcChild in childCategories)
                {
                    sbRelated.AppendFormat("{0},", pcChild.CategoryName);
                }
            }
            //获取相关分类
            List <ProductCategory> relateCategories = ProductCategories.GetChidCategories(pc.ParentID);
            if (null == relateCategories || 0 == relateCategories.Count)
            {
            }
            else
            {
                foreach (ProductCategory pcRelate in relateCategories)
                {
                    sbRelated.AppendFormat("{0},", pcRelate.CategoryName);
                }
            }
            catRelated = sbRelated.ToString().TrimEnd(',');
        }
        else
        {
            List <ProductCategory> relateCategories = ProductCategories.GetCategories();
            if (null == relateCategories || 0 == relateCategories.Count)
            {
            }
            else
            {
                foreach (ProductCategory pcRelate in relateCategories)
                {
                    if (pcRelate.ParentID > 0)
                    {
                        continue;
                    }
                    sbRelated.AppendFormat("{0},", pcRelate.CategoryName);
                }
            }
            catRelated = sbRelated.ToString().TrimEnd(',');
        }

        if (string.IsNullOrEmpty(catName))
        {
            catName = "所有分类";
            this.AddKeywords(catName + "," + catRelated);
            this.AddDescription("显示所有一级和二级产品分类,选择产品分类导航到对应分类的产品列表。" + string.Format(" 关键字: {0},{1}", catName, catRelated));
            this.ShortTitle = catName;
        }
        else
        {
            this.AddKeywords(string.Format("{0},{1}", catName, catRelated));
            this.AddDescription(string.Format("显示{0}分类的产品列表。{1}", catName, string.Format(" 关键字: {0},{1}", catName, catRelated)));
            this.ShortTitle = catName + " - " + catRelated;
        }
        this.SetTitle();

        this.AddJavaScriptInclude("scripts/pages/sortby.aspx.js", false, false);
    }
Ejemplo n.º 9
0
    Product GetProduct()
    {
        int pid = int.Parse(GlobalSettings.Decrypt(Request.QueryString["ID"]));

        return(Products.GetProduct(pid));
    }
Ejemplo n.º 10
0
        string ValidUser(HttpContext context, ref bool result)
        {
            result = false;
            HttpRequest req        = context.Request;
            string      userName   = req["userName"];
            string      pwd        = req["password"];
            bool        rememberMe = bool.Parse(req["rememberMe"]);
            string      validCode  = req["validCode"];
            string      oldUrl     = req["url"];
            HttpCookie  __cookie   = HHCookie.GetCookie("HHOnline_ValidateCode");

            if (__cookie == null || string.IsNullOrEmpty(__cookie.Value))
            {
                throw new Exception("验证码已过期,请点击刷新!");
            }
            else
            {
                if (GlobalSettings.Decrypt(__cookie.Value).Equals(validCode, StringComparison.CurrentCultureIgnoreCase))
                {
                    __cookie.Expires = DateTime.Now.AddMinutes(-1);
                    User u = new User()
                    {
                        UserName = userName,
                        Password = pwd
                    };
                    switch (Users.ValidateUser(ref u))
                    {
                    case LoginUserStatus.InvalidCredentials:
                        throw new Exception("用户名密码不匹配,请重新登录!");

                    case LoginUserStatus.Success:
                        result = true;
                        HttpCookie cookie = FormsAuthentication.GetAuthCookie(u.UserName, true);
                        FormsAuthenticationTicket ticket    = FormsAuthentication.Decrypt(cookie.Value);
                        FormsAuthenticationTicket newticket = new FormsAuthenticationTicket(
                            ticket.Version,
                            ticket.Name,
                            ticket.IssueDate,
                            ticket.Expiration,
                            ticket.IsPersistent,
                            DateTime.Now.ToShortDateString());
                        cookie.Value = FormsAuthentication.Encrypt(newticket);
                        HHCookie.AddCookie(cookie);
                        string url = FormsAuthentication.GetRedirectUrl(u.UserName, true);

                        if (rememberMe)
                        {
                            string userInfo = userName + ";" + pwd;
                            userInfo = GlobalSettings.Encrypt(userInfo);
                            HttpCookie c = new HttpCookie("HHOnline-UserInfo");
                            c.Values.Add("UserName", GlobalSettings.Encrypt(userName));
                            c.Values.Add("Password", GlobalSettings.Encrypt(pwd));
                            c.Expires = DateTime.Now.AddDays(365);
                            HHCookie.AddCookie(c);
                        }

                        if (string.IsNullOrEmpty(oldUrl))
                        {
                            switch (u.UserType)
                            {
                            case UserType.CompanyUser:
                                return(GlobalSettings.RelativeWebRoot + "main.aspx");

                            case UserType.InnerUser:
                                return(GlobalSettings.RelativeWebRoot + "controlpanel/controlpanel.aspx");
                            }
                        }
                        else
                        {
                            return(oldUrl);
                        }
                        break;

                    case LoginUserStatus.AccountPending:
                        throw new Exception("账号正在审核中,请稍后重试!");

                    case LoginUserStatus.AccountBanned:
                        throw new Exception("账号已经被禁止使用!");

                    case LoginUserStatus.AccountDisapproved:
                        throw new Exception("账号未通过审核,无法使用!");

                    case LoginUserStatus.Deleted:
                        throw new Exception("账号已经被删除,无法使用!");

                    case LoginUserStatus.UnknownError:
                        throw new Exception("登录过程中发生了异常,请联系管理员!");
                    }
                }
                else
                {
                    throw new Exception("验证码错误,请重新输入!");
                }
            }
            return("");
        }