Exemplo n.º 1
0
        public List <PlanDynamic> GetOnUsedPlanDynamicList(string roleID)
        {
            Organization org   = new EcpOrgService().GetUserOrg(Utils.GetUserId(), Utils.GetTenantId());
            string       orgID = org.ID;

            return(dac.GetOnUsedPlanDynamicList(roleID, orgID));
        }
Exemplo n.º 2
0
        internal PlanDefine GetPlanDefine(string planDefineID)
        {
            PlanDefine    planDefine  = dac.GetPlanDefineInfo(planDefineID);
            List <string> orgStrList  = new List <string>();
            List <string> roleStrList = new List <string>();

            dac.AssemblyAllocation(planDefineID, orgStrList, roleStrList);
            List <Organization> orgList    = new List <Organization>();
            List <Role>         roleList   = new List <Role>();
            EcpOrgService       orgService = new EcpOrgService();

            if (orgStrList != null && orgStrList.Count > 0)
            {
                orgStrList.ForEach(orgID => {
                    Organization org = orgService.GetByID(orgID, Utils.GetTenantId());
                    if (org != null)
                    {
                        orgList.Add(org);
                    }
                });
                planDefine.OrgList = orgList;
            }

            if (roleStrList != null && roleStrList.Count > 0)
            {
                Manager manager = new Manager();
                roleStrList.ForEach(roleID => {
                    Role role = manager.GetRoleByID(roleID);
                    if (role != null)
                    {
                        roleList.Add(role);
                    }
                });
                planDefine.RoleList = roleList;
            }
            if (planDefine.PlanModel != null && planDefine.PlanModel.PlanItemModelContent != null && planDefine.PlanModel.PlanItemModelContent.Count > 0)
            {
                Dictionary <string, bool> customizedModelField = new Dictionary <string, bool>();
                if (planDefine.PlanItemCustomization != null && planDefine.PlanItemCustomization.CustomizedModelContent != null && planDefine.PlanItemCustomization.CustomizedModelContent.Count > 0)
                {
                    planDefine.PlanItemCustomization.CustomizedModelContent.ForEach(field =>
                    {
                        if (!customizedModelField.ContainsKey(field.ID))
                        {
                            customizedModelField.Add(field.ID, field.IsEnable);
                        }
                    });
                }
                List <PlanItemModelField> content = planDefine.PlanModel.PlanItemModelContent;
                for (int i = 0; i < content.Count; i++)
                {
                    content[i].IsEnable = true;
                    if (customizedModelField.ContainsKey(content[i].ID))
                    {
                        content[i].IsEnable = customizedModelField[content[i].ID];
                    }
                }
            }
            return(planDefine);
        }