Ejemplo n.º 1
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.Album.Category category = new MojoCube.Web.Album.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.º 2
0
    private void CreateContent()
    {
        if (dtMain.Rows.Count > 0)
        {
            //增加点击数
            MojoCube.Web.Sql.AddClicks("Album_List", "pk_Album=" + dtMain.Rows[0]["pk_Album"].ToString(), int.Parse(dtMain.Rows[0]["Clicks"].ToString()));

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

            MojoCube.Web.Album.Category category = new MojoCube.Web.Album.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;

            imgMain.ImageUrl = "Files.aspx?image=" + MojoCube.Api.Text.Security.EncryptString(dtMain.Rows[0]["ImagePath"].ToString());

            ImageDiv.InnerHtml = CreateImageList();

            ContentDiv.InnerHtml = dtMain.Rows[0]["Description"].ToString();
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["OrderByKey"]  = "pk_Album";
            ViewState["OrderByType"] = true;

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

                MojoCube.Web.Album.Category category = new MojoCube.Web.Album.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.º 4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (txtCategoryName.Text.Trim() == "")
        {
            AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("danger", "请填写名称");
            return;
        }

        MojoCube.Web.Album.Category category = new MojoCube.Web.Album.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.º 5
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.Album.Category category = new MojoCube.Web.Album.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) + "/detailGlide.css");
        header.AddCSS("Themes/" + MojoCube.Web.Site.Cache.GetSiteTheme(strLanguage) + "/style.css");
        header.AddCSS("Themes/" + MojoCube.Web.Site.Cache.GetSiteTheme(strLanguage) + "/lightgallery.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.º 6
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        MojoCube.Web.Album.Category category = new MojoCube.Web.Album.Category();
        int index = Convert.ToInt32(e.CommandArgument);

        //删除
        if (e.CommandName == "_delete")
        {
            category.DeleteData(int.Parse(((Label)GridView1.Rows[index].FindControl("lblID")).Text));
        }
        //上移
        if (e.CommandName == "_up")
        {
            MojoCube.Web.Sql.SetSortID("Album_Category", "pk_Category", ((Label)GridView1.Rows[index].FindControl("lblID")).Text, -1);
        }
        //下移
        if (e.CommandName == "_down")
        {
            MojoCube.Web.Sql.SetSortID("Album_Category", "pk_Category", ((Label)GridView1.Rows[index].FindControl("lblID")).Text, 1);
        }
        GridBind(null);
    }
Ejemplo n.º 7
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (txtTitle.Text.Trim() == "")
        {
            AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("danger", "请填写标题");
            return;
        }

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

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

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

            MojoCube.Web.Album.Category category = new MojoCube.Web.Album.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.Title           = txtTitle.Text.Trim();
            list.PageName        = txtPageName.Text.Trim();
            list.Subtitle        = txtSubtitle.Text.Trim();
            list.Description     = txtDescription.Text.Trim();
            list.Issue           = cbIssue.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_Album);
        }
        //新增
        else
        {
            MojoCube.Web.Album.Category category = new MojoCube.Web.Album.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.PageName    = txtPageName.Text.Trim();
            list.Title       = txtTitle.Text.Trim();
            list.Subtitle    = txtSubtitle.Text.Trim();
            list.Description = txtDescription.Text.Trim();
            if (txtSEO_Title.Text.Trim() != "")
            {
                list.SEO_Title = txtSEO_Title.Text.Trim();
            }
            else
            {
                list.SEO_Title = txtTitle.Text.Trim();
            }
            list.SEO_Keyword     = txtSEO_Keyword.Text.Trim();
            list.SEO_Description = txtSEO_Description.Text.Trim();
            list.Tags            = string.Empty;
            list.Visual          = string.Empty;
            if (upload.IsUpload)
            {
                list.ImagePath = upload.OldFilePath;
                SetImage(list.ImagePath);
            }
            else
            {
                list.ImagePath = string.Empty;
            }
            list.Issue            = cbIssue.Checked;
            list.IsComment        = false;
            list.IsRecommend      = false;
            list.Clicks           = 0;
            list.SortID           = 0;
            list.TypeID           = 0;
            list.Score            = 0;
            list.ScoreIn          = 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_Album"] = list.InsertData();
        }

        ImageBind();

        AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("success", "数据保存成功");
    }