Exemplo n.º 1
0
        private CEUtil(string ceUri, string osName, string ceUser, string password, LogMsg logMsg)
        {
#if (P8_451)
            // P8 4.5 authentication
            UsernameToken token = new UsernameToken(ceUser, password, PasswordOption.SendPlainText);
            UserContext.SetProcessSecurityToken(token);
#else
            // P8 5.0 authentication
            UsernameCredentials cred = new UsernameCredentials(ceUser, password);
            ClientContext.SetProcessCredentials(cred);
#endif
            conn = Factory.Connection.GetConnection(ceUri);
            isCredentialsEstablished = true;

            // Get domain name
            PropertyFilter pf = new PropertyFilter();
            pf.AddIncludeProperty(0, null, null, "Name", null);
            pf.AddIncludeProperty(0, null, null, "Id", null);
            domain = Factory.Domain.FetchInstance(conn, null, null);
            objStore = Factory.ObjectStore.FetchInstance(domain, osName, null);

            // Successfully initialized CEUtil object: save singleton instance
            this.logMsg = logMsg;
            gCEUtil = this;
        }
Exemplo n.º 2
0
        public HomeController(IDataSource dataSource, IDomainFactory domainFactory)
        {
            Contract.Requires(dataSource != null);
            Contract.Requires(domainFactory != null);

            domain = domainFactory.Create(dataSource);
        }
Exemplo n.º 3
0
        public SagePayController(IDomain domainService,
            IECommerce ecommerceService,
            IUser userService,
            IWebContent webContentService)
            : base(domainService, ecommerceService, userService, webContentService)
        {
            this.DomainService = domainService;
            this.ECommerceService = ecommerceService;
            this.UserService = userService;

            switch (this.DomainService.GetSettingsValue(BL.SettingsKey.sagePayMode, this.DomainID).ToLowerInvariant())
            {
                case "test":
                    ServerMode = VspServerMode.Test;
                    break;
                case "live":
                    ServerMode = VspServerMode.Live;
                    break;
                default:
                    ServerMode = VspServerMode.Simulator;
                    break;
            }

            switch (this.DomainService.GetSettingsValue(BL.SettingsKey.sagePayMethod, this.DomainID).ToLowerInvariant())
            {
                case "direct":
                    PaymentType = PaymentType.Direct;
                    break;
                default:
                    PaymentType = PaymentType.Server;
                    break;
            }
        }
Exemplo n.º 4
0
 public ErrorController(IDomain domainService,
     IWebContent webContentService,
     IECommerce ecommerceService,
     IUser userService)
     : base(domainService, ecommerceService, userService, webContentService)
 {
 }
Exemplo n.º 5
0
        public Variable(IDomain domain, Value value)
        {
            if(!domain.Equals(value.ValueDomain))
                throw new Exception("Value and domain mismatch");

            ValueDomain = domain;
            _value = value;
        }
Exemplo n.º 6
0
 public FuzzySet(IDomain domain, IDictionary<string[], double> memberships)
 {
     this.domain = domain;
     this.memberships = new List<double>(new double[domain.GetCardinality()]);
     foreach (var membership in memberships)
     {
         this.memberships[domain.GetIndexOfElement(domain.FromStringRepresentation(membership.Key))] = membership.Value;
     }
 }
Exemplo n.º 7
0
 private CEConnection(string sUri, string sObjectStore, string sUserName, string sPassword)
 {
     System.Net.ServicePointManager.ServerCertificateValidationCallback = (a, b, c, d) => true;
     UsernameCredentials cred = new UsernameCredentials(sUserName, sPassword);
     ClientContext.SetProcessCredentials(cred);
     this.conn = Factory.Connection.GetConnection(sUri);
     this._domain = Factory.Domain.FetchInstance(this.conn, null, null);
     this.objectStore = Factory.ObjectStore.FetchInstance(this._domain, sObjectStore, null);
 }
Exemplo n.º 8
0
 public bool Login()
 {
    
         UserContext.SetProcessSecurityToken(new UsernameToken(_userName, _userPass, PasswordOption.SendPlainText));
         _connection = Factory.Connection.GetConnection(_webServiceURI);
         _domain = Factory.Domain.FetchInstance(_connection, "", null);
         _objectStore = Factory.ObjectStore.FetchInstance(_domain, _objStoreName, null);        
         return true;
     }
Exemplo n.º 9
0
 public PayPalController(IDomain domainService,
     IECommerce ecommerceService,
     IUser userService,
     IWebContent webContentService)
     : base(domainService, ecommerceService, userService, webContentService)
 {
     this.DomainService = domainService;
     this.ECommerceService = ecommerceService;
     this.UserService = userService;
 }
Exemplo n.º 10
0
 public StripeController(IDomain domainService,
     IECommerce ecommerceService,
     IUser userService,
     IWebContent webContentService,
     IStripe stripeService)
     : base(domainService, ecommerceService, userService, webContentService)
 {
     _domainService = domainService;
     _eCommerceService = ecommerceService;
     _stripeService = stripeService;
 }
Exemplo n.º 11
0
 public IFuzzySet CylindricalExtension(IDomain domain)
 {
     int other = this.domain.GetDomainComponents().Contains(domain.GetDomainComponents()[0]) ? domain.GetDomainComponents().Count() - 1 : 0;
     IList<double> memberships = new List<double>();
     for (int i = 0; i < domain.GetCardinality(); i++)
     {
         IList<object> element = domain.ElementAt(i).ToList();
         element.RemoveAt(other);
         memberships.Add(this.GetMembershipFor(element.ToArray()));
     }
     return new FuzzySet(domain, memberships);
 }
Exemplo n.º 12
0
        public RandVar(String name, IDomain domain)
        {
            ProbUtil.checkValidRandomVariableName(name);
            if (null == domain)
            {
                throw new ArgumentException(
                    "Domain of RandomVariable must be specified.");
            }

            this.name = name;
            this.domain = domain;
            this.scope.add(this);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Disposes the domain and the controller.
        /// </summary>
        /// <param name="disposing">Indicates whether disposing is happening.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (this.domain != null)
                {
                    this.domain.Dispose();
                    this.domain = null;
                }
            }

            base.Dispose(disposing);
        }
Exemplo n.º 14
0
        private void ConnectQueryEvent(IDomain domain, ref bool IsConnected)
        {
            if (QueryEvent != null && (QueryObject == null || QueryObjectEvent == null))
            {
                IObject      Object      = null;
                IObjectEvent ObjectEvent = null;
                QueryEvent.Connect(domain, ref Object, ref ObjectEvent);
                QueryObject      = Object;
                QueryObjectEvent = ObjectEvent;
                QueryObjectEvent.SetIsProvidingCustomPageName(QueryEvent.EventSource, true);

                IsConnected = true;
                SetIsReachable();
            }
        }
Exemplo n.º 15
0
        public IEnumerable <KeyValuePair <string, IssueCode> > GetIssues(
            [NotNull] IField field,
            [CanBeNull] IFieldSpecificationIssueCodes issueCodes)
        {
            if (field.Type != _expectedFieldType)
            {
                yield return(new KeyValuePair <string, IssueCode>(
                                 GetUnexpectedFieldTypeMessage(field),
                                 issueCodes?.UnexpectedFieldType));
            }

            if (_expectedFieldLength > 0)
            {
                if (field.Length != _expectedFieldLength)
                {
                    yield return(new KeyValuePair <string, IssueCode>(
                                     GetUnexpectedFieldLengthMessage(field),
                                     issueCodes?.UnexpectedFieldLength));
                }
            }

            if (StringUtils.IsNotEmpty(ExpectedAliasName) &&
                !Equals(field.AliasName, ExpectedAliasName))
            {
                yield return(new KeyValuePair <string, IssueCode>(
                                 GetUnexpectedFieldAliasMessage(field),
                                 issueCodes?.UnexpectedAlias));
            }

            // TODO keyword for "no domain allowed"
            if (StringUtils.IsNotEmpty(_expectedDomainName))
            {
                IDomain domain = field.Domain;

                if (domain == null)
                {
                    yield return(new KeyValuePair <string, IssueCode>(
                                     GetNoDomainMessage(),
                                     issueCodes?.NoDomain));
                }
                else if (!Equals(domain.Name, _expectedDomainName))
                {
                    yield return(new KeyValuePair <string, IssueCode>(
                                     GetUnexpectedDomainMessage(domain),
                                     issueCodes?.UnexpectedDomain));
                }
            }
        }
Exemplo n.º 16
0
        public async Task <IActionResult> Create([FromBody] Domain domain)
        {
            IActionResult result = null;

            try
            {
                if (result == null && domain == null)
                {
                    result = BadRequest("Missing domain data");
                }
                if (result == null && string.IsNullOrEmpty(domain.Name))
                {
                    result = BadRequest("Missing domain name value");
                }
                if (result == null && (!domain.AccountId.HasValue || domain.AccountId.Value.Equals(Guid.Empty)))
                {
                    result = BadRequest("Missing account id value");
                }
                if (result == null && !UserCanAccessAccount(domain.AccountId.Value))
                {
                    result = StatusCode(StatusCodes.Status401Unauthorized);
                }
                if (result == null)
                {
                    using ILifetimeScope scope = _container.BeginLifetimeScope();
                    SettingsFactory settingsFactory = scope.Resolve <SettingsFactory>();
                    CoreSettings    settings        = settingsFactory.CreateAccount(_settings.Value);
                    IDomainFactory  domainFactory   = scope.Resolve <IDomainFactory>();
                    IDomain         innerDomain     = await domainFactory.Create(domain.AccountId.Value);

                    IMapper mapper = MapperConfigurationFactory.CreateMapper();
                    mapper.Map <Domain, IDomain>(domain, innerDomain);
                    IDomainSaver saver = scope.Resolve <IDomainSaver>();
                    await saver.Create(settings, innerDomain);

                    result = Ok(mapper.Map <Domain>(innerDomain));
                }
            }
            catch (Exception ex)
            {
                using (ILifetimeScope scope = _container.BeginLifetimeScope())
                {
                    await LogException(ex, scope.Resolve <IExceptionService>(), scope.Resolve <SettingsFactory>(), _settings.Value);
                }
                result = StatusCode(StatusCodes.Status500InternalServerError);
            }
            return(result);
        }
Exemplo n.º 17
0
        public bool Connect(IDomain domain, ref IObject obj, ref IObjectEvent objectEvent)
        {
            bool IsConnected = false;

            if (obj == null)
            {
                foreach (IObject Item in domain.Objects)
                {
                    if (Item.Name == ObjectSource.Name)
                    {
                        obj = Item;
                        break;
                    }
                }

                if (obj == null)
                {
                    throw new ParsingException(135, ObjectSource.Source, $"Unknown object '{ObjectSource.Name}'.");
                }

                obj.SetIsUsed();

                IsConnected = true;
            }

            if (objectEvent == null)
            {
                foreach (IObjectEvent Event in obj.Events)
                {
                    if (Event.NameSource.Name == ObjectEventSource.Name)
                    {
                        objectEvent = Event;
                        break;
                    }
                }

                if (objectEvent == null)
                {
                    throw new ParsingException(136, ObjectEventSource.Source, $"Unknown event '{ObjectEventSource.Name}'.");
                }

                objectEvent.SetIsUsed();

                IsConnected = true;
            }

            return(IsConnected);
        }
Exemplo n.º 18
0
        public bool ConnectToObjectItemList(IDomain domain, IArea currentArea, IObject currentObject, ref IObject obj, ref IObjectPropertyItemList objectProperty, ref IObject ItemObject)
        {
            bool IsConnected = false;

            if ((ObjectSource != null || ObjectPropertySource != null) && (obj == null || objectProperty == null))
            {
                ConnectToObject(domain, currentArea, ObjectSource, ObjectPropertySource, ObjectPropertyKey, ref obj);

                foreach (IObjectProperty Property in obj.Properties)
                {
                    if (Property.NameSource.Name == ObjectPropertySource.Name)
                    {
                        if (Property is IObjectPropertyItemList AsObjectPropertyItemList)
                        {
                            objectProperty = AsObjectPropertyItemList;
                            break;
                        }
                        else
                        {
                            throw new ParsingException(151, ObjectPropertySource.Source, $"'{obj.Name}.{ObjectPropertySource.Name}' must be an item list property.");
                        }
                    }
                }

                if (objectProperty == null)
                {
                    throw new ParsingException(141, ObjectPropertySource.Source, $"Unknown property '{ObjectPropertySource.Name}' in object '{obj.Name}'.");
                }

                foreach (IObject Item in domain.Objects)
                {
                    if (Item.Name == objectProperty.ObjectSource.Name)
                    {
                        ItemObject = Item;
                        break;
                    }
                }

                if (ItemObject == null)
                {
                    throw new ParsingException(152, ObjectPropertySource.Source, $"Unknown object '{objectProperty.ObjectSource.Name}' for item list '{ObjectPropertySource.Name}'.");
                }

                IsConnected = true;
            }

            return(IsConnected);
        }
Exemplo n.º 19
0
 private void ConnectBefore(IDomain domain, IComponentEvent beforeEvent)
 {
     if (beforeEvent != null)
     {
         IObject      Object      = null;
         IObjectEvent ObjectEvent = null;
         beforeEvent.Connect(domain, ref Object, ref ObjectEvent);
         BeforeObject      = Object;
         BeforeObjectEvent = ObjectEvent;
     }
     else
     {
         BeforeObject      = null;
         BeforeObjectEvent = null;
     }
 }
Exemplo n.º 20
0
        /// <summary>
        /// Tries to the get culture by the domain.
        /// </summary>
        /// <param name="domain">The domain.</param>
        /// <param name="culture">The culture.</param>
        /// <returns></returns>
        public static CultureInfo TryGetCulture(
            this IDomain domain,
            CultureInfo culture)
        {
            if (domain == null)
            {
                return(LocalizationContext.DefaultCulture);
            }

            if (domain.LanguageIsoCode.Equals(culture.Name, StringComparison.OrdinalIgnoreCase) == false)
            {
                culture = LocalizationContext.DefaultCulture;
            }

            return(culture);
        }
Exemplo n.º 21
0
        private int CheckDomainUsage([NotNull] IDomain domain,
                                     [NotNull] IField referencingField)
        {
            if (domain.FieldType == referencingField.Type)
            {
                return(NoError);
            }

            return(ReportSchemaPropertyError(
                       Codes[Code.FieldTypeMismatch], domain.Name,
                       new object[] { referencingField.Name },
                       "Domain '{0}' is used for field '{1}' with type {2}, but the domain field type is {3}",
                       domain.Name, referencingField.Name,
                       FieldUtils.GetFieldTypeDisplayText(referencingField.Type),
                       FieldUtils.GetFieldTypeDisplayText(domain.FieldType)));
        }
Exemplo n.º 22
0
        public bool Connect(IDomain domain)
        {
            bool IsConnected = false;

            foreach (IObjectProperty Property in Properties)
            {
                IsConnected |= Property.Connect(domain);
            }

            foreach (IObjectEvent Event in Events)
            {
                IsConnected |= Event.Connect(domain);
            }

            return(IsConnected);
        }
Exemplo n.º 23
0
        public static void Test31()
        {
            IDomain u  = Domain.IntRange(-5, 6); // {-5,-4,...,4,5}
            IDomain u2 = Domain.Combine(u, u);

            IFuzzySet set = new CalculatedFuzzySet(
                u2,
                StandardFuzzySets.LambdaFunction(
                    u2.IndexOfElement(DomainElement.Of(-4, 2)),
                    u2.IndexOfElement(DomainElement.Of(0, 0)),
                    u2.IndexOfElement(DomainElement.Of(4, 2))
                    )
                );

            Debug1.Print(set, "Set cf:");
        }
Exemplo n.º 24
0
        public void SuccessfullyExportsAClubAsJSONWhoseConfigContainsInvalidElementName()
        {
            ConfigurationManager.AppSettings[Keys.Config.ClubFileNameFormat] = "{COUNTRY}-{NAME}_{Y}_{IMGURL}_{NOT}";

            IExporter exporter = new JsonExporter();

            IDomain <IValue> club = MockClub(Nationality.PRT, "Benfica", 2020, "http://benfica.pt", "http://benfica.pt");

            IDomain <IValue> player01 = MockPlayer("Nemanja Matic", "Matic", new DateTime(1985, 1, 1), Nationality.SRB, 191, Foot.L, Position.CM, 6, 1, new DateTime(2012, 1, 1), new DateTime(2016, 7, 1), 600000000, "http://link", "http://link");
            IDomain <IValue> player02 = MockPlayer("Jonas", "Jonas", new DateTime(1981, 1, 1), Nationality.BRA, 182, Foot.R, Position.SS, 10, 0, new DateTime(2015, 7, 1), new DateTime(2020, 7, 1), 20000000, "http://link", "http://link");

            club.Children.Add(player01);
            club.Children.Add(player02);

            exporter.Extract(club);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Binds a domain to an environment
        /// </summary>
        public async Task BindAsync(IDomain domain, IEnvironment environment)
        {
            #region Preconditions

            if (domain == null)
            {
                throw new ArgumentNullException(nameof(domain));
            }

            #endregion

            await db.Domains.PatchAsync(domain.Id, new[] {
                Change.Replace("environmentId", environment.Id),
                Change.Replace("ownerId", environment.OwnerId)
            });
        }
Exemplo n.º 26
0
 private void ConnectAfter(IDomain domain, IComponentEvent afterEvent)
 {
     if (afterEvent != null)
     {
         IObject      Object      = null;
         IObjectEvent ObjectEvent = null;
         afterEvent.Connect(domain, ref Object, ref ObjectEvent);
         AfterObject      = Object;
         AfterObjectEvent = ObjectEvent;
     }
     else
     {
         AfterObject      = null;
         AfterObjectEvent = null;
     }
 }
Exemplo n.º 27
0
        private void ConnectGoTo(IDomain domain, IArea currentArea, IObject currentObject, ref bool IsConnected)
        {
            if (GoTo == null)
            {
                if (NavigateProperty.FixedValueSource != null)
                {
                    GoTo = new PageNavigation(Source, domain, BeforeEvent, NavigateProperty.FixedValueSource.Name, IsExternal, AfterEvent);
                }
                else
                {
                    GoTo = new PageNavigation(Source, domain, currentArea, currentObject, BeforeEvent, NavigateProperty, AfterEvent);
                }

                IsConnected = true;
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// Sanitize a Domain.
        /// </summary>
        /// <param name="domain">The Domain to sanitize.</param>
        /// <returns>The sanitized domain.</returns>
        /// <remarks>Copied from Umbraco core, since it's an internal method there.</remarks>
        /// <see>
        ///     <cref>https://github.com/umbraco/Umbraco-CMS/blob/22bd6cd989e2596b69339d9b344e14bcc759e82b/src/Umbraco.Web/Routing/DomainHelper.cs#L197</cref>
        /// </see>
        private static IDomain SanitizeForBackwardCompatibility(IDomain domain)
        {
            HttpContext context = HttpContext.Current;

            if (context == null || !domain.DomainName.StartsWith("/"))
            {
                return(domain);
            }

            // turn "/en" into "http://whatever.com/en" so it becomes a parseable uri
            string authority = context.Request.Url.GetLeftPart(UriPartial.Authority);

            domain.DomainName = authority + domain.DomainName;

            return(domain);
        }
Exemplo n.º 29
0
        //Todo: Need caching implementation
        public int GetHomeId()
        {
            string hostName = HttpContext.Current.Request.Url.DnsSafeHost;
            int    homeId   = 0;

            if (homeId == 0)
            {
                IDomainService  ds      = ApplicationContext.Current.Services.DomainService;
                IList <IDomain> domains = ds.GetAll(true) as IList <IDomain> ?? ds.GetAll(true).ToList();
                IDomain         domain  = domains.FirstOrDefault(d => d.DomainName.InvariantStartsWith(hostName));

                homeId = (int)domain.RootContentId;
            }

            return(homeId);
        }
Exemplo n.º 30
0
 public static IDomainCollection ToDomains(Array array)
 {
     if (array == null)
     {
         throw new ArgumentNullException("array");
     }
     if (array.Length == 0)
     {
         throw new ArgumentException("Length is zero", "array");
     }
     IDomain[] domains = new IDomain[array.Length];
     for (int i = 0; i < array.Length; ++i)
     {
         domains[i] = ToDomain(array.GetValue(i));
     }
     return(new DomainCollection(domains));
 }
Exemplo n.º 31
0
        /// <summary>
        /// Private constructor
        /// </summary>
        /// <param keyName="userName">Username for Connect Engine</param>
        /// <param keyName="password">Password for Connect Engine</param>
        /// <param keyName="uri">URI</param>
        /// <param keyName="osName">Object Store Name</param>
        private CEConnection(string userName, string password, string uri, string osName)
        {
            //logger.Debug("Initializing " + typeof(CEConnection));
            System.Net.ServicePointManager.ServerCertificateValidationCallback = (a, b, c, d) => true;

            UsernameCredentials creds = new UsernameCredentials(userName, password);

            // Associate this ClientContext with the whole process.
            ClientContext.SetProcessCredentials(creds);

            // Get the connection and default domain.
            this._connection = Factory.Connection.GetConnection(uri);
            this._domain = Factory.Domain.GetInstance(this._connection, null);

            // Get an object store.
            this._objectStore = Factory.ObjectStore.FetchInstance(this._domain, osName, null);
        }
Exemplo n.º 32
0
        public TypeTemplateDescriptor(Authentication authentication, ITypeTemplate template, DescriptorTypes descriptorTypes, object owner)
            : base(authentication, template, descriptorTypes)
        {
            this.template = template;
            this.owner    = owner ?? this;
            this.template.Dispatcher.VerifyAccess();
            this.domain = this.template.Domain;

            if (this.descriptorTypes.HasFlag(DescriptorTypes.IsSubscriptable) == true)
            {
                this.template.EditBegun            += Template_EditBegun;
                this.template.EditEnded            += Template_EditEnded;
                this.template.EditCanceled         += Template_EditCanceled;
                this.template.Changed              += Template_Changed;
                this.template.Type.TypeInfoChanged += Type_TypeInfoChanged;
            }
        }
Exemplo n.º 33
0
        private void method_1(int int_0, IDomain idomain_0)
        {
            switch (int_0)
            {
            case 0:
                idomain_0.SplitPolicy = esriSplitPolicyType.esriSPTDefaultValue;
                break;

            case 1:
                idomain_0.SplitPolicy = esriSplitPolicyType.esriSPTDuplicate;
                break;

            case 2:
                idomain_0.SplitPolicy = esriSplitPolicyType.esriSPTGeometryRatio;
                break;
            }
        }
Exemplo n.º 34
0
        public void SuccessfullyExportsAContinentAsJSON()
        {
            IExporter exporter = new JsonExporter();

            IDomain <IValue> continent = MockContinent(ContinentCode.EEE, "Europe");

            IDomain <IValue> competition01 = MockCompetition(Nationality.PRT, "Liga NOS", 2020, "http://NOS.pt", "http://NOS.pt");
            IDomain <IValue> competition02 = MockCompetition(Nationality.ESP, "Liga BBVA", 2020, "http://BBVA.pt", "http://BBVA.pt");

            IDomain <IValue> club01 = MockClub(Nationality.PRT, "Benfica", 2020, "http://Benfica.pt", "http://Benfica.pt");
            IDomain <IValue> club02 = MockClub(Nationality.PRT, "Porto", 2020, "http://Porto.pt", "http://Porto.pt");

            IDomain <IValue> club11 = MockClub(Nationality.ESP, "Real Madrid", 2020, "http://Madrid.pt", "http://Madrid.pt");
            IDomain <IValue> club12 = MockClub(Nationality.ESP, "Barcelona", 2020, "http://Barcelona.pt", "http://Barcelona.pt");


            IDomain <IValue> player011 = MockPlayer("Nemanja Matic", "Matic", new DateTime(1985, 1, 1), Nationality.SRB, 191, Foot.L, Position.CM, 6, 0, new DateTime(2012, 1, 1), new DateTime(2016, 7, 1), 600000000, "http://link", "http://link");
            IDomain <IValue> player012 = MockPlayer("Jonas", "Jonas", new DateTime(1981, 1, 1), Nationality.BRA, 182, Foot.R, Position.SS, 10, 0, new DateTime(2015, 7, 1), new DateTime(2020, 7, 1), 20000000, "http://link", "http://link");

            IDomain <IValue> player021 = MockPlayer("Deco", "Deco", new DateTime(1982, 1, 1), Nationality.BRA, 178, Foot.R, Position.AM, 10, 0, new DateTime(1999, 7, 1), new DateTime(2005, 7, 1), 6000000, "http://link", "http://link");

            IDomain <IValue> player111 = MockPlayer("Sergio Ramos", "Ramos", new DateTime(1984, 1, 1), Nationality.ESP, 188, Foot.R, Position.CB, 4, 0, new DateTime(2006, 7, 1), null, 70000000, "http://link", "http://link");

            IDomain <IValue> player121 = MockPlayer("Sergio Busquets", "Busquets", new DateTime(1986, 1, 1), Nationality.ESP, 184, Foot.R, Position.DM, 6, 0, new DateTime(2008, 7, 1), null, 70000000, "http://link", "http://link");
            IDomain <IValue> player122 = MockPlayer("Lio Messi", "Messi", new DateTime(1986, 1, 1), Nationality.ARG, 171, Foot.L, Position.AM, 10, 1, new DateTime(2003, 7, 1), new DateTime(2022, 7, 1), 200000000, "http://link", "http://link");

            continent.Children.Add(competition01);
            continent.Children.Add(competition02);

            competition01.Children.Add(club01);
            competition01.Children.Add(club02);
            competition02.Children.Add(club11);
            competition02.Children.Add(club12);

            club01.Children.Add(player011);
            club01.Children.Add(player012);

            club02.Children.Add(player021);

            club11.Children.Add(player111);

            club12.Children.Add(player121);
            club12.Children.Add(player122);

            exporter.Extract(continent);
        }
Exemplo n.º 35
0
            public DomainConstraint GetConstraint([NotNull] IAttributeRule attributeRule)
            {
                DomainConstraint result;

                if (!_domainConstraints.TryGetValue(attributeRule.DomainName,
                                                    out result))
                {
                    IDomain domain = _domains.DomainByName[attributeRule.DomainName];

                    result = GetDomainConstraint(domain,
                                                 _allowNullForCodedValueDomains,
                                                 _allowNullForRangeDomains);
                    _domainConstraints.Add(attributeRule.DomainName, result);
                }

                return(result);
            }
Exemplo n.º 36
0
        protected async override void OnInitialize()
        {
            base.OnInitialize();
            await this.template.Dispatcher.InvokeAsync(() =>
            {
                this.domain     = this.template.Domain;
                this.typeName   = this.template.TypeName;
                this.comment    = this.template.Comment;
                this.isFlag     = this.template.IsFlag;
                this.count      = this.template.Count;
                this.source     = this.domain.Source;
                this.isModified = this.template.IsModified;
            });

            this.Refresh();
            this.Verify(this.VerifyAction);
        }
Exemplo n.º 37
0
        //public TableContentDescriptor(Authentication authentication, ITableContent table)
        //    : this(authentication, table, DescriptorTypes.All)
        //{

        //}

        //public TableContentDescriptor(Authentication authentication, ITableContent content, DescriptorTypes descriptorTypes)
        //    : this(authentication, content, descriptorTypes, null)
        //{

        //}

        public TableContentDescriptor(Authentication authentication, ITableContent content, DescriptorTypes descriptorTypes, object owner)
            : base(authentication, content, descriptorTypes)
        {
            this.content = content;
            this.owner   = owner ?? this;
            this.content.Dispatcher.VerifyAccess();
            this.domain = this.content.Domain;

            if (this.descriptorTypes.HasFlag(DescriptorTypes.IsSubscriptable) == true)
            {
                this.content.EditBegun              += Content_EditBegun;
                this.content.EditEnded              += Content_EditEnded;
                this.content.EditCanceled           += Content_EditCanceled;
                this.content.Changed                += Content_Changed;
                this.content.Table.TableInfoChanged += Table_TableInfoChanged;
            }
        }
Exemplo n.º 38
0
        public static string GetUri(Uri current, IDomain domain)
        {
            if (string.IsNullOrWhiteSpace(domain?.DomainName))
            {
                return(current.GetLeftPart(UriPartial.Authority));
            }

            if (!Uri.TryCreate(domain.DomainName, UriKind.Absolute, out Uri uri))
            {
                if (!Uri.TryCreate(current.Scheme + "://" + domain.DomainName, UriKind.Absolute, out uri))
                {
                    return(null);
                }
            }

            return(uri.ToString());
        }
Exemplo n.º 39
0
        protected async override void PrepareContainer(DataGridContext dataGridContext, object item)
        {
            base.PrepareContainer(dataGridContext, item);
            var gridControl = dataGridContext.DataGridControl as DomainDataGridControl;

            if (this.domain == null)
            {
                var domain = gridControl.Domain;
                if (domain != null)
                {
                    await domain.Dispatcher.InvokeAsync(() =>
                    {
                        this.domain = domain;
                        this.domain.MemberLocationChanged += Domain_MemberLocationChanged;
                        this.domain.MemberEditBegun       += Domain_MemberEditBegun;
                        this.domain.MemberEditEnded       += Domain_MemberEditEnded;
                        this.domain.MemberRemoved         += Domain_MemberRemoved;
                        this.domain.Deleted += Domain_Deleted;
                        // if (this.domain.GetService(typeof(ICremaHost)) is ICremaHost cremaHost)
                        // {
                        //     this.UserID = cremaHost.UserID;
                        // }
                    });
                }
            }

            this.UserInfos.Clear();

            if (this.domain != null)
            {
                var domain = this.domain;
                var infos  = await domain.Dispatcher.InvokeAsync(() => domain.Members.Select(i => new DomainMemberMetaData()
                {
                    DomainMemberInfo = i.DomainMemberInfo,
                    DomainMemberState = i.DomainMemberState,
                }).ToArray());

                foreach (var i in infos)
                {
                    if (HashUtility.Equals(this.keys, i.DomainLocationInfo.Keys) == true && this.tableName == i.DomainLocationInfo.TableName)
                    {
                        this.UserInfos.Set(i.DomainMemberInfo, i.DomainMemberState, i.DomainLocationInfo);
                    }
                }
            }
        }
        /// <summary>
        /// Creates a TMS constraint type out of the current constraint type
        /// </summary>
        /// <param name="domain"></param>
        /// <param name="cdaStarTms">The CS3 instance where to create the constraint type</param>
        /// <param name="domainsMap">A map from the SR domains to the CS3 domains</param>
        /// <returns></returns>
        public static IConstraintType CreateIConstraintType(this GKOConstraintType ct, ICDAStar cdaStarTms, Dictionary <string, IDomain> domainsMap)
        {
            IDomain[]  signature = new IDomain[ct.Signature.Count];
            string[][] tuples    = new string[ct.Tuples.Count][];

            for (int i = 0; i < ct.Signature.Count; i++)
            {
                signature[i] = domainsMap[ct.Signature[i].Name];
            }

            for (int i = 0; i < ct.Tuples.Count; i++)
            {
                tuples[i] = ct.Tuples[i].ToArray();
            }

            return(cdaStarTms.DefConstraintType(ct.Name, signature, tuples));
        }
Exemplo n.º 41
0
        public static SortedDictionary <T, string> GetCodedValueMap <T>(
            [NotNull] IWorkspace workspace,
            [NotNull] string domainName)
        {
            Assert.ArgumentNotNull(workspace, nameof(workspace));
            Assert.ArgumentNotNullOrEmpty(domainName, nameof(domainName));

            IDomain domain = GetDomain(workspace, domainName);

            Assert.NotNull(domain, "Domain not found: {0}", domainName);

            var cvDomain = domain as ICodedValueDomain;

            Assert.NotNull(cvDomain, "Not a coded value domain: {0}", domainName);

            return(GetCodedValueMap <T>(cvDomain));
        }
Exemplo n.º 42
0
        public IFuzzySet Calculate(IFuzzySet first, IFuzzySet second)
        {
            if (!first.GetDomain().Equals(second.GetDomain()))
            {
                throw new ApplicationException("Domains are not the same.");
            }
            IList <double> memberships = new List <double>();
            IDomain        domain      = first.GetDomain();

            for (int i = 0; i < domain.GetCardinality(); i++)
            {
                double value1 = first.GetMembershipFor(domain.ElementAt(i));
                double value2 = second.GetMembershipFor(domain.ElementAt(i));
                memberships.Add(value1 + value2 - value1 * value2);
            }
            return(FuzzySetFactory.CreateFuzzySet(domain, memberships));
        }
Exemplo n.º 43
0
        public async Task <IActionResult> GetAccountDomain([FromRoute] Guid?id)
        {
            IActionResult result = null;

            try
            {
                if (result == null && !id.HasValue || id.Value.Equals(Guid.Empty))
                {
                    result = BadRequest("Missing domain id value");
                }
                if (result == null)
                {
                    using ILifetimeScope scope = _container.BeginLifetimeScope();
                    SettingsFactory settingsFactory = scope.Resolve <SettingsFactory>();
                    CoreSettings    settings        = settingsFactory.CreateAccount(_settings.Value);
                    IDomainFactory  domainFactory   = scope.Resolve <IDomainFactory>();
                    IDomain         innerDomain     = await domainFactory.Get(settings, id.Value);

                    if (innerDomain != null && !UserCanAccessAccount(innerDomain.AccountId))
                    {
                        innerDomain = null;
                    }
                    if (innerDomain == null)
                    {
                        result = NotFound();
                    }
                    else
                    {
                        IMapper         mapper         = MapperConfigurationFactory.CreateMapper();
                        AccountDomain   accountDomain  = mapper.Map <AccountDomain>(innerDomain);
                        IAccountFactory accountFactory = scope.Resolve <IAccountFactory>();
                        accountDomain.Account = mapper.Map <Account>(await accountFactory.Get(settings, innerDomain.AccountId));
                        result = Ok(accountDomain);
                    }
                }
            }
            catch (Exception ex)
            {
                using (ILifetimeScope scope = _container.BeginLifetimeScope())
                {
                    await LogException(ex, scope.Resolve <IExceptionService>(), scope.Resolve <SettingsFactory>(), _settings.Value);
                }
                result = StatusCode(StatusCodes.Status500InternalServerError);
            }
            return(result);
        }
Exemplo n.º 44
0
        public static decimal GetProductsPrice(this tbl_Basket table, bool?includeTax = null)
        {
            IDomain domainService    = (IDomain)DependencyResolver.Current.GetService <IDomain>();
            var     priceIncludesTax = domainService.GetSettingsValueAsBool(SettingsKey.priceDisplayIncludesVAT, table.B_DomainID);

            Tuple <decimal, decimal> priceAndTax = GetBasketPriceAndTax(table, true);

            if (includeTax.HasValue)
            {
                if (includeTax.Value)
                {
                    return(priceIncludesTax ? priceAndTax.Item1 : priceAndTax.Item1 + priceAndTax.Item2);
                }
                return(priceIncludesTax ? priceAndTax.Item1 - priceAndTax.Item2 : priceAndTax.Item2);
            }
            return(priceAndTax.Item1);
        }
Exemplo n.º 45
0
        public static object CodeFromValue(IDomain domain, object value)
        {
            object code = null;

            if (domain != null)
            {
                if (domain is ICodedValueDomain)
                {
                    ICodedValueDomain codedValueDomain = domain as ICodedValueDomain;
                    string convertedValue = ToText(value);

                    for (int i = 0; i < codedValueDomain.CodeCount; i++)
                    {
                        if (AreStringsEqual(convertedValue, codedValueDomain.get_Name(i)))
                            code = codedValueDomain.get_Value(i);
                    }
                }
            }

            return code;
        }
Exemplo n.º 46
0
 public AdmnController(IUser userService,
     IDomain domainService,
     IWebContent webContentService,
     IWebPages webPagesService,
     IECommerce ecommerceService,
     IPOI poiService,
     ITemplate templateService,
     IPortfolio portfolioService,
     IGallery galleryService)
     : base(domainService)
 {
     this.UserService = userService;
     this.DomainService = domainService;
     this.WebContentService = webContentService;
     this.WebPagesService = webPagesService;
     this.ECommerceService = ecommerceService;
     this.POIService = poiService;
     this.TemplateService = templateService;
     this.PortfolioService = portfolioService;
     this.GalleryService = galleryService;
 }
 public static IFuzzySet L(IDomain domain, params int[] points)
 {
     double[] memberships = new double[domain.GetCardinality()];
     for (int index = 0; index < domain.GetCardinality(); index++)
     {
         int value = (int)domain.ElementAt(index)[0];
         if (value <= points[0])
         {
             memberships[index] = 1;
         }
         else if (value >= points[1])
         {
             memberships[index] = 0;
         }
         else
         {
             memberships[index] = (double)(points[1] - value) / (points[1] - points[0]);
         }
     }
     return FuzzySetFactory.CreateFuzzySet(domain, memberships);
 }
        // Helper method

        private Broadcaster GetConfiguredHub(IDomain domain = null, string connId = null, string host = null)
        {
            domain = domain ?? new Domain(new Calculator());
            var hub = new Broadcaster(domain);
            connId = connId ?? "1234";
            host = host ?? "myhost";

            // Setup headers
            var mockRequest = new Mock<IRequest>();
            var mockHeaders = new Mock<INameValueCollection>();
            mockHeaders.Setup(h => h["host"]).Returns(host);
            mockRequest.Setup(r => r.Headers).Returns(mockHeaders.Object);

            // Setup user
            var identity = new GenericPrincipal(new GenericIdentity("jmaguilar"), new[] { "admin" });
            mockRequest.Setup(r => r.User).Returns(identity);

            // Setup context & connection id
            hub.Context = new HubCallerContext(mockRequest.Object, connId);

            return hub;

        }
Exemplo n.º 49
0
 public void AddRange(IEnumerable enumerable)
 {
     if (enumerable == null)
         throw new ArgumentNullException("enumerable");
     this.boundary = null;
     foreach (Object o in enumerable)
         this.List.Add(o);
 }
Exemplo n.º 50
0
 public void AddDomain(IDomain domain)
 {
     if (domain == null)
         throw new ArgumentNullException("domain");
     this.AddRange(domain);
 }
 public UsingLinearAttribute(int start, int stepCount,int step)
 {
     this.domain = new LinearInt32Domain(start, stepCount,step);
 }
Exemplo n.º 52
0
 public Broadcaster(IDomain domain)
 {
     _domain = domain;
 }
Exemplo n.º 53
0
 public static IDomainCollection ToDomains(Array array)
 {
     if (array == null)
         throw new ArgumentNullException("array");
     if (array.Length == 0)
         throw new ArgumentException("Length is zero", "array");
     IDomain[] domains = new IDomain[array.Length];
     for (int i = 0; i < array.Length; ++i)
         domains[i] = ToDomain(array.GetValue(i));
     return new DomainCollection(domains);
 }
Exemplo n.º 54
0
		public void DisplayDomainProperties(IDomain domain, TreeNode tableNode)
		{
			DataTable dt = new DataTable("MyData");

			dt.Columns.Add("Property", stringType);
			dt.Columns.Add("Value", stringType);
/*
			if(metaData.Columns.Contains("DOMAIN_CATALOG"))						f_DomainCatalog		= metaData.Columns["DOMAIN_CATALOG"];
			if(metaData.Columns.Contains("DOMAIN_SCHEMA"))						f_DomainSchema		= metaData.Columns["DOMAIN_SCHEMA"];
			if(metaData.Columns.Contains("DOMAIN_NAME"))						f_DomainName		= metaData.Columns["DOMAIN_NAME"];
			if(metaData.Columns.Contains("DATA_TYPE"))							f_DataType			= metaData.Columns["DATA_TYPE"];
			if(metaData.Columns.Contains("CHARACTER_MAXIMUM_LENGTH"))			f_MaxLength			= metaData.Columns["CHARACTER_MAXIMUM_LENGTH"];
			if(metaData.Columns.Contains("CHARACTER_OCTET_LENGTH"))				f_OctetLength		= metaData.Columns["CHARACTER_OCTET_LENGTH"];
			if(metaData.Columns.Contains("COLLATION_CATALOG"))					f_CollationCatalog	= metaData.Columns["COLLATION_CATALOG"];
			if(metaData.Columns.Contains("COLLATION_SCHEMA"))					f_CollationSchema	= metaData.Columns["COLLATION_SCHEMA"];
			if(metaData.Columns.Contains("COLLATION_NAME"))						f_CollationName		= metaData.Columns["COLLATION_NAME"];
			if(metaData.Columns.Contains("CHARACTER_SET_CATALOG"))				f_CharSetCatalog    = metaData.Columns["CHARACTER_SET_CATALOG"];
			if(metaData.Columns.Contains("CHARACTER_SET_SCHEMA"))				f_CharSetSchema     = metaData.Columns["CHARACTER_SET_SCHEMA"];
			if(metaData.Columns.Contains("CHARACTER_SET_NAME"))					f_CharSetName       = metaData.Columns["CHARACTER_SET_NAME"];
			if(metaData.Columns.Contains("NUMERIC_PRECISION"))					f_NumericPrecision	= metaData.Columns["NUMERIC_PRECISION"];
			if(metaData.Columns.Contains("NUMERIC_SCALE"))						f_NumericScale		= metaData.Columns["NUMERIC_SCALE"];
			if(metaData.Columns.Contains("DATETIME_PRECISION"))					f_DatetimePrecision = metaData.Columns["DATETIME_PRECISION"];
			if(metaData.Columns.Contains("DOMAIN_DEFAULT"))						f_Default			= metaData.Columns["COLUMN_DEFAULT"];
			if(metaData.Columns.Contains("IS_NULLABLE"))	
			*/

			dt.Rows.Add(new object[] {"Name", domain.Name});
			dt.Rows.Add(new object[] {"Alias", domain.Alias});

			dt.Rows.Add(new object[] {"DataTypeName", domain.DataTypeName});
			dt.Rows.Add(new object[] {"DataTypeNameComplete", domain.DataTypeNameComplete});
			dt.Rows.Add(new object[] {"NumericPrecision", domain.NumericPrecision.ToString()});
			dt.Rows.Add(new object[] {"NumericScale", domain.NumericScale.ToString()});
			dt.Rows.Add(new object[] {"DateTimePrecision", domain.DateTimePrecision.ToString()});
			dt.Rows.Add(new object[] {"CharacterMaxLength", domain.CharacterMaxLength.ToString()});
			dt.Rows.Add(new object[] {"CharacterOctetLength", domain.CharacterOctetLength.ToString()});
			dt.Rows.Add(new object[] {"LanguageType", domain.LanguageType});
			dt.Rows.Add(new object[] {"DbTargetType", domain.DbTargetType});
			dt.Rows.Add(new object[] {"IsNullable", domain.IsNullable ? "True" : "False"});
			dt.Rows.Add(new object[] {"HasDefault", domain.HasDefault ? "True" : "False"});
			dt.Rows.Add(new object[] {"Default", domain.Default});


			this.Grid.DataSource = dt;

			this.InitializeGrid();

			this.Text = "IDomain Properties";
			this.lnkHELP.Text = "IDomain Help ...";
			this.helpInterface = "IDomain";
		}
Exemplo n.º 55
0
 public DomainCollection(IDomain[] domains)
 {
     foreach (IDomain domain in domains)
         this.Add(domain);
 }
Exemplo n.º 56
0
 public void Add(IDomain domain)
 {
     if (domain == null)
         throw new ArgumentNullException("domain");
     this.List.Add(domain);
 }
Exemplo n.º 57
0
 public FuzzySet(IDomain domain, IEnumerable<double> memberships)
 {
     this.domain = domain;
     this.memberships = new List<double>(memberships);
 }
 public static IFuzzySet CreateFuzzySet(IDomain domain, IEnumerable<double> memberships)
 {
     return new FuzzySet(domain, memberships);
 }
Exemplo n.º 59
0
 public IFuzzySet Project(IDomain domain)
 {
     throw new NotImplementedException();
 }
 public static IFuzzySet CreateFuzzySet(IDomain domain, IDictionary<string[], double> memberships)
 {
     return new FuzzySet(domain, memberships);
 }