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     = "";
     }
 }
示例#2
0
 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 + "&nbsp;&nbsp;(<i>or</i>)<br/>" + lbl_clientfile.Text.Replace(".xls", ".txt");
     }
     else
     {
         upload_auto.Visible     = false;
         upload_manually.Visible = true;
         lbl_clientfile.Text     = "";
     }
 }
    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);
                }
            }
        }
    }
示例#4
0
    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);
                }
            }
        }
    }
示例#5
0
    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);
                }
            }
        }
    }