protected void btn_results_Click(object sender, EventArgs e) { HRAAdminBill hobj = new HRAAdminBill(); string _qy = ddlQY.SelectedItem.Text.ToString(); lbl_error.Text = ""; if (Page.IsValid) { if (txtPrevQY.Visible) { lbl_error.Text = "Enter Quarter-Year in format 'Qd-yyyy'"; return; } try { hobj.CheckRptsImported(_qy); View_Result(); } catch (Exception ex) { resultDiv.Visible = false; MultiView1.SetActiveView(view_main); lbl_error.Text = "Error in reconciliation.<br />" + ex.Message; } } }
void Reconcile(string _qy) { HRAAdminDAL robj = new HRAAdminDAL(); HRAAdminBill hobj = new HRAAdminBill(); hobj.CheckRptsImported(_qy); robj.insertReconStatus(_qy); HRA_Results.SavePrintFiles(_class, _qy); }
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 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(); } } } }