using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class WebMain_task_WebUserControl : System.Web.UI.UserControl
{

    public string wherestring="";
    public string orderby="";
    public string subjectlong="5";
    public string linenum="5";
    public string linkurl = @"~/china/TaskView.aspx";

    public string WhereString
    {
        set
        {
            wherestring = value.ToString().Trim();
        }
    }
    public string OrderBy
    {
        set
        {
            orderby = value.ToString().Trim();
        }
    }
    public string SubjectLong
    {
        set
        {
            subjectlong = value.ToString().Trim();
        }
    }
    public string LineNum
    {
        set
        {
            linenum = value.ToString().Trim();
        }
    }

    //======数据表
    public string Link(string id)
    {

        return linkurl+"?Taskid="+id;
    }

    public string Subject(string subject)
    {
        string subj;
        if (subject.Length > Convert.ToUInt16(subjectlong))
        {
            subj = subject.Substring(0, Convert.ToUInt16(subjectlong));
        }
        else
        {
            subj = subject;
        }
        return subj;
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
        }
        else
        {
            if (wherestring == "")
            {
               
            }
            else
            {
                wherestring = "where " + wherestring;
            }

            if (orderby == "")
            {
               
            }
            else
            {
                orderby = "order by " + orderby;

            }

            object RD2 = CDatabase.DBSelect("select top "+linenum+" * from TaksInfo "+wherestring+" "+orderby);
            TaskSLDataList.DataSource = RD2;
            TaskSLDataList.DataBind();
            CDatabase.CloseConn();
        }
    }
}
