protected void btn_manImport_Click(object sender, EventArgs e) { lbl_error.Text = ""; HRAAdminBill hobj = new HRAAdminBill(); HRAImportDAL iObj = new HRAImportDAL(); string _qy = ddlQY.SelectedItem.Text; if (Page.IsValid) { if (txtPrevQY.Visible) { lbl_error.Text = "Enter Quarter-Year in format 'Qd-yyyy'"; return; } string strFilePath1 = ""; if (FileUpload1.GotFile) { try { string fn = System.IO.Path.GetFileName(FileUpload1.FilePost.FileName); strFilePath1 = Server.MapPath("~/uploads/") + fn; if (File.Exists(strFilePath1)) { File.Delete(strFilePath1); } FileUpload1.FilePost.SaveAs(strFilePath1); iObj.Rollback(source, _qy); _counter = hobj.ImportPtnmInvoice(strFilePath1, _qy); Session["taskId"] = Convert.ToInt32(Session["taskId"]) + 1; Audit.auditUserTaskI(Session.SessionID, Session["mid"].ToString(), Session["taskId"].ToString(), "HRA", "Administrative Bill Validation", "hra_PutnamInvoice", "Putnam Invoice Import", _qy, _counter); MultiView1.SetActiveView(view_result); lbl_result.Text = "Import completed successfully -- " + _counter + " records imported"; } catch (Exception ex) { iObj.Rollback(source, _qy); lbl_error.Text = "Error - " + ex.Message; } finally { if (File.Exists(strFilePath1)) { File.Delete(strFilePath1); } FileUpload1.FilePost.InputStream.Flush(); FileUpload1.FilePost.InputStream.Close(); FileUpload1.FilePost.InputStream.Dispose(); } } } }
protected void btn_reimport_Click(object sender, EventArgs e) { string yrmo = ddlYrmo.SelectedItem.Text; lbl_error.Text = ""; if (Page.IsValid) { if (txtPrevYRMO.Visible) { lbl_error.Text = "Enter YRMO in format 'yyyymm'"; return; } try { HRAImportDAL iObj = new HRAImportDAL(); iObj.Rollback(source, yrmo); MultiView1.SetActiveView(view_main); autoImport(); } catch (Exception ex) { lbl_error.Text = "Error in re-importing file.<br />" + ex.Message; } } }
Boolean ImportFile(string strFilePath1) { string _yrmo = ddlYrmo.SelectedItem.Text; string logFilePath = Server.MapPath("~/uploads/") + "Exceptions_Putnam_" + _yrmo + ".txt"; bool importStat = false; HRAImportDAL iObj = new HRAImportDAL(); HRAExcelImport tObj = new HRAExcelImport(); HRAParseData pObj = new HRAParseData(); DataSet ds = new DataSet(); ds.Clear(); tObj.ConfirmPutnamYRMO(strFilePath1, _yrmo); if (File.Exists(logFilePath)) { File.Delete(logFilePath); } iObj.Rollback(source, _yrmo); ds = tObj.importPutnam(strFilePath1); _counter = pObj.parsePutnam(ds, _yrmo, strFilePath1); if (File.Exists(logFilePath)) { resultDiv.Visible = true; } importStat = true; Session["taskId"] = Convert.ToInt32(Session["taskId"]) + 1; Audit.auditUserTaskI(Session.SessionID, Session["mid"].ToString(), Session["taskId"].ToString(), "HRA", "Reconciliation", "HTH_HMO_Billing", "Putnam Import", _yrmo, _counter); return(importStat); }
protected void btn_manImport_Click(object sender, EventArgs e) { string yrmo = ddlYrmo.SelectedItem.Text; lbl_error.Text = ""; string logFilePath = Server.MapPath("~/uploads/") + "Exceptions_PutnamAdj_" + yrmo + ".txt"; if (Page.IsValid) { if (txtPrevYRMO.Visible) { lbl_error.Text = "Enter YRMO in format 'yyyymm'"; return; } string strFilePath1 = ""; if (FileUpload1.GotFile) { try { string fn = System.IO.Path.GetFileName(FileUpload1.FilePost.FileName); strFilePath1 = Server.MapPath("~/uploads/") + fn; if (File.Exists(strFilePath1)) { File.Delete(strFilePath1); } FileUpload1.FilePost.SaveAs(strFilePath1); if (ImportFile(strFilePath1)) { MultiView1.SetActiveView(view_result); lbl_result.Text = "Import completed successfully -- " + _counter + " records imported"; } } catch (Exception ex) { if (File.Exists(logFilePath)) { File.Delete(logFilePath); } resultDiv.Visible = false; HRAImportDAL iObj = new HRAImportDAL(); iObj.Rollback(source, yrmo); lbl_error.Text = "Error - " + ex.Message; } finally { if (File.Exists(strFilePath1)) { File.Delete(strFilePath1); } FileUpload1.FilePost.InputStream.Flush(); FileUpload1.FilePost.InputStream.Close(); FileUpload1.FilePost.InputStream.Dispose(); } } } }
Boolean ImportFile(string strFilePath1) { string _yrmo = ddlYrmo.SelectedItem.Text; string logFilePath = Server.MapPath("~/uploads/") + "Exceptions_PutnamAdj_" + _yrmo + ".txt"; bool importStat = false; HRAImportDAL iObj = new HRAImportDAL(); HRAExcelImport tObj = new HRAExcelImport(); HRAParseData pObj = new HRAParseData(); DataSet ds = new DataSet(); if (String.Compare((strFilePath1.Substring(strFilePath1.Length - 3)), "txt") == 0) { ds = HRATextImport.getTextFileData(strFilePath1, "PutnamAdjTable", '\t'); } else { ds = tObj.getExcelData(strFilePath1, "PutnamAdjTable"); } tObj.ConfirmPutnamAdjYRMO(_yrmo, ds, "PutnamAdjTable"); if (File.Exists(logFilePath)) { File.Delete(logFilePath); } iObj.Rollback(source, _yrmo); _counter = pObj.parsePutnamAdj(ds, _yrmo); if (File.Exists(logFilePath)) { resultDiv.Visible = true; } importStat = true; Session["taskId"] = Convert.ToInt32(Session["taskId"]) + 1; Audit.auditUserTaskI(Session.SessionID, Session["mid"].ToString(), Session["taskId"].ToString(), "HRA", "Reconciliation", "HTH_HMO_Billing", "Putnam Adj. Import", _yrmo, _counter); return(importStat); }
protected void btn_autoImport_Click(object sender, EventArgs e) { HRAImportDAL iobj = new HRAImportDAL(); Impersonation _imp = new Impersonation(); string yrmo = ddlYrmo.SelectedItem.Text; string clientfilename, clientfile, serverPath; string serverfile = ""; lbl_error.Text = ""; string logFilePath = Server.MapPath("~/uploads/") + "Exceptions_PutnamAdj_" + yrmo + ".txt"; if (Page.IsValid) { if (txtPrevYRMO.Visible) { lbl_error.Text = "Enter YRMO in format 'yyyymm'"; return; } try { serverPath = FilePaths.getFilePath("Uploads").Replace("\\\\", "\\"); clientfilename = HRA.GetInputFileName(yrmo, source); serverfile = serverPath + clientfilename; if (_imp.impersonateValidUser(Session["uid"].ToString(), "CORP", EncryptDecrypt.Decrypt(Session["pwd"].ToString()))) { clientfile = HRAImportDAL.GetClientFilePath(_category, source) + "\\" + clientfilename; if (!File.Exists(clientfile)) { clientfile = clientfile.Replace(".xls", ".txt"); serverfile = serverfile.Replace(".xls", ".txt"); } File.Copy(clientfile, serverfile); _imp.undoImpersonation(); } else { throw new Exception("Error in accessing network location"); } if (!(File.Exists(serverfile))) { throw new Exception("Unable to import file from specified location.<br/>Please check if file exists and you are logged in to the network."); } if (ImportFile(serverfile)) { MultiView1.SetActiveView(view_result); lbl_result.Text = "Import completed successfully -- " + _counter + " records imported"; } else { throw new Exception("Unable to parse file.<br/>Please check file type and format."); } } catch (Exception ex) { if (File.Exists(logFilePath)) { File.Delete(logFilePath); } resultDiv.Visible = false; iobj.Rollback(source, yrmo); lbl_error.Text = "Error - " + ex.Message; } finally { if (File.Exists(serverfile)) { File.Delete(serverfile); } } } }
protected void btn_autoImport_Click(object sender, EventArgs e) { HRAAdminBill hobj = new HRAAdminBill(); Impersonation _imp = new Impersonation(); HRAImportDAL iobj = new HRAImportDAL(); string yrmo = ddlYrmo.SelectedItem.Text; string clientfilename, clientfile, serverPath; string serverfile = ""; lbl_error.Text = ""; string logFilePath = Server.MapPath("~/uploads/") + "Exceptions_WageworksInvoice_" + yrmo + ".txt"; if (Page.IsValid) { if (txtPrevYRMO.Visible) { lbl_error.Text = "Enter YRMO in format 'yyyymm'"; return; } try { serverPath = FilePaths.getFilePath("Uploads").Replace("\\\\", "\\"); clientfilename = HRA.GetInputFileName(yrmo, source); serverfile = serverPath + clientfilename; if (_imp.impersonateValidUser(Session["uid"].ToString(), "CORP", EncryptDecrypt.Decrypt(Session["pwd"].ToString()))) { clientfile = HRAImportDAL.GetClientFilePath(_category, source) + "\\" + clientfilename; File.Copy(clientfile, serverfile); _imp.undoImpersonation(); } else { throw new Exception("Error in accessing network location"); } if (!(File.Exists(serverfile))) { throw new Exception("Unable to copy file from specified location.<br/>Please check if file exists and you are logged in to the network."); } if (File.Exists(logFilePath)) { File.Delete(logFilePath); } iobj.Rollback(source, yrmo); _counter = hobj.ImportWgwkInvoice(serverfile, source, yrmo); if (File.Exists(logFilePath)) { resultDiv.Visible = true; } Session["taskId"] = Convert.ToInt32(Session["taskId"]) + 1; Audit.auditUserTaskI(Session.SessionID, Session["mid"].ToString(), Session["taskId"].ToString(), "HRA", "Administrative Bill Validation", "hra_PartDataInvoice", "Wageworks Invoice Import", yrmo, _counter); MultiView1.SetActiveView(view_result); lbl_result.Text = "Import completed successfully -- " + _counter + " records imported"; } catch (Exception ex) { if (File.Exists(logFilePath)) { File.Delete(logFilePath); } resultDiv.Visible = false; iobj.Rollback(source, yrmo); lbl_error.Text = "Error - " + ex.Message; } finally { if (File.Exists(serverfile)) { File.Delete(serverfile); } } } }
protected void btn_manImport_Click(object sender, EventArgs e) { lbl_error.Text = ""; string yrmo = ddlYrmo.SelectedItem.Text; HRAAdminBill hobj = new HRAAdminBill(); HRAImportDAL iObj = new HRAImportDAL(); string logFilePath = Server.MapPath("~/uploads/") + "Exceptions_WageworksInvoice_" + yrmo + ".txt"; if (Page.IsValid) { if (txtPrevYRMO.Visible) { lbl_error.Text = "Enter YRMO in format 'yyyymm'"; return; } string strFilePath1 = ""; if (FileUpload1.GotFile) { try { string fn = System.IO.Path.GetFileName(FileUpload1.FilePost.FileName); strFilePath1 = Server.MapPath("~/uploads/") + fn; if (File.Exists(strFilePath1)) { File.Delete(strFilePath1); } FileUpload1.FilePost.SaveAs(strFilePath1); if (File.Exists(logFilePath)) { File.Delete(logFilePath); } iObj.Rollback(source, yrmo); _counter = hobj.ImportWgwkInvoice(strFilePath1, source, yrmo); if (File.Exists(logFilePath)) { resultDiv.Visible = true; } Session["taskId"] = Convert.ToInt32(Session["taskId"]) + 1; Audit.auditUserTaskI(Session.SessionID, Session["mid"].ToString(), Session["taskId"].ToString(), "HRA", "Administrative Bill Validation", "hra_PartDataInvoice", "Wageworks Invoice Import", yrmo, _counter); MultiView1.SetActiveView(view_result); lbl_result.Text = "Import completed successfully -- " + _counter + " records imported"; } catch (Exception ex) { if (File.Exists(logFilePath)) { File.Delete(logFilePath); } resultDiv.Visible = false; iObj.Rollback(source, yrmo); lbl_error.Text = "Error - " + ex.Message; } finally { if (File.Exists(strFilePath1)) { File.Delete(strFilePath1); } FileUpload1.FilePost.InputStream.Flush(); FileUpload1.FilePost.InputStream.Close(); FileUpload1.FilePost.InputStream.Dispose(); } } } }