Exemplo n.º 1
0
 public ConfigurationServiceResponse CreateFeature(string code, string name, string description)
 {
     try {
         UserConnection.CreateFeature(code, name, description);
         return(new ConfigurationServiceResponse());
     } catch (Exception e) {
         return(new ConfigurationServiceResponse(e));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Create Feature if it does not exist and sets feature state.
        /// </summary>
        /// <param name="source">User connection.</param>
        /// <param name="code">Feature code.</param>
        /// <param name="state">New feature state.</param>
        /// <param name="forAllUsers">If defined as true state will be updated for all users</param>
        public static void SafeSetFeatureState(this UserConnection source, string code, int state,
                                               bool forAllUsers = false)
        {
            Guid featureId = ExtractFeatureId(source, code);

            if (featureId == Guid.Empty)
            {
                source.CreateFeature(code, code, String.Empty);
                featureId = ExtractFeatureId(source, code);
            }
            SafeSetAdminUnitFeatureState(source, featureId, state, forAllUsers);
        }