using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HySoft.BaseCallCenter.BLL;

namespace HySoft.BaseCallCenter.Web.calloutmanage
{
    public partial class callplantaskresultdata : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //txtStartTime.Text = DateTime.Now.ToString("yyyy-MM-01");
            //txtEndTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
            string sqlwhere = "F_SeatFlag=1";
            BindAccount(ddlAccount, sqlwhere);
            BindHJJG();
        }
        private void BindHJJG()
        {
            dropHJJG.DataSource = new BLL.T_Sys_DictionaryValue().GetList("F_DictionaryFlag='HJJG' order by F_Sort ").Tables[0];
            dropHJJG.DataValueField = "F_DictionaryValueId";
            dropHJJG.DataTextField = "F_Name";
            dropHJJG.DataBind();
            dropHJJG.Items.Insert(0, new ListItem("--全部--", ""));
        }
        /// <summary>
        ///绑定坐席列表
        /// </summary>
        /// <param name="ddl"></param>
        /// <param name="p_Condition"></param>
        private void BindAccount(DropDownList ddl, string strwhere)
        {
            T_Sys_UserAccount t = new T_Sys_UserAccount();
            ddl.DataSource = t.GetList(strwhere);
            ddl.DataValueField = "F_UserId";
            ddl.DataTextField = "F_UserName";
            ddl.DataBind();
            ddl.Items.Insert(0, new ListItem("--全部--", ""));
        }

        protected void exportExcel_Click(object sender, EventArgs e)
        {
            string fileName = "回访报表" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
            Response.Clear();
            Response.Charset = "GB2312";
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName));
            Response.ContentType = "application/ms-excel";
            Response.Write(this.htHtmlReport.Value);
            Response.End();
        }

    }
}