using System;
using System.Data;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EKETEAM.Data;
using EKETEAM.FrameWork;
using EKETEAM.UserControl;
using System.Text;

namespace eFrameWork.Application
{
    public partial class Check_Plans_MoreList : System.Web.UI.Page
    {
        public string UserArea = "Application";
        public string AppItem = eParameters.Request("AppItem");
        public eModel model;
        public eList elist;
        public eUser user;




        string sql = "";

        public string code = eParameters.QueryString("code");
        protected void Page_Load(object sender, EventArgs e)
        {
            user = new eUser(eBase.getUserArea(UserArea));
            eModelInfo customModel = new eModelInfo(user);
            model = customModel.Model;


           
            string act = eParameters.QueryString("act");
            if (act.Length > 0)
            {
            }
            else
            {

                List();
            }
        }

        private void List()
        {
            elist = new eList("CheckPlans");
            eDataTable.ItemDataBound += new RepeaterItemEventHandler(eDataTable_ItemDataBound);
            elist.Bind(eDataTable, ePageControl1);
            if (ePageControl1.RecordsCount == 0) LitNoResords.Text = "<div style=\"padding:15px;text-align:center\">暂无数据!</div>";
        }
        protected void eDataTable_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string baseName = DataBinder.Eval(e.Item.DataItem, "BaseName").ToString();
                Control ctrl = e.Item.Controls[0];
                Literal lit = (Literal)ctrl.FindControl("litPlanCount");
                if (lit != null)
                {
                    lit.Text = eOleDB.getValue("select count(*) from Check_plan where CheckPlanID='" + DataBinder.Eval(e.Item.DataItem, "CheckPlanID").ToString() + "'");
                }
                lit = (Literal)ctrl.FindControl("litResultCount");
                if (lit != null)
                {
                    lit.Text = eOleDB.getValue("select count(*) from Check_other where CheckPlanID='" + DataBinder.Eval(e.Item.DataItem, "CheckPlanID").ToString() + "'"); 
                }
                
            }
        }
    }
}