Ejemplo n.º 1
0
 public Strategy2020ContentBuilder()
 {
     cache = CacheFactory.GetCacheManager();
     data  = new Strategy2020Data();
     InitializeTypes();
     content = new Strategy2020Content();
 }
 public Strategy2020ContentBuilder()
 {
     cache = CacheFactory.GetCacheManager();
     data  = new Strategy2020Data();
     InitializeTypes();
     content = new Strategy2020Content();
 }
 private void InitializeRelatedClasses()
 {
     content = new Strategy2020Content();
     builder = new Strategy2020ContentBuilder();
 }
 public Strategy2020ReportBuilder(Strategy2020Filter filter)
 {
     this.content = new Strategy2020Content();
     this.filter = filter;
 }
        public static List<ProcessRelation> ConvertToListOfProcessRelation(
            List<Strategy2020ListItemDTO> processes, Strategy2020Content content)
        {
            List<ProcessRelation> relation = new List<ProcessRelation>();
            foreach (Strategy2020ListItemDTO process in processes)
            {
                ProcessRelation relationItem = new ProcessRelation();
                relationItem.ProcessID = process.ProcessID;
                relationItem.ProcessName = process.ProcessName;

                int realId;

                if (content.ProcessIdLookup.TryGetValue(process.ProcessID, out realId) && realId > 0)
                {
                    relationItem.ProcessDiagramID = realId;
                }

                relation.Add(relationItem);
            }
            return relation;
        }
        public static List<SubProcessRelation> ConvertToListOfSubProcessRelation(List<ProcessSubProcessRelation> subprocesses, Strategy2020Content content )
        {
            List<SubProcessRelation> relation = new List<SubProcessRelation>();
            foreach (ProcessSubProcessRelation subprocess in subprocesses)
            {
                SubProcessRelation relationItem = new SubProcessRelation()
                {
                    SubProcessID = subprocess.SubProcessID,
                    SubProcessName = subprocess.SubProcessName
                };

                int realId;

                if (content.SubProcessIdLookup.TryGetValue(subprocess.SubProcessID, out realId))
                {
                    relationItem.SubProcessDiagramID = realId;
                }

                relation.Add(relationItem);
            }
            return relation;
        }
Ejemplo n.º 7
0
        public List <Strategy2020DTO> TransformRawStrategyList
            (List <Strategy2020ListItemDTO> initialList,
            List <ProcessSubProcessRelation> processSubProcessRelation,
            List <ProcessApplicationRelation> processApplicationRelation,
            List <SubProcessModuleRelation> subProcModuleRelation,
            List <ApplicationModuleRelation> appModulesRelation)
        {
            FillUpType(initialList);

            List <Strategy2020DTO> newList = new List <Strategy2020DTO>();
            Strategy2020Data       data    = new Strategy2020Data();
            Strategy2020Content    lookup  = new Strategy2020Content();

            //NOTE: The entry point is still the initiative topic,
            //but they are not shown in the result data
            List <EntityDTO> entryPoint = data.GetAllInitiativeTopic();

            //DumpInitialList(initialList.OrderBy(c=>c.ProcessID).ToList());
            //DumpProcessToSubprocess(processSubProcessRelation.OrderBy(c=>c.ProcessID).ToList());
            //return null;
            entryPoint.Add(new EntityDTO());
            foreach (EntityDTO e in entryPoint)
            {
                var tempTable = (from il in initialList
                                 where il.InitiativeTopicID == e.ID
                                 select il).Distinct(new AgendaComparer()).ToList();
                foreach (Strategy2020ListItemDTO sub in tempTable)
                {
                    Strategy2020DTO s = new Strategy2020DTO();
                    s.InitiativeTopic   = sub.InitiativeTopicName;
                    s.InitiativeTopicID = sub.InitiativeTopicID;
                    s.AgendaTypeID      = sub.AgendaTypeID;
                    if (sub.AgendaTypeID != 0)
                    {
                        s.Type  = TypeNames.Where(c => c.Key == sub.AgendaTypeID).FirstOrDefault().Value.Name;
                        s.Order = TypeNames.Where(c => c.Key == sub.AgendaTypeID).FirstOrDefault().Value.Order;
                    }
                    else
                    {
                        s.Order = 9999;
                    }

                    s.Agenda   = sub.AgendaName;
                    s.AgendaID = sub.AgendaID;


                    var policies = (from pp in initialList
                                    where pp.AgendaID == s.AgendaID
                                    select pp).Distinct(new PolicyComparer()).ToList();

                    List <BusinessPolicy> b_policies =
                        Strategy2020DTOConverter.ConvertToListOfBusinessPolicy(policies);

                    foreach (BusinessPolicy b_policy in b_policies)
                    {
                        var rules = (from rr in initialList
                                     where rr.PolicyID == b_policy.BusinessPolicyID
                                     select rr).Distinct(new RuleComparer()).ToList();

                        List <BusinessRule> b_rules =
                            Strategy2020DTOConverter.ConvertToListOfBusinessRule(rules);



                        foreach (BusinessRule rule in b_rules)
                        {
                            var processes = (from proc in initialList
                                             where proc.RuleID == rule.BusinessRuleID
                                             select proc).Distinct(new ProcessComparer()).ToList();

                            List <ProcessRelation> p_list =
                                Strategy2020DTOConverter.ConvertToListOfProcessRelation(processes, lookup);

                            foreach (ProcessRelation p_rel in p_list)
                            {
                                var subprocesses = (from subproc in processSubProcessRelation
                                                    where subproc.ProcessID == p_rel.ProcessID
                                                    orderby subproc.SubProcessName
                                                    select subproc).Distinct(new SubProcessComparer()).ToList();

                                List <SubProcessRelation> sp_list =
                                    Strategy2020DTOConverter.ConvertToListOfSubProcessRelation(subprocesses, lookup);

                                foreach (SubProcessRelation sp_rel in sp_list)
                                {
                                    var modules = (from mods in subProcModuleRelation
                                                   where mods.SubProcessID == sp_rel.SubProcessID
                                                   select mods).ToList(); //new ModulesComparer()).ToList();

                                    List <ModuleRelation> mod_list =
                                        Strategy2020DTOConverter.ConvertToListOfModuleRelation(modules);
                                    sp_rel.Modules = mod_list;
                                }

                                p_rel.SubProcesses = sp_list;

                                //here goes the application relationship

                                var apps = (from app in processApplicationRelation
                                            where app.ProcessID == p_rel.ProcessID
                                            select app).ToList();

                                List <ApplicationRelation> apprelation =
                                    Strategy2020DTOConverter.ConvertToListOfApplicationRelation(apps);

                                foreach (ApplicationRelation app_rel in apprelation)
                                {
                                    var app_mods = (from mods in appModulesRelation
                                                    where mods.ApplicationID == app_rel.ApplicationID
                                                    select mods).ToList();


                                    List <ModuleRelation> app_mod_list =
                                        Strategy2020DTOConverter.ConvertToListOfApplicationModuleRelation(app_mods);

                                    app_rel.Modules = app_mod_list;
                                }

                                p_rel.Application = apprelation;
                            }

                            rule.Processes = p_list;
                        }

                        b_policy.Rules = b_rules;
                    }

                    s.Policies = b_policies;

                    newList.Add(s);
                }
            }

            return(newList.OrderBy(c => c.Order).ToList());
        }
        public List<Strategy2020DTO> TransformRawStrategyList(List<Strategy2020ListItemDTO> initialList,
            List<ProcessSubProcessRelation> processSubProcessRelation,
            List<ProcessApplicationRelation> processApplicationRelation,
            List<SubProcessModuleRelation> subProcModuleRelation,
            List<ApplicationModuleRelation> appModulesRelation)
        {
            FillUpType(initialList);

            List<Strategy2020DTO> newList = new List<Strategy2020DTO>();
            Strategy2020Data data = new Strategy2020Data();
            Strategy2020Content lookup = new Strategy2020Content();

            //NOTE: The entry point is still the initiative topic,
            //but they are not shown in the result data
            List<EntityDTO> entryPoint = data.GetAllInitiativeTopic();
            //DumpInitialList(initialList.OrderBy(c=>c.ProcessID).ToList());
            //DumpProcessToSubprocess(processSubProcessRelation.OrderBy(c=>c.ProcessID).ToList());
            //return null;
            entryPoint.Add(new EntityDTO());
            foreach (EntityDTO e in entryPoint)
            {
                var tempTable = (from il in initialList
                                 where il.InitiativeTopicID == e.ID
                                 select il).Distinct(new AgendaComparer()).ToList();
                foreach (Strategy2020ListItemDTO sub in tempTable)
                {
                    Strategy2020DTO s = new Strategy2020DTO();
                    s.InitiativeTopic = sub.InitiativeTopicName;
                    s.InitiativeTopicID = sub.InitiativeTopicID;
                    s.AgendaTypeID = sub.AgendaTypeID;
                    if (sub.AgendaTypeID != 0)
                    {
                        s.Type = TypeNames.Where(c => c.Key == sub.AgendaTypeID).FirstOrDefault().Value.Name;
                        s.Order = TypeNames.Where(c => c.Key == sub.AgendaTypeID).FirstOrDefault().Value.Order;
                    }
                    else
                    {
                        s.Order = 9999;
                    }

                    s.Agenda = sub.AgendaName;
                    s.AgendaID = sub.AgendaID;

                    var policies = (from pp in initialList
                                    where pp.AgendaID == s.AgendaID
                                    select pp).Distinct(new PolicyComparer()).ToList();

                    List<BusinessPolicy> b_policies =
                        Strategy2020DTOConverter.ConvertToListOfBusinessPolicy(policies);

                    foreach (BusinessPolicy b_policy in b_policies)
                    {
                        var rules = (from rr in initialList
                                     where rr.PolicyID == b_policy.BusinessPolicyID
                                     select rr).Distinct(new RuleComparer()).ToList();

                        List<BusinessRule> b_rules =
                            Strategy2020DTOConverter.ConvertToListOfBusinessRule(rules);

                        foreach (BusinessRule rule in b_rules)
                        {
                            var processes = (from proc in initialList
                                             where proc.RuleID == rule.BusinessRuleID
                                             select proc).Distinct(new ProcessComparer()).ToList();

                            List<ProcessRelation> p_list =
                                Strategy2020DTOConverter.ConvertToListOfProcessRelation(processes, lookup);

                            foreach (ProcessRelation p_rel in p_list)
                            {
                                var subprocesses = (from subproc in processSubProcessRelation
                                                    where subproc.ProcessID == p_rel.ProcessID
                                                    orderby subproc.SubProcessName
                                                    select subproc).Distinct(new SubProcessComparer()).ToList();

                                List<SubProcessRelation> sp_list =
                                    Strategy2020DTOConverter.ConvertToListOfSubProcessRelation(subprocesses, lookup);

                                foreach (SubProcessRelation sp_rel in sp_list)
                                {
                                    var modules = (from mods in subProcModuleRelation
                                                   where mods.SubProcessID == sp_rel.SubProcessID
                                                   select mods).ToList(); //new ModulesComparer()).ToList();

                                    List<ModuleRelation> mod_list =
                                        Strategy2020DTOConverter.ConvertToListOfModuleRelation(modules);
                                    sp_rel.Modules = mod_list;
                                }

                                p_rel.SubProcesses = sp_list;

                                //here goes the application relationship

                                var apps = (from app in processApplicationRelation
                                            where app.ProcessID == p_rel.ProcessID
                                            select app).ToList();

                                List<ApplicationRelation> apprelation =
                                    Strategy2020DTOConverter.ConvertToListOfApplicationRelation(apps);

                                foreach (ApplicationRelation app_rel in apprelation)
                                {
                                    var app_mods = (from mods in appModulesRelation
                                                          where mods.ApplicationID == app_rel.ApplicationID
                                                          select mods).ToList();

                                    List<ModuleRelation> app_mod_list =
                                        Strategy2020DTOConverter.ConvertToListOfApplicationModuleRelation(app_mods);

                                    app_rel.Modules = app_mod_list;
                                }

                                p_rel.Application = apprelation;
                            }

                            rule.Processes = p_list;
                        }

                        b_policy.Rules = b_rules;
                    }

                    s.Policies = b_policies;

                    newList.Add(s);
                }
            }

            return newList.OrderBy(c => c.Order).ToList();
        }
Ejemplo n.º 9
0
 private void InitializeRelatedClasses()
 {
     content = new Strategy2020Content();
     builder = new Strategy2020ContentBuilder();
 }