protected void ExtractExcel_Column() { try { string strPath_DB = ""; string strFileExt = ""; Int64 var_FileID = 0; Int64 var_ColumnCNT = 0; Int64 var_ProcessColumnCNT = 0; DataTable dt_File = new DataTable(); dt_File = MaheshAF18.Application.MEF.DA_GetDataTable("SELECT * from M_AT_Upload_File WHERE GSTIN='" + GSTIN.Text + "'"); if (dt_File.Rows.Count > 0) { strPath_DB = dt_File.Rows[0]["FilePath"].ToString(); strFileExt = dt_File.Rows[0]["FileExt"].ToString(); var_FileID = Convert.ToInt64(dt_File.Rows[0]["FU_ID"].ToString()); if (File.Exists(Server.MapPath(strPath_DB))) { DataSet dsSourceDataSet = new DataSet(); dsSourceDataSet = GetExcelWorkSheet(strPath_DB, strFileExt, 0); DataTable dtSourceTable = new DataTable(); dtSourceTable = dsSourceDataSet.Tables[0]; if (dtSourceTable.Rows.Count > 0) { var_ColumnCNT = dtSourceTable.Columns.Count; foreach (DataColumn column in dtSourceTable.Columns) { ObjBOAT_FUDTL = new M_AT_Upload_File_BDTLBO(); ObjBOAT_FUDTL.FUDTL_ID = 0; ObjBOAT_FUDTL.Fk_FU_ID = var_FileID; ObjBOAT_FUDTL.FU_UserColumn = column.ColumnName; ErrorMessage = ObjBOAT_FUDTL.Insert_Update(ObjBOAT_FUDTL); var_ProcessColumnCNT = var_ProcessColumnCNT + 1; } } DisplayCustomMessageSummary("Extracted " + var_ProcessColumnCNT + " Column Successfully"); } else { DisplayCustomMessageSummary("Excel File Not Found"); } } else { DisplayCustomMessageSummary("Excel File Not Found"); } Set_UserFileLink(); } catch (Exception ex) { DisplayCustomMessageSummary("Failed Save Data"); } }
protected void Page_Load(object sender, EventArgs e) { PageMenuID = Request.QueryString["ID"]; ObjBOAT_FUDTL = new M_AT_Upload_File_BDTLBO(); SetControlType(); if (!IsPostBack) { FillDropdown(); InitializeControls(); RefreshGrid(); } }