Esempio n. 1
0
 /// <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
             });
         }
     }
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        /// <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);
            }
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        /// <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);
        }
Esempio n. 7
0
 /// <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));
                 }
             }
         }
     }
 }