コード例 #1
0
        public void PrepairProjectForCreation(Project project)
        {
            ProjectHttpClient    projClient;
            TeamProjectReference onlineProject;
            Uri tfsUri = new Uri(project.ProjectAreaPath);
            VssBasicCredential credentials = new VssBasicCredential(project.UserName, project.Password);
            VssConnection      connection  = new VssConnection(tfsUri, credentials);

            _teamClient             = connection.GetClientAsync <TeamHttpClient>().Result;
            projClient              = connection.GetClientAsync <ProjectHttpClient>().Result;
            _workItemTrackingClient = connection.GetClient <WorkItemTrackingHttpClient>();
            IPagedList <TeamProjectReference> projects = projClient.GetProjects().Result;

            onlineProject = projects.FirstOrDefault(pro => pro.Name.ToUpperInvariant().Equals(project.ProjectName.ToUpperInvariant(), StringComparison.InvariantCulture));
            if (onlineProject != null)
            {
                project.CreationDate     = DateTime.Now;
                OnlineTfsTeamProjectName = project.ProjectName;
                OnlineTfsProjectId       = onlineProject.Id.ToString();
                project.ProjectType      = Projects.Enums.ProjectType.Online.ToString();
                project.Password         = project.AuthType == 1 ? encryption.DecryptString(project.Password, DecryptionKey) : project.Password;
                ConnectToOnLineTfsAndCreateQuries(project.ProjectName);
            }
            else
            {
                throw new UserFriendlyException($"Project Path: '{project.ProjectAreaPath}' Was Not Found!");
            }
        }
        /// <summary>
        /// Get a shipping by weight record by passed parameters
        /// </summary>
        /// <param name="shippingMethodId">Shipping method identifier</param>
        /// <param name="storeId">Store identifier</param>
        /// <param name="warehouseId">Warehouse identifier</param>
        /// <param name="countryId">Country identifier</param>
        /// <param name="stateProvinceId">State identifier</param>
        /// <param name="zip">Zip postal code</param>
        /// <param name="weight">Weight</param>
        /// <param name="orderSubtotal">Order subtotal</param>
        /// <returns>Shipping by weight record</returns>
        public virtual ShippingByWeightByTotalRecord FindRecords(int shippingMethodId, int storeId, int warehouseId,
                                                                 int countryId, int stateProvinceId, string zip, decimal weight, decimal orderSubtotal)
        {
            IPagedList <ShippingByWeightByTotalRecord> foundRecords = FindRecords(shippingMethodId, storeId, warehouseId, countryId, stateProvinceId, zip, weight, orderSubtotal, 0, int.MaxValue);

            return(foundRecords.FirstOrDefault());
        }
コード例 #3
0
        public void GetCommentsByPost_ByQuestionId()
        {
            using (var context = new AsynchronusTestContext(this))
            {
                IPagedList <Comment> received  = null;
                ApiException         exception = null;

                bool completed = false;
                EnqueueCallback(() =>
                {
                    Client.GetCommentsByPost(9033, results =>
                    {
                        received  = results;
                        completed = true;
                    },
                                             error =>
                    {
                        exception = error;
                        completed = true;
                    });
                });
                EnqueueConditional(() => completed);
                EnqueueCallback(() => Assert.IsNull(exception));
                EnqueueCallback(() => Assert.IsNotNull(received));
                EnqueueCallback(() => Assert.AreEqual(PostType.Question, received.FirstOrDefault().PostType));
            }
        }
コード例 #4
0
        public async Task<ActionResult> Index(string pesquisa, int? page)
        {
            int pageSize = 9;
            int pageIndex = 1;
            var lista = new List<DadosFilmes>();
            pageIndex = page.HasValue ? Convert.ToInt32(page) : 1;

            var filmes = new ListaFilmes();
            if (pesquisa == null || pesquisa == string.Empty)
            {
                lista = await Dados("index");
            }
            else
            {

                var urlPesquisa = "search/movie?api_key=7569f2f1ca73d5a27cd10beebcb6602e&&query=";

                var parametros = pesquisa.Split(' ');
                var query = String.Join("+", parametros);
                urlPesquisa = urlPesquisa + query;
                lista = await EfetuarPesquisa(urlPesquisa, "index");
            }
            IPagedList<DadosFilmes> Filmes = null;

            Filmes = lista.ToPagedList(pageIndex, pageSize);
            Filmes.FirstOrDefault().pesquisa = pesquisa;
            return View(Filmes);

        }
コード例 #5
0
ファイル: Messenger.cs プロジェクト: TomeQ2k/_Smile
        private async Task <IPagedList <Message> > MarkAsRead(string currentUserId, string recipientId, IPagedList <Message> userMessages)
        {
            if ((userMessages.FirstOrDefault())?.RecipientId != currentUserId)
            {
                return(userMessages);
            }

            userMessages.TakeWhile(m => !m.IsRead).ToList().ForEach(m => m.MarkAsRead());

            await database.Complete();

            return(userMessages);
        }
コード例 #6
0
        public async Task<ActionResult> Index(DadosFilmes model)
        {
            var urlPesquisa = "search/movie?api_key=7569f2f1ca73d5a27cd10beebcb6602e&&query=";
            int pageSize = 9;
            int pageIndex = 1;
            var parametros = model.pesquisa.Split(' ');
            var query = String.Join("+", parametros);
            urlPesquisa = urlPesquisa + query;
            var filmes = new ListaFilmes();
            var lista = await EfetuarPesquisa(urlPesquisa, "index");
            IPagedList<DadosFilmes> Filmes = null;
            Filmes = lista.ToPagedList(pageIndex, pageSize);
            model.pesquisaEfetuda = true;
            Filmes.FirstOrDefault().pesquisa = model.pesquisa;
            return View(Filmes);



        }