コード例 #1
0
 protected void btnExport_Click(object sender, EventArgs e)
 {
     model = PageHelper.GetModel<BellCardDataModel>(pnlContent.Controls);
     string fromdate = this.txtFromDate.Text.Trim();
     string todate = this.txtToDate.Text.Trim();
     string sql = base.SqlDep;
     if (model != null)
     {
         if (this.chkHisFlag.Checked)
         {
             dt = bellCardQueryBll.GetBellCardDataForExport(model, sql, true, fromdate, todate);
         }
         else
         {
             dt = bellCardQueryBll.GetBellCardDataForExport(model, sql, false, fromdate, todate);
         }
     }
     if (dt.Rows.Count == 0)
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "nodataexport", "alert('" + Message.NoDataExport + "');", true);
     }
     else
     {
         List<BellCardDataModel> list = bellCardQueryBll.GetList(dt);
         string[] header = { ControlText.gvWorkNo, ControlText.gvLocalName, ControlText.gvDName, ControlText.gvCardTime, ControlText.gvCardTimeMM, ControlText.gvCardNo, ControlText.gvBellNo, ControlText.gvAddRess };
         string[] properties = { "WorkNo", "LocalName", "DepName", "CardTime", "CardTimeMM", "CardNo", "BellNo", "AddRess" };
         string filePath = MapPath("~/ExportFileTemp/") + DateTime.Now.Ticks + ".xls";
         NPOIHelper.ExportExcel(list, header, properties, 5000, filePath);
         PageHelper.ReturnHTTPStream(filePath, true);
     }
 }
コード例 #2
0
        private void Query()
        {
            int totalCount = 0;
            model = PageHelper.GetModel<BellCardDataModel>(pnlContent.Controls);
            string fromdate = this.txtFromDate.Text.Trim();
            string todate = this.txtToDate.Text.Trim();
            string sql = base.SqlDep;
            if (model != null)
            {
                if (this.chkHisFlag.Checked)
                {
                    dt_global = bellCardQueryBll.GetBellCardData(model, sql, true, fromdate, todate, pager.CurrentPageIndex, pager.PageSize, out totalCount);
                }
                else
                {
                    dt_global = bellCardQueryBll.GetBellCardData(model, sql, false, fromdate, todate, pager.CurrentPageIndex, pager.PageSize, out totalCount);
                }
                pager.RecordCount = totalCount;
                this.UltraWebGridBellCardQuery.DataSource = dt_global.DefaultView;
                this.UltraWebGridBellCardQuery.DataBind();
                pager.TextAfterPageIndexBox = "/" + pager.PageCount.ToString();
            }

            //string condition = "";
            //string strTableName = "KQM_BELLCARDDATA";
            //if (this.ProcessFlag.Value.ToLower().Equals("condition") || WindowOpen)
            //{
            //    if (!(base.CheckData(this.textBoxFromDate.Text.ToString(), "bfw.kqm_bellcard.carddate") && base.CheckData(this.textBoxToDate.Text, "bfw.kqm_bellcard.carddate")) || ((((this.ddlBellNo.SelectedValue.Length == 0) && (this.textBoxWorkNo.Text.Trim().Length == 0)) && (this.textBoxName.Text.Trim().Length == 0)) && !base.CheckData(this.textBoxWorkNo.Text.ToString(), "common.employeeno")))
            //    {
            //        return;
            //    }
            //    if ((this.ddlBellNo.SelectedValue.Length == 0) && base.bPrivileged)
            //    {
            //        condition = condition + " AND exists (SELECT 1 FROM (" + base.sqlDep + ") e where e.DepCode=b.DCode)";
            //    }
            //    if (this.textBoxWorkNo.Text.Trim().Length != 0)
            //    {
            //        condition = condition + " AND b.WorkNo = '" + this.textBoxWorkNo.Text.ToUpper().Trim() + "'";
            //    }
            //    if (this.textBoxName.Text.Trim().Length != 0)
            //    {
            //        condition = condition + " AND b.LocalName like '" + this.textBoxName.Text.Trim() + "%'";
            //    }
            //    if (((this.textBoxWorkNo.Text.Trim().Length == 0) && (this.textBoxName.Text.Trim().Length == 0)) && !base.CheckDateMonths(this.textBoxFromDate.Text.Trim(), this.textBoxToDate.Text.Trim()))
            //    {
            //        return;
            //    }
            //    if (this.ddlBellNo.SelectedValue != "")
            //    {
            //        condition = condition + " and a.BellNo ='" + this.ddlBellNo.SelectedValue + "'";
            //    }
            //    condition = (condition + " AND a.CardTime >= to_date('" + DateTime.Parse(this.textBoxFromDate.Text.Trim()).ToString("yyyy/MM/dd") + " 00:00','yyyy/MM/dd hh24:mi') ") + " AND a.CardTime <= to_date('" + DateTime.Parse(this.textBoxToDate.Text.Trim()).ToString("yyyy/MM/dd") + " 23:59','yyyy/MM//dd hh24:mi') ";
            //    if (this.CheckBoxHisFlag.Checked)
            //    {
            //        strTableName = "KQM_BELLCARDDATA_HIS";
            //    }
            //    this.ViewState.Add("condition", condition);
            //    this.ViewState.Add("TableName", strTableName);
            //}
            //else
            //{
            //    condition = Convert.ToString(this.ViewState["condition"]);
            //    strTableName = Convert.ToString(this.ViewState["TableName"]);
            //}
            //base.SetForwardPage(forwarderType, ((WebNumericEdit)this.PageNavigator.FindControl("WebNumericEditCurrentpage")).Value.ToString());
            //this.dataSet = ((ServiceLocator)this.Session["serviceLocator"]).GetKQMBellCardQuery().GetDataByCondition(strTableName, condition, Convert.ToInt32(this.Session["PageSize"]), ref this.forwarderPage, ref this.totalPage, ref this.totalRecodrs);
            //this.SetPageInfor(base.forwarderPage, base.totalPage, base.totalRecodrs);
            //this.DataUIBind();
            //base.WriteMessage(0, base.GetResouseValue("common.message.trans.complete"));
        }