private void listView1_DragDrop(object sender, DragEventArgs e)
        {
            string[] droppedFiles = (string[])e.Data.GetData(DataFormats.FileDrop, false);
            try
            {
                foreach (string droppedFile in droppedFiles)//iterate through all files dropped into the form
                {
                    if (droppedFile.Contains(".dat"))
                    {
                        Process.Start(@"C:\Users\14025\Documents\File Consultants\Groups\Payment Adjustment\Import\");
                        PaymentAdjustmentFilePathAndName = droppedFile;
                        GetStringBetweenString getString = new GetStringBetweenString();



                        //MessageBox.Show(nonstandardCurrentFilePath);
                        try
                        {
                            PaymentAdjustmentFileNameOnly = Path.GetFileName(PaymentAdjustmentFilePathAndName);

                            listView1.Items.Add(PaymentAdjustmentFileNameOnly);



                            //copy to Temp folder

                            string sourceFileandPath = PaymentAdjustmentFilePathAndName;

                            string destinationFileandPath = TempFolderPath + PaymentAdjustmentFileNameOnly;

                            if (!File.Exists(destinationFileandPath))
                            {
                                File.Copy(PaymentAdjustmentFilePathAndName, destinationFileandPath);
                            }


                            //copy to Payment Adjustment folder

                            //destinationFileandPath = PaymentAdjustmentFolder + PaymentAdjustmentFileNameOnly;

                            //if (!File.Exists(destinationFileandPath))
                            //{
                            //    File.Copy(PaymentAdjustmentFilePathAndName, destinationFileandPath);

                            //}

                            //open DOCS folder and Temp folder

                            ERID = getString.GetStringBetweenStringMethod(PaymentAdjustmentFileNameOnly, "", "_");

                            GetGroupName getGroupName = new GetGroupName();
                            getGroupName.GetGroupNameMethod(ERID);
                            GroupName = GetGroupName.GroupName;


                            Process.Start(GroupsFolderPath + GroupName + @"\DOCS");
                            Process.Start(TempFolderPath);

                            //save filename in clipboard for copy/paste into script
                            Clipboard.SetText(PaymentAdjustmentFileNameOnly);
                        }
                        catch (UnauthorizedAccessException ex)
                        {
                        }
                    }
                    else if (droppedFile.Contains(".msg"))
                    {
                        EmailFilePathAndName = droppedFile;

                        EmailFileNameOnly = Path.GetFileName(EmailFilePathAndName);

                        listView1.Items.Add(EmailFileNameOnly);

                        //copy to temp folder with timestamp and pmtadj filename
                        string sourceFile      = EmailFilePathAndName;
                        string destinationFile = TempFolderPath + EmailFileNameOnly;

                        if (!File.Exists(destinationFile))
                        {
                            try
                            {
                                File.Copy(sourceFile, destinationFile);


                                //rename destination file

                                string destinationFileNameOnly = Path.GetFileName(destinationFile);
                                string todaysDate = DateTime.Today.ToString("yyyyMMdd");

                                string newFileNameWithDate = todaysDate + "_" + PaymentAdjustmentFileNameOnly;



                                RenameFile rename = new RenameFile();
                                rename.RenameFileMethod(destinationFile, newFileNameWithDate);

                                //make an extra copy of the Email file
                                //if (!File.Exists(newEmailFilePathAndNameWithDate))
                                //{
                                //    File.Copy(PaymentAdjustmentFilePathAndName, newEmailFilePathAndNameWithDate);

                                //}
                            }
                            catch (UnauthorizedAccessException ex)
                            {
                            }
                        }
                    }


                    this.BringToFront();
                }
            }
            catch (ArgumentNullException ex)
            {
            }
        }
        private void listView1_DragDrop(object sender, DragEventArgs e)
        {
            string[] droppedFiles = (string[])e.Data.GetData(DataFormats.FileDrop, false);

            try
            {
                foreach (string droppedFile in droppedFiles)//iterate through all files dropped into the form
                {
                    if (droppedFile.Contains(".doc") || droppedFile.Contains(".docx") || droppedFile.Contains("Nonstandard") || droppedFile.Contains("NonstandardFileProcessRequest"))
                    {
                        NonstandardFormPathAndName = droppedFile;
                        //MessageBox.Show(nonstandardCurrentFilePath);
                        try
                        {
                            string nonstandardFileNameOnly = Path.GetFileName(NonstandardFormPathAndName);
                            NonstandardFormFileNameOnly = nonstandardFileNameOnly;
                            listView1.Items.Add(nonstandardFileNameOnly);

                            string sourceFileandPath = NonstandardFormPathAndName;

                            string destinationFileandPath = TempFolderPath + nonstandardFileNameOnly;

                            if (!File.Exists(destinationFileandPath))
                            {
                                File.Copy(NonstandardFormPathAndName, destinationFileandPath);
                            }
                            else
                            {
                                MessageBox.Show("File Already Exists");
                            }
                        }
                        catch (UnauthorizedAccessException ex)
                        {
                        }

                        //pull data from table
                        GetNonstandardFileData getData = new GetNonstandardFileData();
                        getData.GetNonstandardFileDataMethod(droppedFile);

                        string[] ERIDs = GetNonstandardFileData.EmployerID;

                        foreach (string erid in ERIDs)
                        {
                            //MessageBox.Show("ERID going inside Method: "+erid);

                            GetGroupName getGroupName = new GetGroupName();
                            getGroupName.GetGroupNameMethod(erid);
                            string groupName = GetGroupName.GroupName;
                            GroupName = groupName;


                            //MessageBox.Show("groupName coming outside of method: "+groupName);



                            //MessageBox.Show(GroupName);

                            //MessageBox.Show(GroupsFolderPath + GroupName);


                            if (Directory.Exists(GroupsFolderPath + GroupName + @"\DOCS"))
                            {
                                //MessageBox.Show("DOCS");
                                Process.Start(GroupsFolderPath + GroupName + @"\DOCS");
                                //Process.Start(@"https://etltrac.payflex.com/etl/");

                                //Thread.Sleep(6500);

                                //MOUSE_LeftClick leftClick = new MOUSE_LeftClick();
                                //leftClick.MOUSE_LeftClickMethod(3500, 145);

                                //SendKeys.Send(erid);
                                //SendKeys.Send("{ENTER}");
                            }
                            else if (Directory.Exists(GroupsFolderPath + GroupName + @"\Docs"))
                            {
                                //MessageBox.Show("Docs");

                                Process.Start(GroupsFolderPath + GroupName + @"\Docs");
                                //Process.Start(@"https://etltrac.payflex.com/etl/");

                                //Thread.Sleep(6500);

                                //MOUSE_LeftClick leftClick = new MOUSE_LeftClick();
                                //leftClick.MOUSE_LeftClickMethod(3500, 145);

                                //SendKeys.Send(erid);
                                //SendKeys.Send("{ENTER}");
                            }
                            else if (Directory.Exists(GroupsFolderPath + GroupName + @"\docs"))
                            {
                                //MessageBox.Show("docs");

                                //Process.Start(GroupsFolderPath + GroupName + @"\docs");
                                //Process.Start(@"https://etltrac.payflex.com/etl/");

                                //Thread.Sleep(3500);

                                //MOUSE_LeftClick leftClick = new MOUSE_LeftClick();
                                //leftClick.MOUSE_LeftClickMethod(3500, 145);

                                //SendKeys.Send(erid);
                                //SendKeys.Send("{ENTER}");
                            }
                        }



                        //MessageBox.Show(groupName);

                        //open docs folder
                    }
                    else if (droppedFile.Contains(".txt") || droppedFile.Contains(".pgp"))
                    {
                        NonstandardFilePathAndName = droppedFile;

                        string fileNameOnly    = Path.GetFileName(NonstandardFilePathAndName);
                        string sourceFile      = NonstandardFilePathAndName;
                        string destinationFile = TempFolderPath + fileNameOnly;
                        listView1.Items.Add(fileNameOnly);

                        if (!File.Exists(fileNameOnly))
                        {
                            try
                            {
                                File.Copy(sourceFile, destinationFile);


                                //rename destination file

                                string destinationFileNameOnly = Path.GetFileName(destinationFile);
                                string todaysDate = DateTime.Today.ToString("yyyyMMdd");

                                string     newFileNameWithDate = todaysDate + "_" + destinationFileNameOnly;
                                string     newNSFormFilePathAndNameWithDate = TempFolderPath + newFileNameWithDate + ".docx";
                                RenameFile rename = new RenameFile();
                                rename.RenameFileMethod(destinationFile, newFileNameWithDate);

                                //make an extra copy of the nonstandard form file
                                if (!File.Exists(newNSFormFilePathAndNameWithDate))
                                {
                                    File.Copy(NonstandardFormPathAndName, newNSFormFilePathAndNameWithDate);
                                }
                            }
                            catch (UnauthorizedAccessException ex)
                            {
                            }
                        }
                    }
                    if (droppedFile.Contains(".msg"))
                    {
                        //MessageBox.Show("Email File " + droppedFile);
                    }

                    this.BringToFront();
                }
            }
            catch (ArgumentNullException ex)
            {
            }
        }