protected void pager_PageChanged(object sender, EventArgs e) { modelKaoQin = PageHelper.GetModel<KQMReGetKaoQinModel>(pnlContent.Controls); modelKaoQin.DCode = txtDepCode.Text.Trim().ToString(); DataUIBind(); this.txtBatchEmployeeNo.Text = ""; }
protected void btnExport_Click(object sender, EventArgs e) { if (dt.Rows.Count != 0) { modelKaoQin = PageHelper.GetModel<KQMReGetKaoQinModel>(pnlContent.Controls); List<KQMReGetKaoQinModel> list = bllKaoQin.GetModelList(dt); string[] header = { ControlText.gvDepName, ControlText.gvWorkNo, ControlText.gvLocalName, ControlText.gvKQDate, ControlText.gvStatusName, ControlText.gvShiftDesc, ControlText.gvOnDutyTime, ControlText.gvOffDutyTime, ControlText.gvOTOnDutyTime, ControlText.gvOTOffDutyTime, ControlText.gvAbsentQty, ControlText.gvExceptionName, ControlText.gvHeadReasonName, ControlText.gvReasonRemark }; string[] properties = { "DepName", "WorkNo", "LocalName", "KQDate", "StatusName", "ShiftDesc", "OnDutyTime", "OffDutyTime", "OTOnDutyTime", "OTOffDutyTime", "AbsentQty", "ExceptionName", "ReasonName", "ReasonRemark" }; 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 btnQuery_Click(object sender, EventArgs e) { modelKaoQin = PageHelper.GetModel<KQMReGetKaoQinModel>(pnlContent.Controls); modelKaoQin.DCode = txtDepCode.Text.Trim().ToString(); pager.CurrentPageIndex = 1; DataUIBind(); this.txtBatchEmployeeNo.Text = ""; }
protected void btnCount_Click(object sender, EventArgs e) { string alertText = ""; string alert = ""; string sWorkNo = ""; string sFromKQDate = ""; string sToKQDate = ""; if ((this.txtKQDateFrom.Text.Trim().Length == 0) || (this.txtKQDateTo.Text.Trim().Length == 0)) { alert = "alert('" + Message.KQDateNotNull + "')"; Page.ClientScript.RegisterStartupScript(GetType(), "show", alert, true); } else { string sysKqoQinDays = bllKaoQin.GetValueLastDay(); string strModifyDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM") + "/" + sysKqoQinDays).ToString("yyyy/MM/dd"); if (this.txtWorkNo.Text.ToString().Trim().Length > 0) { sWorkNo = this.txtWorkNo.Text.Trim(); if (sWorkNo.StartsWith("f")) { sWorkNo = sWorkNo.ToUpper(); } sFromKQDate = Convert.ToDateTime(this.txtKQDateFrom.Text.ToString()).ToString("yyyy/MM/dd"); if (!(CurrentUserInfo.RoleCode.ToString().Equals("ADMIN") || (sFromKQDate.CompareTo(DateTime.Now.AddDays(-30.0).ToString("yyyy/MM") + "/01") == -1))) { if ((sFromKQDate.CompareTo(DateTime.Now.ToString("yyyy/MM") + "/01") == -1) && (strModifyDate.CompareTo(DateTime.Now.ToString("yyyy/MM/dd")) <= 0)) { alertText = Message.checkreget + ":" + strModifyDate; alert = "alert('" + alertText + "')"; Page.ClientScript.RegisterStartupScript(GetType(), "show", alert, true); return; } if (sFromKQDate.CompareTo(DateTime.Now.AddMonths(-1).ToString("yyyy/MM") + "/01") == -1) { alertText = Message.checkreget + ":" + strModifyDate; alert = "alert('" + alertText + "')"; Page.ClientScript.RegisterStartupScript(GetType(), "show", alert, true); return; } } sToKQDate = this.txtKQDateTo.Text.ToString(); if (DateTime.Parse(sToKQDate) > DateTime.Today) { sToKQDate = DateTime.Today.ToString("yyyy/MM/dd"); } bllKaoQin.GetKaoQinData(sWorkNo, "null", sFromKQDate, sToKQDate); } else { if (this.UltraWebGridReGetKaoQin.Rows.Count == 0) { alert = "alert('" + Message.CheckQuery + "')"; Page.ClientScript.RegisterStartupScript(GetType(), "show", alert, true); return; } for (int i = 0; i < dt.Rows.Count; i++) { sWorkNo = dt.Rows[i]["WorkNo"].ToString(); sFromKQDate = Convert.ToDateTime(dt.Rows[i]["KQDate"].ToString()).ToString("yyyy/MM/dd"); if ((sFromKQDate.CompareTo(DateTime.Now.ToString("yyyy/MM") + "/01") == -1) && (strModifyDate.CompareTo(DateTime.Now.ToString("yyyy/MM/dd")) <= 0)) { if (!(CurrentUserInfo.RoleCode.ToString().Equals("ADMIN") && (sFromKQDate.CompareTo(DateTime.Now.AddDays(-30.0).ToString("yyyy/MM") + "/01") != -1))) { alertText = Message.checkreget + ":" + strModifyDate; alert = "alert('" + alertText + "')"; Page.ClientScript.RegisterStartupScript(GetType(), "show", alert, true); return; } } else if ((sFromKQDate.CompareTo(DateTime.Now.AddMonths(-1).ToString("yyyy/MM") + "/01") == -1) && !(this.Session["roleCode"].ToString().Equals("Admin") && (sFromKQDate.CompareTo(DateTime.Now.AddDays(-30.0).ToString("yyyy/MM") + "/01") != -1))) { alertText = Message.checkreget + ":" + strModifyDate; alert = "alert('" + alertText + "')"; Page.ClientScript.RegisterStartupScript(GetType(), "show", alert, true); return; } bllKaoQin.GetKaoQinData(sWorkNo, "null", sFromKQDate, sFromKQDate); } } } modelKaoQin = PageHelper.GetModel<KQMReGetKaoQinModel>(pnlContent.Controls); modelKaoQin.DCode = txtDepCode.Text.Trim().ToString(); pager.CurrentPageIndex = 1; DataUIBind(); this.txtBatchEmployeeNo.Text = ""; }