コード例 #1
0
 protected void btnExportFilteredData_OnClick(object sender, ImageClickEventArgs e)
 {
     if (ddlRequestProduct.SelectedValue == "MF")
     {
         DataTable                   dt = (DataTable)Cache["gvBrokerageRequestStatus" + userVo.UserId];
         CommonProgrammingBo         commonProgrammingBo = new CommonProgrammingBo();
         Dictionary <string, string> dHeaderText         = new Dictionary <string, string>();
         for (int i = 0; i < gvBrokerageRequestStatus.MasterTableView.Columns.Count; i++)
         {
             if (gvBrokerageRequestStatus.Columns[i].Visible == true)
             {
                 dHeaderText.Add(gvBrokerageRequestStatus.Columns[i].UniqueName, gvBrokerageRequestStatus.MasterTableView.Columns[i].HeaderText);
             }
         }
         dt = commonProgrammingBo.getHeaderNameNValue(dt, dHeaderText);
         ExcelToExport(dt, "View CommissionReceive Details");
     }
     else
     {
         DataTable                   dt = (DataTable)Cache["gvBrokerageRequestStatus" + userVo.UserId];
         CommonProgrammingBo         commonProgrammingBo = new CommonProgrammingBo();
         Dictionary <string, string> dHeaderText         = new Dictionary <string, string>();
         for (int i = 0; i < gvBrokerageRequestStatus.MasterTableView.Columns.Count; i++)
         {
             if (gvBrokerageRequestStatus.Columns[i].Visible == true)
             {
                 dHeaderText.Add(gvBrokerageRequestStatus.Columns[i].UniqueName, gvBrokerageRequestStatus.MasterTableView.Columns[i].HeaderText);
             }
         }
         dt = commonProgrammingBo.getHeaderNameNValue(dt, dHeaderText);
         ExcelToExport(dt, "View CommissionReceive Details");
     }
 }
        protected void CreateFileForextractAndSaveinServer()
        {
            commonProgrammingBo = new CommonProgrammingBo();
            string strFileNameAndDelimeter = string.Empty;

            strFileNameAndDelimeter = commonProgrammingBo.SetFileNameAndDelimeter(Convert.ToInt32(ddlExtractType.SelectedValue), Convert.ToDateTime(txtExtractDate.SelectedDate), null);
            SetFileNameAndDelimeter(strFileNameAndDelimeter);
            //SetFileNameAndDelimeter(Convert.ToInt32(ddlExtractType.SelectedValue));
            File.WriteAllText(Path.Combine(ExtractPath, filename), ", System.Text.Encoding.Default");
        }
コード例 #3
0
        protected void CreateFileForextractAndSaveinServer()
        {
            commonProgrammingBo = new CommonProgrammingBo();
            string strFileNameAndDelimeter = string.Empty;
            string ProductIssueCOde        = onlineNCDBackOfficebo.GetNCDIPOProductIssuer(int.Parse(ddlPrcdt.SelectedValue));

            strFileNameAndDelimeter = commonProgrammingBo.SetFileNameAndDelimeter(Convert.ToInt32(ddlExtractType.SelectedValue), DateTime.Now, ProductIssueCOde);
            SetFileNameAndDelimeter(strFileNameAndDelimeter);
            //SetFileNameAndDelimeter(Convert.ToInt32(ddlExtractType.SelectedValue));
            File.WriteAllText(Path.Combine(ExtractPath, filename), ", System.Text.Encoding.Default");
        }
コード例 #4
0
        private void ExcelToExport()
        {
            CommonProgrammingBo         commonProgrammingBo = new CommonProgrammingBo();
            DataTable                   dt          = new DataTable();
            Dictionary <string, string> dHeaderText = new Dictionary <string, string>();

            dt = (DataTable)Cache["gvAgentCodeView" + userVo.UserId + userType];
            for (int i = 0; i < gvAgentCodeView.MasterTableView.Columns.Count; i++)
            {
                if (gvAgentCodeView.Columns[i].Visible == true)
                {
                    dHeaderText.Add(gvAgentCodeView.Columns[i].UniqueName, gvAgentCodeView.MasterTableView.Columns[i].HeaderText);
                }
            }
            dt = commonProgrammingBo.getHeaderNameNValue(dt, dHeaderText);
            Response.ClearContent();
            Response.Buffer = true;
            Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "View Code Master.xls"));
            Response.ContentType = "application/ms-excel";
            string str = string.Empty;

            foreach (DataColumn dtcol in dt.Columns)
            {
                Response.Write(str + dtcol.ColumnName);
                str = "\t";
            }
            Response.Write("\n");
            foreach (DataRow dr in dt.Rows)
            {
                str = "";
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    Response.Write(str + Convert.ToString(dr[j]));
                    str = "\t";
                }
                Response.Write("\n");
            }
            Response.End();
        }