Ejemplo n.º 1
0
        public static IdentityList GetMatchIdentityListFromTipItems(ObservableCollection <TipItem> tipItems)
        {
            IdentityList ilMatches = new IdentityList();

            foreach (TipItem t in tipItems)
            {
                ilMatches.AddUnique(t.Match.MatchID);
            }

            return(ilMatches);
        }
        public override async Task <IEnumerable <Identity> > GetIdentities()
        {
            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.ManagementUri))
            {
                var edgeletHttpClient = new EdgeletHttpClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.ManagementUri)
                };
                IdentityList identityList = await this.Execute(() => edgeletHttpClient.ListIdentitiesAsync(this.Version.Name), $"List identities");

                return(identityList.Identities.Select(i => this.MapFromIdentity(i)));
            }
        }
Ejemplo n.º 3
0
        public async Task <IEnumerable <Identity> > GetIdentities()
        {
            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.managementUri))
            {
                var edgeletHttpClient = new EdgeletHttpClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.managementUri)
                };
                IdentityList identityList = await this.Execute(() => edgeletHttpClient.ListIdentitiesAsync(Constants.EdgeletManagementApiVersion), $"List identities");

                return(identityList.Identities);
            }
        }
Ejemplo n.º 4
0
        public string Model2InsertSql(T model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("INSERT INTO ");
            strSql.Append(InnerType.Name);
            strSql.Append("(");

            //strSql.Append("[MemberId],[IdCard],[FullName],[DatInsert] )");
            bool HasStart     = false;
            var  NameUsedList = from u in TypeCache.PropertyNames
                                where !IdentityList.Contains(u) && !UIMemberList.Contains(u)
                                select u;


            foreach (var name in NameUsedList)
            {
                if (TypeCache.IsListProperty(name))
                {
                    continue;
                }

                if (HasStart)
                {
                    strSql.Append(",");
                }
                else
                {
                    HasStart = true;
                }

                strSql.Append("[");
                strSql.Append(name);
                strSql.Append("]");
            }
            strSql.Append(") values (");
            HasStart = false;
            foreach (var name in NameUsedList)
            {
                if (TypeCache.IsListProperty(name))
                {
                    continue;
                }
                var    Property      = TypeCache.PropertyDic[name];
                object PropertyValue = GetProperty2Sql(model, name);
                if (HasStart)
                {
                    strSql.Append(",");
                }
                else
                {
                    HasStart = true;
                }

                if (null == PropertyValue)
                {
                    strSql.Append("null");
                }
                else
                {
                    strSql.Append(PropertyValue);
                }
            }

            strSql.Append(")");

            return(strSql.ToString());
        }
Ejemplo n.º 5
0
        public LineObjectList <TaggedStringLn> SearchRelatedStrings(string sSearch, string sLanguage, IdentityList ilGroups, IdentityList ilCompetitors)
        {
            ilGroups.Clear();
            ilCompetitors.Clear();

            LineObjectList <TaggedStringLn> lResult = new LineObjectList <TaggedStringLn>();

            SyncList <ObjectStringDictionary> lGroupStringDictionaries = m_diGroupStrings.ToSyncList();

            foreach (ObjectStringDictionary di in lGroupStringDictionaries)
            {
                TaggedStringLn strFound = di.Search(sSearch, sLanguage);

                if (strFound != null)
                {
                    Debug.Assert(strFound.RelationType == eObjectType.Group);
                    Debug.Assert(strFound.ObjectId.Value != null);

                    ilGroups.AddUnique(strFound.ObjectId.Value);
                }
            }

            SyncList <ObjectStringDictionary> lCompetitorStringDictionaries = m_diCompetitorStrings.ToSyncList();

            foreach (ObjectStringDictionary di in lCompetitorStringDictionaries)
            {
                TaggedStringLn strFound = di.Search(sSearch, sLanguage);

                if (strFound != null)
                {
                    Debug.Assert(strFound.RelationType == eObjectType.Competitor);
                    Debug.Assert(strFound.ObjectId.Value != null);

                    ilCompetitors.AddUnique(strFound.ObjectId.Value);
                }
            }

            return(lResult);
        }
Ejemplo n.º 6
0
        public void SearchMatches(SyncList <IMatchVw> lMatchesToSync, string sSearch, string sLanguage, DelegateFilterMatches dfm)
        {
            CheckTime ct = new CheckTime(false, "SearchMatches('{0}', '{1}') entered", sSearch, sLanguage);

            lock (m_oReadLocker)
            {
                if (lMatchesToSync != null)
                {
                    HashSet <IMatchVw> hsMatches   = new HashSet <IMatchVw>();
                    SyncList <MatchLn> lAllMatches = m_diAll.Matches.ToSyncList();

                    if (!string.IsNullOrEmpty(sSearch))
                    {
                        ct.AddEvent("Search by string in {0} matches", lAllMatches.Count);

                        IdentityList ilGroups      = new IdentityList();
                        IdentityList ilCompetitors = new IdentityList();

                        m_diAll.TaggedStrings.SearchRelatedStrings(sSearch, sLanguage, ilGroups, ilCompetitors);

                        int  iCode     = 0;
                        bool bIsNumber = int.TryParse(sSearch, out iCode) && 0 < iCode && iCode < MAX_MATCH_CODE;

                        if (ilCompetitors.Count > 0 || bIsNumber)
                        {
                            foreach (var mtch in lAllMatches)
                            {
#if DEBUG || TRACE_ID_FROM_FILE
                                if (TraceHelper.TraceFromFileLongValues("MatchIds.txt", (long)mtch.MatchId, new TraceHelper.DelegateLongFromRegistryFound(MatchIdFromFileFound), mtch))
                                {
                                    // Put breakpoint here to catch certain match by mtch.MatchId
                                }
#endif
                                string sCode = mtch.Code.Value.ToString("G");

                                if (sCode.IndexOf(sSearch, StringComparison.OrdinalIgnoreCase) >= 0 || ilCompetitors.Contains(mtch.HomeCompetitorId.Value) || ilCompetitors.Contains(mtch.AwayCompetitorId.Value))
                                {
                                    SearchMatchImp(hsMatches, lMatchesToSync, mtch, dfm);
                                }
                                //else
                                //{
                                //    SyncList<GroupLn> lGroups = LineSr.Instance.AllObjects.MatchesToGroups.GetMatchGroups(mtch.MatchId);

                                //    foreach (GroupLn group in lGroups)
                                //    {
                                //        if (ilGroups.Contains(group.GroupId))
                                //        {
                                //            SearchMatchImp(hsMatches, lMatchesToSync, mtch, dfm);
                                //        }
                                //    }
                                //}
                            }
                        }
                    }
                    else
                    {
                        ct.AddEvent("Search directly in {0} matches", lAllMatches.Count);

                        foreach (var mtch in lAllMatches)
                        {
#if DEBUG || TRACE_ID_FROM_FILE
                            if (TraceHelper.TraceFromFileLongValues("MatchIds.txt", (long)mtch.MatchId, new TraceHelper.DelegateLongFromRegistryFound(MatchIdFromFileFound), mtch))
                            {
                                // Put breakpoint here to catch certain match by mtch.MatchId
                            }
#endif
                            SearchMatchImp(hsMatches, lMatchesToSync, mtch, dfm);
                        }
                    }

                    ct.AddEvent("Search Completed");

                    for (int i = 0; i < lMatchesToSync.Count;)
                    {
                        IMatchVw matchView = lMatchesToSync[i];

                        if (!hsMatches.Contains(matchView))
                        {
                            lMatchesToSync.RemoveAt(i);
                        }
                        else
                        {
                            i++;
                        }
                    }

                    ct.AddEvent("Remove Completed");
                }
            }

            ct.AddEvent("Completed (Found {0} match(es))", lMatchesToSync.Count);
            ct.Info(m_logger);
        }