public ManagementCredential GetManagementCredential(DataServiceQuery<ManagementCredential> managementCredentials, long id)
        {
            Contract.Requires(null != managementCredentials);
            Contract.Requires(0 < id);
            Contract.Ensures(null != Contract.Result<ManagementCredential>());

            var result = managementCredentials
                .Where(e => e.Id == id)
                .FirstOrDefault();
            
            return result;
        }
        public ManagementUri GetManagementUri(DataServiceQuery<ManagementUri> managementUris, string name)
        {
            Contract.Requires(null != managementUris);
            Contract.Requires(!string.IsNullOrWhiteSpace(name));
            Contract.Ensures(null != Contract.Result<ManagementUri>());
            Contract.Ensures(Contract.Result<ManagementUri>().ManagementCredentialId.HasValue);

            var result = managementUris
                .Where(e => e.Name == name)
                .FirstOrDefault();
            
            return result;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 在此页将要在 Frame 中显示时进行调用。
        /// </summary>
        /// <param name="e">描述如何访问此页的事件数据。Parameter
        /// 属性通常用于配置页。</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            searchOptions = e.Parameter as List<string>;
            loadingProgressRing.IsActive = true;

            searchTitleKey = searchOptions[0].Trim();
            if (searchOptions.Count == 4)
            {
                searchAuthorKey = searchOptions[1].Trim();
                searchDescriptionKey = searchOptions[2].Trim();
                searchCategoryKey = searchOptions[3];
            }
            else
            {
                searchAuthorKey = searchDescriptionKey = searchCategoryKey = "";
            }

            courseDsq = (DataServiceQuery<COURSE_AVAIL>)(from course_avail in ctx.COURSE_AVAIL
                                                         select course_avail);
            if (!searchCategoryKey.Equals("Any Categories") && !searchCategoryKey.Equals(""))
            {
                courseDsq = (DataServiceQuery<COURSE_AVAIL>)courseDsq.Where(c => c.CATE_NAME.Equals(searchCategoryKey));
            }
            if (!searchTitleKey.Equals(""))
            {
                courseDsq = (DataServiceQuery<COURSE_AVAIL>)courseDsq.Where(c => c.TITLE.Contains(searchTitleKey));
            }
            if (!searchAuthorKey.Equals(""))
            {
                courseDsq = (DataServiceQuery<COURSE_AVAIL>)courseDsq.Where(c => c.TEACHER_NAME.Contains(searchAuthorKey));
            }
            if (!searchDescriptionKey.Equals(""))
            {
                courseDsq = (DataServiceQuery<COURSE_AVAIL>)courseDsq.Where(c => c.INTRO.Contains(searchDescriptionKey));
            }

            courseDsq.BeginExecute(OnSearchResultComplete, null);

            UserProfileBt.DataContext = Constants.User;
        }