コード例 #1
0
ファイル: FrmSlipType.cs プロジェクト: zhr008/ERP-1
 /// <summary>
 /// 导出
 /// </summary>
 private void MasterToolBar_DoExport_Click(object sender, EventArgs e)
 {
     _currentDt = bSlipType.GetList(GetConduction()).Tables[0];
     if (isSearch && _currentDt != null)
     {
         foreach (DataRow row in _currentDt.Rows)
         {
             try
             {
                 if (row["CREATE_USER"] != null && bCommon.GetBaseMaster("USER", CConvert.ToString(row["CREATE_USER"])) != null)
                 {
                     row["CREATE_USER"] = bCommon.GetBaseMaster("USER", CConvert.ToString(row["CREATE_USER"])).Name;
                 }
                 if (row["LAST_UPDATE_USER"] != null && bCommon.GetBaseMaster("USER", CConvert.ToString(row["LAST_UPDATE_USER"])) != null)
                 {
                     row["LAST_UPDATE_USER"] = bCommon.GetBaseMaster("USER", CConvert.ToString(row["LAST_UPDATE_USER"])).Name;
                 }
             }
             catch { }
         }
         int result = CommonExport.DataTableToExcel(_currentDt, CConstant.SLIP_TYPE_HEADER, CConstant.SLIP_TYPE_COLUMNS, "SLIP_TYPE", "SLIP_TYPE");
         if (result == CConstant.EXPORT_SUCCESS)
         {
             MessageBox.Show("数据已经成功导出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else if (result == CConstant.EXPORT_FAILURE)
         {
             MessageBox.Show("数据导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("没有可以导出的数据。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #2
0
        /// <summary>
        /// 数据查询,绑定
        /// </summary>
        private void BindData(int currentPage)
        {
            string  strWhere = GetConduction();
            DataSet ds       = bSlipType.GetList(strWhere, "", (currentPage - 1) * PageSize + 1, currentPage * PageSize);

            _currentDt = ds.Tables[0];
            for (int i = _currentDt.Rows.Count; i < PageSize; i++)
            {
                _currentDt.Rows.Add(ds.Tables[0].NewRow());
            }
            this.dgvData.DataSource = _currentDt;
        }