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_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 RptsImported() { string yrmo = ddlYrmo.SelectedItem.Text; string[] source = { "Putnam", "Wageworks" }; string[] rpts = { "Putnam Report", "Wageworks Report" }; string rptsNotImported = ""; HRAImportDAL iobj = new HRAImportDAL(); for (int i = 0; i < source.Length; i++) { if (!iobj.PastImport(source[i], yrmo)) { rptsNotImported += rpts[i]; if (i != (source.Length - 1)) { rptsNotImported += ", "; } } } if (rptsNotImported != "") { lbl_error.Text = rptsNotImported + " for yrmo - " + yrmo + " not imported"; return(false); } return(true); }
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(); } } } }
protected void btn_manImport_Click(object sender, EventArgs e) { lbl_error.Text = ""; HRAAdminBill hobj = new HRAAdminBill(); string _qy = ddlQY.SelectedItem.Text; HRAImportDAL iObj = new HRAImportDAL(); 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); _counter = hobj.ImportHRAAUDITR(strFilePath1, source, _qy); Session["taskId"] = Convert.ToInt32(Session["taskId"]) + 1; Audit.auditUserTaskI(Session.SessionID, Session["mid"].ToString(), Session["taskId"].ToString(), "HRA", "Administrative Bill Validation", "hra_AUDITR", "HRAAUDITR 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; lbl_notice.Visible = false; } finally { if (File.Exists(strFilePath1)) { File.Delete(strFilePath1); } FileUpload1.FilePost.InputStream.Flush(); FileUpload1.FilePost.InputStream.Close(); FileUpload1.FilePost.InputStream.Dispose(); } } } }
protected void autoImport() { if (HRAImportDAL.CheckAutoImport(_category, source)) { upload_auto.Visible = true; upload_manually.Visible = false; lbl_clientfile.Text = HRAImportDAL.GetClientFilePath(_category, source) + "\\" + HRA.GetInputFileName(ddlYrmo1.SelectedItem.Value, source); } else { upload_auto.Visible = false; upload_manually.Visible = true; lbl_clientfile.Text = ""; } }
protected void checkPastImport() { string _qy = ddlQY.SelectedItem.Text.ToString(); HRAImportDAL iobj = new HRAImportDAL(); if (iobj.PastImport(source, _qy)) { lbl_notice.Text = "Imported already for Quarter-Year: " + _qy + "!"; lbl_notice.Visible = true; } else { lbl_notice.Visible = false; } }
protected void autoImport() { if (HRAImportDAL.CheckAutoImport(_category, source)) { upload_auto.Visible = true; upload_manually.Visible = false; lbl_clientfile.Text = HRAImportDAL.GetClientFilePath(_category, source) + "\\" + HRA.GetInputFileName(ddlYrmo.SelectedItem.Value, source); lbl_clientfile.Text = lbl_clientfile.Text + " (<i>or</i>)<br/>" + lbl_clientfile.Text.Replace(".xls", ".txt"); } else { upload_auto.Visible = false; upload_manually.Visible = true; lbl_clientfile.Text = ""; } }
protected void checkPastImport() { string _yrmo = ddlYrmo.SelectedItem.Text.ToString(); HRAImportDAL iobj = new HRAImportDAL(); if (iobj.PastImport(source, _yrmo)) { MultiView1.SetActiveView(view_reimport); lbl_reimport.Text = "Imported already for year-month (YRMO): " + _yrmo + ".<br />Do you want to re-import the file?"; } else { MultiView1.SetActiveView(view_main); autoImport(); } }
protected void checkPastImport() { string _qy = ddlQY.SelectedItem.Text.ToString(); HRAImportDAL iobj = new HRAImportDAL(); if (iobj.PastImport(source, _qy)) { MultiView1.SetActiveView(view_reimport); lbl_reimport.Text = "Imported already for Quarter-Year: " + _qy + ". Do you want to re-import the file?"; } else { MultiView1.SetActiveView(view_main); autoImport(); } }
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) { HRASofoDAL robj = new HRASofoDAL(); Impersonation _imp = new Impersonation(); string yrmo = ddlYrmo1.SelectedItem.Text; string clientfilename, clientfile, serverPath; string serverfile = ""; div1_error.Visible = false; div1_alert.Visible = false; if (Page.IsValid) { if (txtPrevYRMO1.Visible) { lbl_error1.Text = "Enter YRMO in format 'yyyymm'"; return; } try { serverPath = Server.MapPath("~/uploads/"); 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 import file from specified location.<br/>Please check if file exists and you are logged in to the network."); } AutoReconcile(serverfile); HRA_Results.SavePrintFiles(_category, yrmo); viewresult1(yrmo); Session["taskId"] = Convert.ToInt32(Session["taskId"]) + 1; Audit.auditUserTaskR(Session.SessionID, Session["mid"].ToString(), Session["taskId"].ToString(), "HRA", "Reconciliation", "SOFO Reconciliation", yrmo); } catch (Exception ex) { MultiView3.SetActiveView(view_main1); robj.ReconDelete(yrmo); div1_error.Visible = true; lbl_error1.Text = "Error - " + ex.Message; } finally { if (File.Exists(serverfile)) { File.Delete(serverfile); } } } }
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(); } } } }