//---------------------------------------------------------------------------------------------------------------------

        public static ServiceParameterConfiguration FromService(IfyContext context, Service service)
        {
            ServiceParameterConfiguration result = new ServiceParameterConfiguration(context);

            result.Service = service;
            return(result);
        }
        //---------------------------------------------------------------------------------------------------------------------

        public static ServiceParameterConfiguration FromServiceParameter(IfyContext context, RequestParameter requestParameter, int subjectType, int subjectId)   // !!! change to ServiceParameter
        {
            ServiceParameterConfiguration result = new ServiceParameterConfiguration(context);

            result.ServiceParameter = requestParameter;
            result.Service          = requestParameter.Service;
            result.SubjectType      = subjectType;
            result.SubjectId        = subjectId;

            if (subjectType != 0)
            {
                result.LoadConfiguration(
                    String.Format("id_service={0} AND name={1} AND id_grp{2} AND id_usr{3}",
                                  result.Service.Id,
                                  StringUtils.EscapeSql(result.ServiceParameter.Name),
                                  subjectType == ConfigurationSubjectType.Group ? "=" + subjectId : " IS NULL",
                                  subjectType == ConfigurationSubjectType.User ? "=" + subjectId : " IS NULL"
                                  )
                    );
            }

            return(result);
        }