protected void btnExport_Click(object sender, EventArgs e)
 {
     model = PageHelper.GetModel<KQMLeaveApplyYearQryModel>(pnlContent.Controls);
     model.LeaveYear = Convert.ToInt32(this.ddlLeaveyear.SelectedValue.ToString());
     string BatchEmployeeNo = "";
     string str = this.txtBatchEmployeeNo.Text.Trim();
     if (str != "")
     {
         for (int i = 0; i < str.Split('\n').Length; i++)
         {
             BatchEmployeeNo = BatchEmployeeNo + str.Split('\n')[i].Trim() + "§";
         }
     }
     string joindatefrom = this.txtJoinDateFrom.Text.Trim();
     string joindateto = this.txtJoinDateTo.Text.Trim();
     string countdatefrom = this.txtCountDateFrom.Text.Trim();
     string countdateto = this.txtCountDateTo.Text.Trim();
     string Status = "";
     if (!string.IsNullOrEmpty(this.ddlStatus.SelectedValue.ToString()))
     {
         string[] temVal = ddlStatus.SelectedValuesToString(",").Split(',');
         for (int iLoop = 0; iLoop < temVal.Length; iLoop++)
         {
             Status += "'" + temVal[iLoop] + "',";
         }
         Status = Status.Substring(0, Status.Length - 1);
     }
     string sql = SqlDep;
     dt = bllLeaveApplyYearQry.GetLeaveApplyYearForExport(model, sql, BatchEmployeeNo, joindatefrom, joindateto, countdatefrom, countdateto, Status);
     if (dt.Rows.Count == 0)
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "nodataexport", "alert('" + Message.NoDataExport + "');", true);
     }
     else
     {
         List<KQMLeaveApplyYearQryModel> list = bllLeaveApplyYearQry.GetList(dt);
         string[] header = { ControlText.gvDepName, ControlText.gvWorkNo, ControlText.gvLocalName, ControlText.gvSex, ControlText.gvKQMJoinDate, ControlText.gvEnableStartDate, ControlText.gvLeaveYear, ControlText.gvStartYears, ControlText.gvEndYears, ControlText.gvOutWorkYears, ControlText.gvOutFoxconnYears, ControlText.gvStandardDays, ControlText.gvAlreadDays, ControlText.gvKQMLeaveDays, ControlText.gvNextYearDays, ControlText.gvLeaveRecDays, ControlText.gvCountDays, ControlText.gvStatus, ControlText.gvUpdateDate };
         string[] properties = { "DepName", "WorkNo", "LocalName", "SexName", "JoinDate", "EnableStartDate", "LeaveYear", "StartYears", "EndYears", "OutWorkYears", "OutFoxconnYears", "StandardDays", "AlreadDays", "LeaveDays", "NextYearDays", "LeaveRecDays", "CountDays", "StatusName", "UpdateDate" };
         string filePath = MapPath("~/ExportFileTemp/") + DateTime.Now.Ticks + ".xls";
         NPOIHelper.ExportExcel(list, header, properties, 5000, filePath);
         PageHelper.ReturnHTTPStream(filePath, true);
     }
 }
 private void Query()
 {
     int totalCount = 0;
     model = PageHelper.GetModel<KQMLeaveApplyYearQryModel>(pnlContent.Controls);
     model.LeaveYear=Convert.ToInt32(this.ddlLeaveyear.SelectedValue.ToString());
     string BatchEmployeeNo = "";
     string str = this.txtBatchEmployeeNo.Text.Trim();
     if (str != "")
     {
         for (int i = 0; i < str.Split('\n').Length; i++)
         {
             BatchEmployeeNo = BatchEmployeeNo + str.Split('\n')[i].Trim() + "§";
         }
     }
     string joindatefrom = this.txtJoinDateFrom.Text.Trim();
     string joindateto = this.txtJoinDateTo.Text.Trim();
     string countdatefrom = this.txtCountDateFrom.Text.Trim();
     string countdateto = this.txtCountDateTo.Text.Trim();
     string Status = "";
     if (!string.IsNullOrEmpty(this.ddlStatus.SelectedValue.ToString()))
     {
         string[] temVal = ddlStatus.SelectedValuesToString(",").Split(',');
         for (int iLoop = 0; iLoop < temVal.Length; iLoop++)
         {
             Status += "'" + temVal[iLoop] + "',";
         }
         Status = Status.Substring(0, Status.Length - 1);
     }
     string sql = SqlDep;
     dt_global = bllLeaveApplyYearQry.GetLeaveApplyYear(model,sql, BatchEmployeeNo, joindatefrom, joindateto, countdatefrom, countdateto, Status, pager.CurrentPageIndex, pager.PageSize, out totalCount);
     this.UltraWebGridLeaveQry.DataSource = dt_global.DefaultView;
     this.UltraWebGridLeaveQry.DataBind();
     pager.RecordCount = totalCount;
     pager.TextAfterPageIndexBox = "/" + pager.PageCount.ToString();
 }