/// <summary> /// Convert /// </summary> /// <param name="features"></param> /// <param name="modules"></param> public static void Convert(List <ModuleFeature_Result> features, List <ModuleDC> modules) { if (modules != null) { foreach (ModuleFeature_Result feature in features) { ModuleDC module = modules.Where(ee => ee.ModuleId.Equals(feature.ModuleId)).FirstOrDefault(); if (module == null) { module = new ModuleDC { ModuleId = feature.ModuleId, ModuleName = feature.ModuleName, ModuleDescription = feature.ModuleDescription, ModuleCode = feature.ModuleCode }; modules.Add(module); } module.Features.Add(new ModuleFeatureDC { FeatureId = feature.FeatureId, FeatureCode = feature.FeatureCode, FeatureName = feature.FeatureName, IsSelected = feature.IsAssigned.Value }); } } }
public static ModuleDC Convert(ModuleModel module) { var map = Mapper.Resolve <ModuleModel, ModuleDC>(MapResolveOptions.UsePrivateSetter); ModuleDC moduleDC = Mapper.Map <ModuleModel, ModuleDC>(module); //module.Features.ToList().ForEach(feature => featureModel.ModuleFeatures.Add(Convert(feature))); return(moduleDC); }
/// <summary> /// AddRole /// </summary> /// <param name="roleModel"></param> public void SaveModule(ModuleModel moduleModel) { ModuleDC moduleRequest = SecurityClientTranslate.Convert(moduleModel); ServiceResponse moduleResponse = _securityProxy.Execute(opt => opt.SaveModule(moduleRequest)); if (moduleResponse.Status != ResponseStatus.Success) { HandleError(moduleResponse.Status, moduleResponse.ResponseMessage); } }
public static ModuleModel Convert(ModuleDC module) { var map = Mapper.Resolve <ModuleDC, ModuleModel>(MapResolveOptions.UsePrivateSetter); ModuleModel featureModel = Mapper.Map <ModuleDC, ModuleModel>(module); if (module.Features != null) { module.Features.ToList().ForEach(feature => featureModel.ModuleFeatures.Add(Convert(feature))); } return(featureModel); }
public ServiceResponse SaveModule(ModuleDC module) { ServiceResponse moduleResponse = new ServiceResponse(); try { SetContext(); _securityManager.SaveModule(Mapper.Map <ModuleDC, Module>(module)); } catch (Exception ex) { HandleError(ex, moduleResponse); } return(moduleResponse); }
/// <summary> /// ModuleDC /// </summary> /// <param name="module"></param> /// <returns></returns> public static ModuleDC Convert(Module module) { var map = Mapper.Resolve <Module, ModuleDC>(MapResolveOptions.UsePrivateSetter); ModuleDC moduleDC = Mapper.Map <Module, ModuleDC>(module); module.Features.ToList().ForEach(feature => { if (moduleDC.Features == null) { moduleDC.Features = new List <ModuleFeatureDC>(); } moduleDC.Features.Add(Convert(feature)); } ); return(moduleDC); }
/// <summary> /// Convert /// </summary> /// <param name="features"></param> /// <param name="modules"></param> public static void Convert(List <FeatureResult> features, List <ModuleDC> modules) { if (modules != null) { foreach (FeatureResult feature in features) { ModuleDC module = modules.Where(ee => ee.ModuleId.Equals(feature.ModuleId)).FirstOrDefault(); if (module == null) { module = new ModuleDC { ModuleId = feature.ModuleId, ModuleName = feature.ModuleName, ModuleDescription = feature.ModuleDescription, ModuleCode = feature.ModuleCode }; modules.Add(module); } ModuleFeatureDC moduleFeatureDC = new ModuleFeatureDC { FeatureId = feature.FeatureId, FeatureCode = feature.FeatureCode, FeatureName = feature.FeatureName, IsSelected = feature.IsAssigned.Value }; module.Features.Add(moduleFeatureDC); moduleFeatureDC.RoleFeaturePermissions = new List <FeaturePermissionDC>(); if (feature.RoleFeaturePermissions != null) { foreach (FeaturePermissionResult featurePermissionResult in feature.RoleFeaturePermissions) { moduleFeatureDC.RoleFeaturePermissions.Add(Mapper.Map <FeaturePermissionResult, FeaturePermissionDC>(featurePermissionResult)); } } moduleFeatureDC.SiteContentSettings = new List <SiteContentSettingDC>(); if (feature.SiteContentSettings != null) { foreach (SiteContentSettingResult siteContentSetting in feature.SiteContentSettings) { moduleFeatureDC.SiteContentSettings.Add(Mapper.Map <SiteContentSettingResult, SiteContentSettingDC>(siteContentSetting)); } } } } }