Beispiel #1
0
        public override bool execute( )
        {
            Registry("execute schedule_batch ");

            /// USER [ execute ]

            // #####################
            // ## Watch directory:
            // #####################

            string dir_watch = new SyCrafEngine.InstallData().pathDir + "\\proc";

            Registry(dir_watch);

            string [] my_files = Directory.GetFiles(dir_watch);

            for (int t = 0; t < my_files.GetLength(0); ++t)
            {
                string archive = my_files[t];

                I_Batch bat = new I_Batch(this);

                if (bat.select_rows_archive(archive.Replace(dir_watch + "\\", "")))
                {
                    bat.fetch();

                    if (bat.get_tg_running() == Context.FALSE)
                    {
                        Trace("Moving file to rejected");

                        string dest_file = archive.Replace("\\proc", "\\proc\\rejected");

                        if (File.Exists(dest_file))
                        {
                            File.Delete(dest_file);
                        }

                        File.Move(archive, dest_file);

                        Trace(dest_file + " moved!");
                    }

                    continue;
                }

                bat.set_st_archive(archive.Replace(dir_watch + "\\", ""));
                bat.set_dt_start(GetDataBaseTime());
                bat.set_tg_processed(Context.FALSE);
                bat.set_tg_running(Context.FALSE);

                bat.create_I_Batch();
            }


            /// USER [ execute ] END

            Registry("execute done schedule_batch ");

            return(true);
        }
Beispiel #2
0
        public override bool finish( )
        {
            Registry("finish type_load ");

            /// USER [ finish ]

            bat.ExclusiveAccess();

            if (bat.select_rows_archive(db_archive))
            {
                bat.fetch();

                bat.set_dt_proc_end(GetDataBaseTime());
                bat.set_tg_running(Context.FALSE);
                bat.set_tg_processed(Context.TRUE);

                bat.synchronize_I_Batch();

                bat.ReleaseExclusive();
            }

            string archive_dest = archive.Replace("\\proc", "\\proc\\term");

            if (File.Exists(archive_dest))
            {
                File.Delete(archive_dest);
            }

            File.Move(archive, archive.Replace("\\proc", "\\proc\\term"));

            /// USER [ finish ] END

            Registry("finish done type_load ");

            if (remoteTransaction == true)
            {
                return(true);
            }

            return(true);
        }
Beispiel #3
0
        public override bool authenticate( )
        {
            Registry("authenticate type_load ");

            /// USER [ authenticate ]

            DataPortable dp = MemoryGet("input");

            db_archive = dp.getValue("archive");
            dir_watch  = new SyCrafEngine.InstallData().pathDir + "\\proc\\";
            archive    = dir_watch + db_archive;

            Trace(archive);

            bat = new I_Batch(this);

            bat.ExclusiveAccess();

            if (bat.select_rows_archive(db_archive))
            {
                bat.fetch();

                bat.set_dt_proc_start(GetDataBaseTime());
                bat.set_tg_running(Context.TRUE);

                bat.synchronize_I_Batch();

                bat.ReleaseExclusive();
            }

            /// USER [ authenticate ] END

            Registry("authenticate done type_load ");

            return(true);
        }