예제 #1
0
        private void button8_Click(object sender, EventArgs e)
        {
            RoleAssignmentEngine engine = new RoleAssignmentEngine();

            engine.ProcessDirtyPeople(null);
            txtOutput.Text = "Done processing dirty";
        }
예제 #2
0
        private void button8_Click(object sender, EventArgs e)
        {
            var engine = new RoleAssignmentEngine();

            engine.ProcessDirtyPeople(null);

            AssignView("Done processing dirty", null);
        }
예제 #3
0
        static void Main(string[] args)
        {
            int  numFiles        = 0;
            bool requireApproval = true;

            if (args.Count() == 0)
            {
                Console.WriteLine("Usage: RSMImporter <folder_with_CSV>");
                return;
            }

            string ArcFolder = Path.Combine(args[0], "archive");

            if (!(Directory.Exists(ArcFolder)))
            {
                Directory.CreateDirectory(ArcFolder);
            }

            string ErrFolder = Path.Combine(args[0], "error");

            if (!(Directory.Exists(ErrFolder)))
            {
                Directory.CreateDirectory(ErrFolder);
            }

            if (args.Length > 1)
            {
                requireApproval = (args[1].ToLower() == "green") ? true : false;
            }

            string[] files = Directory.GetFiles(args[0]);

            FileStream         f;
            PeopleSoftImporter imp = new PeopleSoftImporter();
            string             newFile;

            foreach (string filename in files)
            {
                try
                {
                    Console.Out.WriteLine("Processing {0}...", filename);
                    f = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.None);
                    // If we could open it with exclusive rights then it's done transferring
                    f.Close();

                    if (imp.ImportCSV(filename))
                    {
                        numFiles++;
                        newFile = GetUniqueName(Path.GetFileName(filename), ArcFolder);
                    }
                    else
                    {
                        newFile = GetUniqueName(Path.GetFileName(filename), ErrFolder);
                    }


                    if (newFile != null)
                    {
                        File.Move(filename, newFile);
                    }
                }
                catch (Exception)
                {
                    // skip the file
                }
            }

            if (numFiles > 0)
            {
                imp.ImportNewDepts();
                imp.ImportNewJobs();
                imp.ImportNewLocations();
                RoleAssignmentEngine engine = new RoleAssignmentEngine(requireApproval);
                engine.ProcessDirtyPeople();
            }
        }
예제 #4
0
        public void Run(Object stateInfo)
        {
            if (_running)
            {
                return;
            }
            _running = true;
            GetConfig(false);
            try
            {
                if (_allowPSImport)
                {
                    ImportAssociates(_greenFolder, false);
                }
            }
            catch (Exception e)
            {
                WriteToEventLogError("Exception thrown importing green folder: " + e.ToString());
            }

            try
            {
                if (_allowPSImport)
                {
                    ImportAssociates(_redFolder, true);
                }
            }
            catch (Exception e)
            {
                WriteToEventLogError("Exception thrown importing red folder: " + e.ToString());
            }

            try
            {
                if (_allowS2Import)
                {
                    ImportS2Levels();
                }
            }
            catch (Exception e)
            {
                WriteToEventLogError("Exception thrown importing S2 Levels: " + e.ToString());
            }

            try
            {
                RoleAssignmentEngine eng = new RoleAssignmentEngine();
                eng.ProcessDirtyPeople(null);
            }
            catch (Exception e)
            {
                WriteToEventLogError("Exception thrown processing dirty people: " + e.ToString());
            }

            try
            {
                UploadAssociates();
            }
            catch (Exception e)
            {
                WriteToEventLogError("Exception thrown uploading associates: " + e.ToString());
            }

            _running = false;
        }