using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using xabaraCOM;

public partial class webXabara_study_cer : System.Web.UI.Page
{
    classify c = new classify();
    admin a = new admin();
    webPublic wp = new webPublic();
    sqlServer sql = new sqlServer();
    fileDocument f = new fileDocument();

    protected void Page_Load(object sender, EventArgs e)
    {
        a.check("|study|");

        if (!IsPostBack)
        {
            string searchWordTemp = Server.UrlDecode(xabara.safeSql(Request["keyWords"]));
            string strSql = string.Empty;
            string ifStr = string.Empty;
            long levelID = xabara.isNum(Request.QueryString["level"]);
            
            if (!string.IsNullOrEmpty(searchWordTemp as string))
            {
                ifStr += " and postID = '" + searchWordTemp + "'";
            }

            strSql = "select * from cerPic where 1=1" + ifStr + " order by flagID ASC,postDate ASC";
            //Response.Write(strSql);
            lblCurrentPage.Text = sql.RepeaterDB(RepeaterList, strSql, "&keyWords=" + Server.UrlEncode(searchWordTemp), 20, "page", "center", true);
        }
    }

    protected void SearchButton_Click(object sender, EventArgs e)
    {
        Response.Redirect("cer.aspx?keyWords=" + Server.UrlEncode(searchWord.Text.Trim()), true);
    }

    public string getClass(string id)
    {
        return c.readClassName_Link(xabara.isNum(id), string.Empty, string.Empty);
    }

    public string img(string str)
    {
        return f.picDisplay(str);
    }

    public string flag(string num)
    {
        return wp.cerFlag(num);
    }
}