internal static Application GetInstance(AccessConfiguration data) { var role = data.AccessDetails.FeatureName; var appInstance = new LG.Data.Models.Identity.Application() { AppPortalType = role, Details = new AccessDetails() { AccessMode = data.AccessDetails.AccessMode, FeatureName = data.AccessDetails.FeatureName, AccessType = data.AccessDetails.AccessType, ActionMode = data.AccessDetails.ActionMode, Scope = data.AccessDetails.Scope } }; switch (role) { case ApplicationPortal.AdministrativeDashboard: #region @ Bind Area appInstance.Areas = new List <Area> { GetDashboardArea() }; foreach (var a in data.AccessDetails.AreaList) { var r = new LG.Data.Models.Applications.Area { Name = a.FeatureName }; foreach (var a2 in a.Roles) { if (a2.RoleName == LG.Data.Models.Enums.Applications.AreaEnum.User) { r.User = GetAreaRole(a2); } if (a2.RoleName == LG.Data.Models.Enums.Applications.AreaEnum.Administrator) { r.Administrator = GetAreaRole(a2); } } appInstance.Areas.Add(r); } #endregion break; case ApplicationPortal.ClientManagement: #region @ Bind Area var clientArea = new Area() { Name = LG.Data.Models.Enums.Applications.AreaEnum.ClientManagement }; foreach (var a in data.AccessDetails.AreaList) { if (a.FeatureName == AreaEnum.User) { clientArea.User = new AreaRole() { AccessMode = a.AccessMode, AccessType = a.AccessType, ActionMode = a.ActionMode, Role = a.FeatureName }; } if (a.FeatureName == AreaEnum.Administrator) { clientArea.Administrator = new AreaRole() { AccessMode = a.AccessMode, AccessType = a.AccessType, ActionMode = a.ActionMode, Role = a.FeatureName }; } } appInstance.Areas.Add(clientArea); //var clientArea = new Area() //{ // Name = GetAreaEnum(data.AccessDetails.FeatureName.ToString()) //}; //foreach (var a in data.AccessDetails.AreaList) //{ // clientArea.User = GetAreaRole(a.Roles.First(x => x.RoleName.ToString() == "User")); // clientArea.Administrator = GetAreaRole(a.Roles.First(x => x.RoleName.ToString() == "Administrator")); //} //appInstance.Areas.Add(clientArea); #endregion break; case ApplicationPortal.MemberManagement: break; case ApplicationPortal.Accounting: break; case ApplicationPortal.Reports: break; case ApplicationPortal.UserAdministration: break; case ApplicationPortal.HealthServicesProviderManagement: break; } return(appInstance); }
internal static Application GetInstance(AccessConfiguration data) { var role = data.AccessDetails.FeatureName; var appInstance = new LG.Data.Models.Identity.Application() { AppPortalType = role, Details = new AccessDetails() { AccessMode = data.AccessDetails.AccessMode, FeatureName = data.AccessDetails.FeatureName, AccessType = data.AccessDetails.AccessType, ActionMode = data.AccessDetails.ActionMode, Scope = data.AccessDetails.Scope } }; switch (role) { case ApplicationPortal.AdministrativeDashboard: #region @ Bind Area appInstance.Areas = new List<Area> {GetDashboardArea()}; foreach (var a in data.AccessDetails.AreaList) { var r = new LG.Data.Models.Applications.Area { Name = a.FeatureName }; foreach (var a2 in a.Roles) { if (a2.RoleName == LG.Data.Models.Enums.Applications.AreaEnum.User) { r.User = GetAreaRole(a2); } if (a2.RoleName == LG.Data.Models.Enums.Applications.AreaEnum.Administrator) { r.Administrator = GetAreaRole(a2); } } appInstance.Areas.Add(r); } #endregion break; case ApplicationPortal.ClientManagement: #region @ Bind Area var clientArea = new Area() { Name = LG.Data.Models.Enums.Applications.AreaEnum.ClientManagement }; foreach (var a in data.AccessDetails.AreaList) { if (a.FeatureName == AreaEnum.User) { clientArea.User = new AreaRole() { AccessMode = a.AccessMode, AccessType = a.AccessType, ActionMode = a.ActionMode, Role = a.FeatureName }; } if (a.FeatureName == AreaEnum.Administrator) { clientArea.Administrator = new AreaRole() { AccessMode = a.AccessMode, AccessType = a.AccessType, ActionMode = a.ActionMode, Role = a.FeatureName }; } } appInstance.Areas.Add(clientArea); //var clientArea = new Area() //{ // Name = GetAreaEnum(data.AccessDetails.FeatureName.ToString()) //}; //foreach (var a in data.AccessDetails.AreaList) //{ // clientArea.User = GetAreaRole(a.Roles.First(x => x.RoleName.ToString() == "User")); // clientArea.Administrator = GetAreaRole(a.Roles.First(x => x.RoleName.ToString() == "Administrator")); //} //appInstance.Areas.Add(clientArea); #endregion break; case ApplicationPortal.MemberManagement: break; case ApplicationPortal.Accounting: break; case ApplicationPortal.Reports: break; case ApplicationPortal.UserAdministration: break; case ApplicationPortal.HealthServicesProviderManagement: break; } return appInstance; }