protected void btnExport_Click(object sender, EventArgs e)
 {
     if (ImportFlag.Value == "2")
     {
         if (dt.Rows.Count != 0)
         {
             model = PageHelper.GetModel<KQMLeaveYearImportModel>(pnlContent.Controls);
             List<KQMLeaveYearImportModel> list = bll.GetList(dt);
             string[] header = { ControlText.gvErrorMsg, ControlText.gvWorkNo, ControlText.gvLeaveYear, ControlText.gvLeaveDays };
             string[] properties = { "ErrorMsg", "WorkNo", "LeaveYear", "LeaveDays" };
             string filePath = MapPath("~/ExportFileTemp/") + DateTime.Now.Ticks + ".xls";
             NPOIHelper.ExportExcel(list, header, properties, 5000, filePath);
             PageHelper.ReturnHTTPStream(filePath, true);
         }
         else
         {
             lblupload.Text =Message.NoDataExport;
         }
     }
     else
     {
         if (dt.Rows.Count != 0)
         {
             model = PageHelper.GetModel<KQMLeaveYearImportModel>(pnlContent.Controls);
             string SQLDep = base.SqlDep;
             string depCode = model.DepCode;
             model.DepCode = null;
             model.DName = null;
             model.LeaveYear = Convert.ToInt32(ddlLeaveYear.SelectedValue.ToString() == "" ? null : ddlLeaveYear.SelectedValue.ToString());
             dt = bll.GetLeaveDaysList(model, SQLDep, depCode);
             List<KQMLeaveYearImportModel> list = bll.GetList(dt);
             string[] header = { ControlText.gvWorkNo, ControlText.gvLocalName, ControlText.gvBuOTMQryName, ControlText.gvDName,
                                 ControlText.gvLeaveYear, ControlText.gvLeaveDays, ControlText.gvCreateUser, ControlText.gvCreateDate };
             string[] properties = { "WorkNo", "LocalName", "BuOTMQryName", "DName", "LeaveYear", "LeaveDays", "CreateUser", "CreateDate" };
             string filePath = MapPath("~/ExportFileTemp/") + DateTime.Now.Ticks + ".xls";
             NPOIHelper.ExportExcel(list, header, properties, 5000, filePath);
             PageHelper.ReturnHTTPStream(filePath, true);
         }
         else
         {
             lblupload.Text = Message.NoDataExport;
         }
     }
 }
 protected void pager_PageChanged(object sender, EventArgs e)
 {
     model = PageHelper.GetModel<KQMLeaveYearImportModel>(pnlContent.Controls);
     ImportFlag.Value = "1";
     DataUIBind();
 }
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     int intDeleteOk = 0;
     int intDeleteError = 0;
     TemplatedColumn tcol = (TemplatedColumn)this.UltraWebGrid.Bands[0].Columns[0];
     for (int i = 0; i < this.UltraWebGrid.Rows.Count; i++)
     {
         CellItem GridItem = (CellItem)tcol.CellItems[i];
         CheckBox chkIsHaveRight = (CheckBox)GridItem.FindControl("CheckBoxCell");
         if (chkIsHaveRight.Checked)
         {
             logmodel.ProcessFlag = "delete";
             model.WorkNo = this.UltraWebGrid.Rows[i].Cells.FromKey("WorkNo").Text.Trim();
             model.LeaveYear = Convert.ToInt32(this.UltraWebGrid.Rows[i].Cells.FromKey("LeaveYear").Text.Trim());
             int flag = bll.DeleteLeaveYearByKey(model, logmodel);
             if (flag == 1)
             {
                 intDeleteOk++;
             }
             else
             {
                 intDeleteError++;
             }
         }
     }
     if ((intDeleteOk + intDeleteError) > 0)
     {
         string alertText = "成功刪除:" + intDeleteOk + "," + "刪除失敗:" + intDeleteError;
         Page.ClientScript.RegisterStartupScript(GetType(), "show", "alert('" + alertText + "')", true);
     }
     pager.CurrentPageIndex = 1;
     PageHelper.CleanControlsValue(pnlContent.Controls);
     model = new KQMLeaveYearImportModel();
     int thisYear = DateTime.Now.Year;
     this.ddlLeaveYear.SelectedIndex = this.ddlLeaveYear.Items.IndexOf(this.ddlLeaveYear.Items.FindByValue(Convert.ToString(thisYear)));
     DataUIBind();
 }
 protected void btnQuery_Click(object sender, EventArgs e)
 {
     model = PageHelper.GetModel<KQMLeaveYearImportModel>(pnlContent.Controls);
     ImportFlag.Value = "1";
     pager.CurrentPageIndex = 1;
     DataUIBind();
 }