Exemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            CommonHelper.instance.dealerActuallyName = "OTHER_125";
            CommonHelper.instance.dealerParameter    = "125";
            if (cbFromFolderOrFile.IsChecked == true)
            {
                ITxtService itx = new ImportFromSourceFile();
                itx.scanFolderUpload(tbFilePath.Text);
            }
            else
            {
                ITxtService itx = new ImportFromSourceFile();


                //testing
                //DataTable dt = itx.importToDB(tbFilePath.Text);

                //dg_templist.ItemsSource = dt.AsDataView();
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            ITxtService itx = new ImportFromSourceFile();

            string[] customerList    = Directory.GetDirectories(customerdetailsPath);
            string[] jobList         = Directory.GetDirectories(jobcodePath);
            string[] appointmentList = Directory.GetDirectories(appointPath);
            string[] salesList       = Directory.GetDirectories(salesPath);
            string[] batchList       = Directory.GetDirectories(batchPath);

            string filename = string.Empty;

            Console.WriteLine("Loading for customer detail");

            foreach (string cusPath in customerList)
            {
                string dirName = cusPath.Split('\\')[cusPath.Split('\\').Length - 1];

                CommonHelper.instance.dealerParameter    = dirName.Split('_')[1].ToString();
                CommonHelper.instance.dealerActuallyName = dirName;

                Console.WriteLine("Loading for customer detail" + dirName);

                bool customerDetailflag = itx.scanFolderUpload(cusPath, out filename, cusPath + "\\UnDone", cusPath + "\\Done");

                if (customerDetailflag)
                {
                }
                else
                {
                    CommonHelper.instance.generateEmailToItStuffs(null, "The below files haven't been uploaded succussfully:" + filename, "AutomaticallyToolMessage");
                }
            }

            Console.WriteLine("customer detail has been done");

            Console.WriteLine("Loading for repairment service code");

            foreach (string jobPath in jobList)
            {
                string dirName = jobPath.Split('\\')[jobPath.Split('\\').Length - 1];

                CommonHelper.instance.dealerParameter    = dirName.Split('_')[1].ToString();
                CommonHelper.instance.dealerActuallyName = dirName;

                Console.WriteLine("Loading for repairment service" + dirName);



                bool jobcodeflag = itx.scanFolderUpload(jobPath, out filename, jobPath + "\\UnDone", jobPath + "\\Done");

                if (jobcodeflag)
                {
                }
                else
                {
                    CommonHelper.instance.generateEmailToItStuffs(null, "The below files haven't been uploaded succussfully:" + filename, "AutomaticallyToolMessage");
                }
            }
            Console.WriteLine("Repairment service code has been done");

            Console.WriteLine("Loading for appointment code");

            foreach (string apptPath in appointmentList)
            {
                string dirName = apptPath.Split('\\')[apptPath.Split('\\').Length - 1];

                CommonHelper.instance.dealerParameter    = dirName.Split('_')[1].ToString();
                CommonHelper.instance.dealerActuallyName = dirName;

                Console.WriteLine("Loading for appointment code" + dirName);

                bool appointflag = itx.scanFolderUpload(apptPath, out filename, apptPath + "\\UnDone", apptPath + "\\Done");

                if (appointflag)
                {
                }
                else
                {
                    CommonHelper.instance.generateEmailToItStuffs(null, "The below files haven't been uploaded succussfully:" + filename, "AutomaticallyToolMessage");
                }
            }
            Console.WriteLine("Appointment service code has been done");

            Console.WriteLine("Loading for sales service code");

            foreach (string salePath in salesList)
            {
                string dirName = salePath.Split('\\')[salePath.Split('\\').Length - 1];

                CommonHelper.instance.dealerParameter    = dirName.Split('_')[1].ToString();
                CommonHelper.instance.dealerActuallyName = dirName;

                Console.WriteLine("Loading for sales code" + dirName);

                bool appointflag = itx.scanFolderUpload(salePath, out filename, salePath + "\\UnDone", salePath + "\\Done");

                if (appointflag)
                {
                }
                else
                {
                    CommonHelper.instance.generateEmailToItStuffs(null, "The below files haven't been uploaded succussfully:" + filename, "AutomaticallyToolMessage");
                }
            }
            Console.WriteLine("Sales service code has been done");

            Console.WriteLine("Loading for batchFile code");

            itx.dataMappingExtend();

            foreach (string batchpath in batchList)
            {
                string dirName = batchpath.Split('\\')[batchpath.Split('\\').Length - 1];

                CommonHelper.instance.dealerParameter    = dirName.Split('_')[1].ToString();
                CommonHelper.instance.dealerActuallyName = dirName;

                Console.WriteLine("Loading for batchFile code" + dirName);

                bool batchflag = itx.dataMappingExtend(batchpath);

                if (batchflag)
                {
                }
                else
                {
                    CommonHelper.instance.generateEmailToItStuffs(null, "The below files haven't been uploaded succussfully:" + batchpath, "AutomaticallyToolMessage");
                }
            }
            Console.WriteLine("batchFile code has been done");
        }