Exemple #1
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (edtTitle.Text == "")
     {
         Label1.Text = "标题不能为空";
         return;
     }
     if (txtContent.Text == "")
     {
         Label1.Text = "内容不能为空";
         return;
     }
     int id = GetID();
     mod_article art = new mod_article(id);
     art.Title = edtTitle.Text;
     art.Content = txtContent.Text;
     art.IsTop = 0;
     art.CID = cms.StrToInt(ddlClass.SelectedValue);
     if (chkIstop.Checked)
         art.IsTop = 1;
     string ret = art.Save();
     if (ret == "")
         Response.Redirect("admArticleList.aspx");
     else
         Label1.Text = "保存失败:" + ret;
 }
Exemple #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (edtTitle.Text == "")
        {
            Label1.Text = "标题不能为空";
            return;
        }
        if (txtContent.Text == "")
        {
            Label1.Text = "内容不能为空";
            return;
        }
        int         id  = GetID();
        mod_article art = new mod_article(id);

        art.Title   = edtTitle.Text;
        art.Content = txtContent.Text;
        art.IsTop   = 0;
        art.CID     = cms.StrToInt(ddlClass.SelectedValue);
        if (chkIstop.Checked)
        {
            art.IsTop = 1;
        }
        string ret = art.Save();

        if (ret == "")
        {
            Response.Redirect("admArticleList.aspx");
        }
        else
        {
            Label1.Text = "保存失败:" + ret;
        }
    }
Exemple #3
0
 private void load()
 {
     int id = GetID();
     loadClass();
     mod_article art = new mod_article(id);
     edtTitle.Text = art.Title;
     ddlClass.SelectedValue = art.CID.ToString();
     chkIstop.Checked = art.IsTop == 1;
     txtContent.Text = art.Content;
     lbFlag.Text = "添加文章";
     if (id > 0)
         lbFlag.Text = "编辑文章";
     Button2.Visible = id > 0;
 }
Exemple #4
0
    private void load()
    {
        int id = GetID();

        loadClass();
        mod_article art = new mod_article(id);

        edtTitle.Text          = art.Title;
        ddlClass.SelectedValue = art.CID.ToString();
        chkIstop.Checked       = art.IsTop == 1;
        txtContent.Text        = art.Content;
        lbFlag.Text            = "添加文章";
        if (id > 0)
        {
            lbFlag.Text = "编辑文章";
        }
        Button2.Visible = id > 0;
    }
Exemple #5
0
 //显示文章
 public static void GetArticle(Page page)
 {
     int id = 0;
     if (page.Request.QueryString["id"] != null)
         id = StrToInt(page.Request.QueryString["id"].ToString());
     if (id == 0)
     {
         page.Response.Redirect("./index.aspx");
         return;
     }
     string str = GetTemplateContent("article");
     mod_article art = new mod_article(id);
     str = str.Replace("<@title>", art.Title);
     str = str.Replace("<@date>", art.FDate);
     str = str.Replace("<@content>", art.Content);
     str = str.Replace("<@last>", art.Last());
     str = str.Replace("<@next>", art.Next());
     page.Response.Write(str);
 }
Exemple #6
0
    //显示文章
    public static void GetArticle(Page page)
    {
        int id = 0;

        if (page.Request.QueryString["id"] != null)
        {
            id = StrToInt(page.Request.QueryString["id"].ToString());
        }
        if (id == 0)
        {
            page.Response.Redirect("./index.aspx");
            return;
        }
        string      str = GetTemplateContent("article");
        mod_article art = new mod_article(id);

        str = str.Replace("<@title>", art.Title);
        str = str.Replace("<@date>", art.FDate);
        str = str.Replace("<@content>", art.Content);
        str = str.Replace("<@last>", art.Last());
        str = str.Replace("<@next>", art.Next());
        page.Response.Write(str);
    }