Esempio n. 1
0
    protected void RpGBre_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        GBmessageInfo info = gbBLL.GetDataById(id);
        Literal       lt   = (Literal)e.Item.FindControl("litTitle");

        lt.Text = "Re:" + info.gb_title;
    }
Esempio n. 2
0
 protected void Bind()
 {
     if (id != 0)
     {
         if (Tools.TryParseMethod(id.ToString()) > 0)
         {
             GBmessageInfo info = gbBLL.GetDataById(id);
             lbCategory.Text = gbcBLL.GetDataById(info.gbc_Id).gbc_title;
             lbName.Text     = info.gb_name;
             lbMail.Text     = info.gb_mail;
             lbIp.Text       = info.gb_ip;
             lbLevel.Text    = info.gb_level;
             lbTitle.Text    = info.gb_title;
             lbHits.Text     = info.gb_hits.ToString();
             if (info.gb_show_mail)
             {
                 lbShowMail.Text = "是";
             }
             else
             {
                 lbShowMail.Text = "否";
             }
             Ckeditorl1.Text      = info.gb_content;
             lbCreateDate.Text    = info.gb_createdate.ToShortDateString();
             lbEditDate.Text      = info.gb_editdate.ToShortDateString();
             rbShow.SelectedValue = info.gb_show.ToString();
         }
     }
 }
Esempio n. 3
0
    protected void lkbtnReport_Command(object sender, CommandEventArgs e)
    {
        GBmessageInfo info = gbBLL.GetDataById(int.Parse(e.CommandArgument.ToString()));

        info.gb_hits += 1;
        gbBLL.Update(info);
        Response.Redirect("GBReport.aspx?id=" + e.CommandArgument.ToString());
    }
Esempio n. 4
0
    public List <GBmessageInfo> GetDataByCategoryId(int gbc_id)
    {
        List <GBmessageInfo> infos  = new List <GBmessageInfo>();
        IDataReader          reader = db.GetDataByCategoryId(gbc_id).CreateDataReader();

        while (reader.Read())
        {
            infos.Add(GBmessageInfo.Populate(reader));
        }
        return(infos);
    }
Esempio n. 5
0
    public GBmessageInfo GetDataById(int gb_id)
    {
        GBmessageInfo info   = new GBmessageInfo();
        IDataReader   reader = db.GetDataById(gb_id).CreateDataReader();

        if (reader.Read())
        {
            info = GBmessageInfo.Populate(reader);
        }
        return(info);
    }
Esempio n. 6
0
    public static GBmessageInfo Populate(IDataReader reader)
    {
        GBmessageInfo info = new GBmessageInfo();

        for (int i = 0; i < reader.FieldCount; i++)
        {
            PropertyInfo property = info.GetType().GetProperty(reader.GetName(i));
            Type         propType = property.PropertyType;
            TypeConverters.ITypeConverter typeConverter = TypeConverters.TypeConverterFactory.GetConvertType(propType);
            property.SetValue(info, Convert.ChangeType(typeConverter.Convert(reader.GetValue(i)), propType), null);
        }
        return(info);
    }
Esempio n. 7
0
 protected void Bind()
 {
     if (id != 0)
     {
         if (Tools.TryParseMethod(id.ToString()) > 0)
         {
             GBmessageInfo info = gbBLL.GetDataById(id);
             lbCategory.Text      = gbcBLL.GetDataById(info.gbc_Id).gbc_title;
             lbTitle.Text         = info.gb_title;
             Repeater1.DataSource = gBLL.GetDataByCategoryId(info.gb_ID);
             Repeater1.DataBind();
         }
     }
 }
Esempio n. 8
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        GBmessageInfo info = gbBLL.GetDataById(id);

        info.gbc_Id       = int.Parse(ddlCategory.SelectedValue);
        info.gb_name      = txtName.Text;
        info.gb_mail      = txtMail.Text;
        info.gb_show_mail = bool.Parse(ChkVisible.Checked.ToString());
        info.gb_title     = txtTitle.Text;
        info.gb_content   = Ckeditorl1.Text;
        info.gb_editdate  = DateTime.Now;
        if (gbBLL.Update(info) > 0)
        {
            Response.Redirect("List.aspx?header=" + Getmessage("30014"));
        }
    }
Esempio n. 9
0
 protected void Bind()
 {
     if (id != 0)
     {
         if (Tools.TryParseMethod(id.ToString()) > 0)
         {
             GBmessageInfo info = gbBLL.GetDataById(id);
             Page.Title        = info.gb_title;
             lbTitle.Text      = info.gb_title;
             lbHits.Text       = info.gb_hits.ToString();
             lbName.Text       = info.gb_name;
             litContent.Text   = info.gb_content;
             lbCreateDate.Text = info.gb_createdate.ToString("yyyy/MM/dd hh:mm");
             lbEditDate.Text   = info.gb_editdate.ToString("yyyy/MM/dd hh:mm");
             txtTitle.Text     = "Re:" + info.gb_title;
         }
     }
 }
Esempio n. 10
0
 protected void Bind()
 {
     if (id != 0)
     {
         if (Tools.TryParseMethod(id.ToString()) > 0)
         {
             GBmessageInfo info = gbBLL.GetDataById(id);
             ddlCategory.SelectedValue = info.gbc_Id.ToString();
             txtName.Text       = info.gb_name;
             txtMail.Text       = info.gb_mail;
             ChkVisible.Checked = info.gb_show_mail;
             txtTitle.Text      = info.gb_title;
             Ckeditorl1.Text    = info.gb_content;
             txtCreatedate.Text = info.gb_createdate.ToShortDateString();
             txtEditdate.Text   = info.gb_editdate.ToShortDateString();
         }
     }
 }
Esempio n. 11
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        GBmessageInfo info = new GBmessageInfo();

        info.gbc_Id        = int.Parse(ddlCategory.SelectedValue);
        info.gb_name       = txtName.Text;
        info.gb_mail       = txtMail.Text;
        info.gb_show_mail  = bool.Parse(ChkVisible.Checked.ToString());
        info.gb_ip         = Tools.GetIpAddress();
        info.gb_title      = txtTitle.Text;
        info.gb_content    = Ckeditorl1.Text;
        info.gb_createdate = DateTime.Now;
        info.gb_editdate   = DateTime.Now;
        info.gb_show       = bool.Parse(rbShow.SelectedValue);
        if (gbBLL.Insert(info) > 0)
        {
            Response.Redirect("List.aspx?header=" + Getmessage("30009"));
        }
    }
Esempio n. 12
0
 public int Update(GBmessageInfo info)
 {
     return(db.Update(info.gbc_Id, info.gb_name, info.gb_mail, info.gb_show_mail, info.gb_ip, info.gb_level, info.gb_title, info.gb_content, info.gb_createdate, info.gb_editdate, info.gb_hits, info.gb_show, info.gb_ID));
 }