Exemple #1
0
        static void CopyandRenameETFContributionFiles(string rootpath, string filter, string contributionFilesAvailablePath)
        {
            List <etf_epf_record> RefListETF = GetListETF(filter);

            List <filePath> FileswithPaths = new List <filePath>();
            var             allFiles       = Directory.GetFiles(contributionFilesAvailablePath, "*.txt", SearchOption.AllDirectories);

            foreach (var file in allFiles)
            {
                FileswithPaths.Add(new filePath {
                    fullPath = file
                });
            }

            var path = string.Empty;

            //Sample File name
            //CBCETF96464_A 049940_2017-September_2017-September_CD.txt
            //CBCETF93107_PF000390_2017-July_2017-July_CD.TXT
            foreach (var tran in RefListETF)
            {
                filePath has = FileswithPaths.Find(file => file.fullPath.Contains(tran.etref));

                if (has != null)
                {
                    if (!string.IsNullOrEmpty(has.fullPath.ToString()))
                    {
                        path = rootpath + @"\" + tran.etdate;
                        if (!Directory.Exists(path))
                        {
                            Directory.CreateDirectory(path);
                        }

                        path = rootpath + @"\" + tran.etdate + @"\";

                        int    length    = has.fullPath.Length;
                        int    lastIndex = has.fullPath.LastIndexOf(@"\");
                        string fileName  = has.fullPath.Substring(lastIndex + 1, (length - 1) - lastIndex);
                        path += tran.etref + "_" + tran.etreg + "_" + tran.etfrpd.Trim().Substring(0, 4) + "-" + CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(int.Parse(tran.etfrpd.Trim().Substring(4, 2)))
                                + "_" + tran.ettopd.Trim().Substring(0, 4) + "-" + CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(int.Parse(tran.ettopd.Trim().Substring(4, 2))) + "_" + tran.etptyp + ".TXT";


                        File.Copy(has.fullPath.ToString(), path, true);
                    }
                }
            }
        }
Exemple #2
0
        static void RenameETFContributionFiles(string rootpath, string filter, string contributionFilesAvailablePath)
        {
            List <etf_epf_record> RefListETF = GetListETF(filter);

            List <filePath> FileswithPaths = new List <filePath>();
            var             allFiles       = Directory.GetFiles(contributionFilesAvailablePath, "*.txt", SearchOption.AllDirectories);

            foreach (var file in allFiles)
            {
                FileswithPaths.Add(new filePath {
                    fullPath = file
                });
            }

            var path = string.Empty;

            foreach (var tran in RefListETF)
            {
                filePath has = FileswithPaths.Find(file => file.fullPath.Contains(tran.etref));

                if (has != null)
                {
                    if (!string.IsNullOrEmpty(has.fullPath.ToString()))
                    {
                        path = rootpath + @"\" + tran.etdate;
                        if (!Directory.Exists(path))
                        {
                            Directory.CreateDirectory(path);
                        }

                        path = rootpath + @"\" + tran.etdate + @"\";

                        int    length    = has.fullPath.Length;
                        int    lastIndex = has.fullPath.LastIndexOf(@"\");
                        string fileName  = has.fullPath.Substring(lastIndex + 1, (length - 1) - lastIndex);
                        path += fileName;
                        File.Copy(has.fullPath.ToString(), path, true);
                    }
                }
            }
        }
Exemple #3
0
        static void RenameEPFPaymentFiles(string rootpath, string filter, string contributionFilesAvailablePath)
        {
            List <etf_epf_record> RefListEPF = GetListEPF(filter);

            List <filePath> FileswithPaths = new List <filePath>();
            var             allFiles       = Directory.GetFiles(contributionFilesAvailablePath, "*EVEMP.txt", SearchOption.AllDirectories);

            foreach (var file in allFiles)
            {
                FileswithPaths.Add(new filePath {
                    fullPath = file
                });
            }

            var path = string.Empty;

            foreach (var tran in RefListEPF)
            {
                filePath has = FileswithPaths.Find(file => file.fullPath.Contains(tran.etref));

                if (has != null)
                {
                    if (!string.IsNullOrEmpty(has.fullPath.ToString()))
                    {
                        path = rootpath + @"\" + tran.etcopr;
                        if (!Directory.Exists(path))
                        {
                            Directory.CreateDirectory(path);
                        }

                        path = rootpath + @"\" + tran.etcopr + @"\" + tran.etref + "_" + tran.etcopr.Trim() + "_" + tran.ettran.Trim() + "_EVEMP.txt";
                        File.Copy(has.fullPath.ToString(), path, true);
                    }
                }
            }
        }