예제 #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.Download.Category category = new MojoCube.Web.Download.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        = "下载分类编辑";
            }
        }
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["OrderByKey"]  = "pk_Download";
            ViewState["OrderByType"] = true;

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

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

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

                lblTitle.Text = "全部";
            }

            CategoryDiv.InnerHtml = CreateCategory();
            GridBind();
            this.Title = "下载列表";
        }
    }
예제 #3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (txtCategoryName.Text.Trim() == "")
        {
            AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("danger", "请填写名称");
            return;
        }

        MojoCube.Web.Download.Category category = new MojoCube.Web.Download.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", "数据保存成功");
    }
예제 #4
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        MojoCube.Web.Download.Category category = new MojoCube.Web.Download.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("Download_Category", "pk_Category", ((Label)GridView1.Rows[index].FindControl("lblID")).Text, -1);
        }
        //下移
        if (e.CommandName == "_down")
        {
            MojoCube.Web.Sql.SetSortID("Download_Category", "pk_Category", ((Label)GridView1.Rows[index].FindControl("lblID")).Text, 1);
        }
        GridBind(null);
    }
예제 #5
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 = "Download/" + txtPageName.Text.Trim();
        upload.FileName = MojoCube.Api.Text.Function.DateTimeString(true);
        upload.DoFileUpload(fuFile);

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

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

            MojoCube.Web.Download.Category category = new MojoCube.Web.Download.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();
            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.FileName = upload.OldFileName;
                list.FilePath = upload.OldFilePath;
                list.FileType = upload.FileType;
                list.FileSize = upload.FileSize;
                SetImage(list.FileType, list.FilePath);
            }
            list.ModifyDate   = DateTime.Now.ToString();
            list.ModifyUserID = int.Parse(Session["UserID"].ToString());
            list.UpdateData(list.pk_Download);
        }
        //新增
        else
        {
            MojoCube.Web.Download.Category category = new MojoCube.Web.Download.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;
            list.Author          = string.Empty;
            list.Source          = string.Empty;
            list.SourceUrl       = string.Empty;
            list.ImagePath       = string.Empty;
            if (upload.IsUpload)
            {
                list.FileName = upload.OldFileName;
                list.FilePath = upload.OldFilePath;
                list.FileType = upload.FileType;
                list.FileSize = upload.FileSize;
                SetImage(list.FileType, list.FilePath);
            }
            else
            {
                list.FileName = string.Empty;
                list.FilePath = string.Empty;
                list.FileType = string.Empty;
                list.FileSize = 0;
            }
            list.Version             = string.Empty;
            list.Issue               = cbIssue.Checked;
            list.IsComment           = false;
            list.IsRecommend         = false;
            list.Clicks              = 0;
            list.Downloads           = 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_Download"] = list.InsertData();
        }

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