Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["OrderByKey"]  = "pk_Product";
            ViewState["OrderByType"] = true;

            if (Request.QueryString["parentId"] != null)
            {
                ViewState["ParentID"] = MojoCube.Api.Text.Security.DecryptString(Request.QueryString["parentId"]);

                MojoCube.Web.Product.Category category = new MojoCube.Web.Product.Category();
                category.GetData(int.Parse(ViewState["ParentID"].ToString()));

                lblTitle.Text = category.CategoryName;
            }
            else
            {
                ViewState["ParentID"] = "0";

                lblTitle.Text = "全部";
            }

            CategoryDiv.InnerHtml = CreateCategory();
            GridBind();
            this.Title = "产品列表";
        }
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            hlBack.NavigateUrl = "Category.aspx?active=" + Request.QueryString["active"];

            if (Request.QueryString["id"] != null)
            {
                ViewState["pk_Category"] = MojoCube.Api.Text.Security.DecryptString(Request.QueryString["id"]);

                MojoCube.Web.Product.Category category = new MojoCube.Web.Product.Category();
                category.GetData(int.Parse(ViewState["pk_Category"].ToString()));

                txtPageName.Text        = category.PageName;
                txtCategoryName.Text    = category.CategoryName;
                txtSortID.Text          = category.SortID.ToString();
                cbVisible.Checked       = category.Visible;
                txtSEO_Title.Text       = category.SEO_Title;
                txtSEO_Keyword.Text     = category.SEO_Keyword;
                txtSEO_Description.Text = category.SEO_Description;

                this.Title = "产品分类编辑:" + txtCategoryName.Text.Trim();
            }
            else
            {
                txtPageName.Text  = MojoCube.Web.String.GetPageName();
                cbVisible.Checked = true;
                this.Title        = "产品分类编辑";
            }
        }
    }
Ejemplo n.º 3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (txtCategoryName.Text.Trim() == "")
        {
            AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("danger", "请填写名称");
            return;
        }

        MojoCube.Web.Product.Category category = new MojoCube.Web.Product.Category();

        //修改
        if (ViewState["pk_Category"] != null)
        {
            category.GetData(int.Parse(ViewState["pk_Category"].ToString()));
            category.PageName        = txtPageName.Text.Trim();
            category.CategoryName    = txtCategoryName.Text.Trim();
            category.SortID          = MojoCube.Web.String.ToInt(txtSortID.Text.Trim());
            category.Visible         = cbVisible.Checked;
            category.SEO_Title       = txtSEO_Title.Text.Trim();
            category.SEO_Keyword     = txtSEO_Keyword.Text.Trim();
            category.SEO_Description = txtSEO_Description.Text.Trim();
            category.ModifyDate      = DateTime.Now.ToString();
            category.ModifyUserID    = int.Parse(Session["UserID"].ToString());
            category.UpdateData(category.pk_Category);
        }
        //新增
        else
        {
            if (Request.QueryString["parentId"] != null)
            {
                category.ParentID = int.Parse(MojoCube.Api.Text.Security.DecryptString(Request.QueryString["parentId"]));
            }
            else
            {
                category.ParentID = 0;
            }
            category.PageName        = txtPageName.Text.Trim();
            category.CategoryName    = txtCategoryName.Text.Trim();
            category.Subtitle        = string.Empty;
            category.SortID          = MojoCube.Web.String.ToInt(txtSortID.Text.Trim());
            category.Visible         = cbVisible.Checked;
            category.SEO_Title       = txtSEO_Title.Text.Trim();
            category.SEO_Keyword     = txtSEO_Keyword.Text.Trim();
            category.SEO_Description = txtSEO_Description.Text.Trim();
            category.Url             = string.Empty;
            category.ImagePath       = string.Empty;
            category.CreateDate      = DateTime.Now.ToString();
            category.CreateUserID    = int.Parse(Session["UserID"].ToString());
            category.ModifyDate      = DateTime.Now.ToString();
            category.ModifyUserID    = 0;
            category.Language        = MojoCube.Api.UI.Language.GetLanguage();
            ViewState["pk_Category"] = category.InsertData();
        }

        AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("success", "数据保存成功");
    }
Ejemplo n.º 4
0
    protected void Page_Init(object sender, EventArgs e)
    {
        strLanguage = MojoCube.Api.UI.Language.GetLanguage();

        #region  动态添加head的标签
        MojoCube.Api.Html.Header header = new MojoCube.Api.Html.Header(this.Page);
        //Meta
        string title       = MojoCube.Web.Site.Cache.GetSiteTitle(strLanguage);
        string keywords    = MojoCube.Web.Site.Cache.GetSiteKeyword(strLanguage);
        string description = MojoCube.Web.Site.Cache.GetSiteDescription(strLanguage);

        if (Request.QueryString["pageName"] != null)
        {
            MojoCube.Web.Product.Category category = new MojoCube.Web.Product.Category();
            category.GetData(Request.QueryString["pageName"]);

            ViewState["pk_Category"] = category.pk_Category;
            hlTitle.Text             = category.CategoryName;

            if (category.SEO_Title != "")
            {
                title = category.SEO_Title;
            }
            if (category.SEO_Keyword != "")
            {
                keywords = category.SEO_Keyword;
            }
            if (category.SEO_Description != "")
            {
                description = category.SEO_Description;
            }
        }

        header.AddMeta("title", title);
        header.AddMeta("keywords", keywords);
        header.AddMeta("description", description);
        //Link
        header.AddLiteral("<link rel=\"shortcut icon\" href=\"images/favicon.ico\" type=\"image/x-icon\" />");
        //CSS
        header.AddCSS("Themes/" + MojoCube.Web.Site.Cache.GetSiteTheme(strLanguage) + "/bootstrap.css");
        header.AddCSS("Themes/" + MojoCube.Web.Site.Cache.GetSiteTheme(strLanguage) + "/glide.css");
        header.AddCSS("Themes/" + MojoCube.Web.Site.Cache.GetSiteTheme(strLanguage) + "/style.css");
        header.AddCSS("Themes/" + MojoCube.Web.Site.Cache.GetSiteTheme(strLanguage) + "/online.css");
        //JS
        header.AddJS("JS/jquery.min.js");
        header.AddJS("JS/bootstrap.js");
        header.AddJS("JS/jquery.glide.js");
        #endregion
    }
Ejemplo n.º 5
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (txtProductName.Text.Trim() == "" || txtNumber.Text.Trim() == "")
        {
            AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("danger", "请填写产品名称和产品编号");
            return;
        }

        MojoCube.Api.File.Upload upload = new MojoCube.Api.File.Upload();
        upload.FilePath = "Product/" + txtNumber.Text.Trim();
        upload.FileName = MojoCube.Api.Text.Function.DateTimeString(true);
        upload.DoFileUpload(fuImage);

        MojoCube.Web.Product.List list = new MojoCube.Web.Product.List();

        //修改
        if (ViewState["pk_Product"] != null)
        {
            list.GetData(int.Parse(ViewState["pk_Product"].ToString()));

            MojoCube.Web.Product.Category category = new MojoCube.Web.Product.Category();
            category.GetData(int.Parse(ddlCategory.SelectedValue));

            if (category.ParentID == 0)
            {
                list.CategoryID1 = category.pk_Category;
                list.CategoryID2 = 0;
            }
            else
            {
                list.CategoryID1 = category.ParentID;
                list.CategoryID2 = category.pk_Category;
            }

            list.Number          = txtNumber.Text.Trim();
            list.PageName        = txtPageName.Text.Trim();
            list.ProductName     = txtProductName.Text.Trim();
            list.Price           = MojoCube.Web.String.ToDecimal(txtPrice.Text.Trim());
            list.Subtitle        = txtSubtitle.Text.Trim();
            list.Description     = txtDescription.Text.Trim();
            list.Attribute       = txtAttribute.Text.Trim();
            list.Issue           = cbIssue.Checked;
            list.IsComment       = cbComment.Checked;
            list.SEO_Title       = txtSEO_Title.Text.Trim();
            list.SEO_Keyword     = txtSEO_Keyword.Text.Trim();
            list.SEO_Description = txtSEO_Description.Text.Trim();
            if (upload.IsUpload)
            {
                list.ImagePath = upload.OldFilePath;
                SetImage(list.ImagePath);
            }
            list.ModifyDate   = DateTime.Now.ToString();
            list.ModifyUserID = int.Parse(Session["UserID"].ToString());
            list.UpdateData(list.pk_Product);
        }
        //新增
        else
        {
            MojoCube.Web.Product.Category category = new MojoCube.Web.Product.Category();
            category.GetData(int.Parse(ddlCategory.SelectedValue));

            if (category.ParentID == 0)
            {
                list.CategoryID1 = category.pk_Category;
                list.CategoryID2 = 0;
            }
            else
            {
                list.CategoryID1 = category.ParentID;
                list.CategoryID2 = category.pk_Category;
            }

            list.Number      = txtNumber.Text.Trim();
            list.PageName    = txtPageName.Text.Trim();
            list.ProductName = txtProductName.Text.Trim();
            list.Subtitle    = txtSubtitle.Text.Trim();
            list.Description = txtDescription.Text.Trim();
            list.Attribute   = txtAttribute.Text.Trim();
            if (txtSEO_Title.Text.Trim() != "")
            {
                list.SEO_Title = txtSEO_Title.Text.Trim();
            }
            else
            {
                list.SEO_Title = txtProductName.Text.Trim();
            }
            list.SEO_Keyword     = txtSEO_Keyword.Text.Trim();
            list.SEO_Description = txtSEO_Description.Text.Trim();
            list.Tags            = string.Empty;
            list.Visual          = string.Empty;
            list.Price           = MojoCube.Web.String.ToDecimal(txtPrice.Text.Trim());
            list.Qty             = 0;
            list.Location        = string.Empty;
            list.CountryID       = 0;
            list.ProvinceID      = 0;
            list.CityID          = 0;
            if (upload.IsUpload)
            {
                list.ImagePath = upload.OldFilePath;
                SetImage(list.ImagePath);
            }
            else
            {
                list.ImagePath = string.Empty;
            }
            list.Issue              = cbIssue.Checked;
            list.IsComment          = cbComment.Checked;
            list.IsRecommend        = false;
            list.Clicks             = 0;
            list.SortID             = 0;
            list.TypeID             = 0;
            list.StatusID           = 0;
            list.Score              = 0;
            list.ScoreIn            = 0;
            list.Sales              = 0;
            list.SpecialPrice       = 0;
            list.Freight            = 0;
            list.StartDate          = DateTime.Now.ToString();
            list.EndDate            = DateTime.Now.ToString();
            list.CreateDate         = DateTime.Now.ToString();
            list.CreateUserID       = int.Parse(Session["UserID"].ToString());
            list.ModifyDate         = DateTime.Now.ToString();
            list.ModifyUserID       = 0;
            list.Language           = MojoCube.Api.UI.Language.GetLanguage();
            ViewState["pk_Product"] = list.InsertData();
        }

        ImageBind();

        AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("success", "数据保存成功");
    }
Ejemplo n.º 6
0
    private string CreateContent()
    {
        StringBuilder sb = new StringBuilder();

        if (dtMain.Rows.Count > 0)
        {
            //增加点击数
            MojoCube.Web.Sql.AddClicks("Product_List", "pk_Product=" + dtMain.Rows[0]["pk_Product"].ToString(), int.Parse(dtMain.Rows[0]["Clicks"].ToString()));

            ViewState["pk_Product"]  = dtMain.Rows[0]["pk_Product"].ToString();
            ViewState["CategoryID1"] = dtMain.Rows[0]["CategoryID1"].ToString();
            ViewState["CategoryID2"] = dtMain.Rows[0]["CategoryID2"].ToString();
            ViewState["IsComment"]   = dtMain.Rows[0]["IsComment"].ToString();

            MojoCube.Web.Product.Category category = new MojoCube.Web.Product.Category();
            if (ViewState["CategoryID2"].ToString() != "0")
            {
                category.GetData(int.Parse(ViewState["CategoryID2"].ToString()));
            }
            else
            {
                category.GetData(int.Parse(ViewState["CategoryID1"].ToString()));
            }
            hlTitle.Text = category.CategoryName;

            ImageDiv.InnerHtml = CreateImageList(dtMain.Rows[0]["ImagePath"].ToString());

            sb.Append("<ul class=\"attribute\">");

            sb.Append("<li>产品价格:<span class=\"price\" style=\"font-size:18pt;\">" + MojoCube.Web.String.GetCurrency(decimal.Parse(dtMain.Rows[0]["Price"].ToString())) + "</span></li>");

            sb.Append("<li>产品编号:" + dtMain.Rows[0]["Number"].ToString() + "</li>");

            string[] attribute = dtMain.Rows[0]["Attribute"].ToString().Split('|');

            if (attribute.Length > 0)
            {
                for (int i = 0; i < attribute.Length; i++)
                {
                    if (attribute[i] != "")
                    {
                        sb.Append("<li>" + attribute[i] + "</li>");
                    }
                }
            }

            sb.Append("<li>浏览:" + dtMain.Rows[0]["Clicks"].ToString() + "</li>");
            sb.Append("<li>上架:" + DateTime.Parse(dtMain.Rows[0]["CreateDate"].ToString()).ToString("yyyy-MM-dd") + "</li>");
            sb.Append("<li>" + dtMain.Rows[0]["Subtitle"].ToString() + "</li>");
            sb.Append("</ul>");

            lblTitle.Text = dtMain.Rows[0]["ProductName"].ToString();

            AttributeDiv.InnerHtml = sb.ToString();

            sb.Clear();
            sb.Append(dtMain.Rows[0]["Description"].ToString());
        }

        return(sb.ToString());
    }