예제 #1
0
 /// <summary>
 /// 导出
 /// </summary>
 private void MasterToolBar_DoExport_Click(object sender, EventArgs e)
 {
     _currentDt = bCompany.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 = CExport.DataTableToExcel(_currentDt, CConstant.COMPANY_HEADER, CConstant.COMPANY_COLUMNS, "COMPANY", "COMPANY");
         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
        private void FrmSetting_Load(object sender, EventArgs e)
        {
            if (UserTable.INFO == null)
            {
                DataSet ds = bCompany.GetList("");
                cboCompany.ValueMember   = "CODE";
                cboCompany.DisplayMember = "CODE";
                cboCompany.DataSource    = ds.Tables[0];
                DataTable dt = bCompany.GetList("CODE = '" + cboCompany.SelectedValue.ToString() + "'").Tables[0];
                txtCompany.Text = dt.Rows[0]["NAME"].ToString();
            }
            else
            {   //string[] strHeader = title.Split(',');
                //for (int i = 0; i < strHeader.Length; i++)
                //{
                //    excel.Cells[3 + Max, i + 1] = strHeader[i].ToString();
                //}

                string  str = UserTable.INFO.ToString();
                DataSet ds  = bCompany.GetList("");
                cboCompany.ValueMember   = "CODE";
                cboCompany.DisplayMember = "CODE";
                cboCompany.DataSource    = ds.Tables[0];
                string[] strRe = str.Split('|');
                this.cboCompany.SelectedValue = strRe[0].Trim().ToString();
                txtCompany.Text = strRe[1].Trim().ToString();
                txtPath.Text    = strRe[2].Trim().ToString();
            }
        }