示例#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 button7_Click(object sender, EventArgs e)
        {
            RoleAssignmentEngine engine = new RoleAssignmentEngine();

            engine.ProcessPerson(6380);
            txtOutput.Text = "Done processing person";
        }
示例#3
0
        private void button8_Click(object sender, EventArgs e)
        {
            var engine = new RoleAssignmentEngine();

            engine.ProcessDirtyPeople(null);

            AssignView("Done processing dirty", null);
        }
示例#4
0
        private void button7_Click(object sender, EventArgs e)
        {
            var engine = new RoleAssignmentEngine();

            engine.ProcessPerson(6380);

            AssignView("Done processing person", null);
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
                RSMDataModelDataContext context = new RSMDataModelDataContext();
                RoleAssignmentEngine    engine  = new RoleAssignmentEngine(context);
                int count = engine.FlagPeopleWithRule(id, bool.Parse(ConfigurationManager.AppSettings["RequireAccessApproval"]));


                context.DeleteRule(id);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
示例#6
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
                var context = new RSMDataModelDataContext();
                var engine  = new RoleAssignmentEngine(context);

                var reqApproval = Settings.GetValueAsBool("R1SM", "RequireAccessApproval");

                var count = engine.FlagPeopleWithRule(id, reqApproval);

                context.DeleteRule(id);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
示例#7
0
        int UpdateRule(int id, string jobCode, string deptID, int location, List <GridDataRow> roles)
        {
            JCLRoleRule rule;
            var         context = new RSMDataModelDataContext();
            var         action  = "modified";

            if (id > 0)
            {
                rule = (from r in context.JCLRoleRules
                        where r.ID == id
                        select r).Single();
            }
            else
            {
                action = "created";
                rule   = new JCLRoleRule();
                context.JCLRoleRules.InsertOnSubmit(rule);
            }

            rule.JobCode  = jobCode;
            rule.DeptID   = deptID;
            rule.Location = location;

            var thisRuleRoles = from r in context.JCLRoles
                                where r.RuleID == id
                                select r;

            if (thisRuleRoles.Any())
            {
                context.JCLRoles.DeleteAllOnSubmit(thisRuleRoles);
            }

            context.SubmitChanges();

            foreach (var row in roles)
            {
                var role = new JCLRole {
                    RoleID = int.Parse(row.ID), RuleID = id
                };

                rule.JCLRoles.Add(role);
            }

            context.SubmitChanges();

            //bool reqApproval = bool.Parse( ConfigurationManager.AppSettings["RequireAccessApproval"]);
            var reqApproval = Settings.GetValueAsBool("R1SM", "RequireAccessApproval");

            var engine = new RoleAssignmentEngine(context);
            var count  = engine.FlagPeopleWithRule(rule.ID, reqApproval);

            //context.Syslog(RSMDataModelDataContext.LogSources.USER,
            //               RSMDataModelDataContext.LogSeverity.INFO,
            //               string.Format("{0} {1} rule for {2}, {3}, {4}",
            //                             User.Identity.Name,
            //                             action,
            //                             rule.Job.DisplayName,
            //                             rule.Departments.DisplayName,
            //                             rule.Locations.LocationName),
            //               string.Format("The {0} associates affected by last rule edit will be processed by the rule engine next pass.", count));

            var logger = new Logger();

            logger.LogUserActivity(Severity.Informational,
                                   string.Format("{0} {1} rule for {2}, {3}, {4}",
                                                 User.Identity.Name,
                                                 action,
                                                 rule.Job.DisplayName,
                                                 rule.Departments.DisplayName,
                                                 rule.Locations.LocationName),
                                   string.Format("The {0} associates affected by last rule edit will be processed by the rule engine next pass.", count));

            return(rule.ID);
        }
示例#8
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();
            }
        }
示例#9
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;
        }