private async void PlayerOnPromotionAsync(object sender, PromotionEvent e)
        {
            var request = StartRequest();

            if (e.Combat.HasValue)
            {
                request.AddCommand(new SetCommanderRankPilot(RankType.Combat, (int)e.Combat.Value));
            }
            if (e.Cqc.HasValue)
            {
                request.AddCommand(new SetCommanderRankPilot(RankType.Cqc, (int)e.Cqc.Value));
            }
            if (e.Empire.HasValue)
            {
                request.AddCommand(new SetCommanderRankPilot(RankType.Empire, (int)e.Empire.Value));
            }
            if (e.Explore.HasValue)
            {
                request.AddCommand(new SetCommanderRankPilot(RankType.Explore, (int)e.Explore.Value));
            }
            if (e.Federation.HasValue)
            {
                request.AddCommand(new SetCommanderRankPilot(RankType.Federation, (int)e.Federation.Value));
            }
            if (e.Trade.HasValue)
            {
                request.AddCommand(new SetCommanderRankPilot(RankType.Trade, (int)e.Trade.Value));
            }

            await request.SendAsync()
            .ConfigureAwait(false);
        }
Esempio n. 2
0
 public async Task <ActionResult> Edit(PromotionEvent pe)
 {
     if (ModelState.IsValid)
     {
         var model = await m_promotionEventManager.UpdateAsync(pe);
     }
     return(RedirectToAction("Index", "PromotionEventAdmin"));
 }
 internal PromotionEvent InvokeEvent(PromotionEvent arg)
 {
     if (_api.ValidateEvent(arg))
     {
         Promotion?.Invoke(_api, arg);
     }
     return(arg);
 }
Esempio n. 4
0
 private void AssertEvent(PromotionEvent @event)
 {
     Assert.NotNull(@event);
     Assert.Equal(DateTime.Parse("2016-06-10T14:32:03Z"), @event.Timestamp);
     Assert.Equal(EventName, @event.Event);
     Assert.Equal(ExplorationRank.Scout, @event.Explore);
     Assert.Null(@event.Combat);
     Assert.Null(@event.Trade);
     Assert.Null(@event.Cqc);
     Assert.Null(@event.Empire);
     Assert.Null(@event.Federation);
 }
Esempio n. 5
0
        public async Task <ActionResult> Create(PromotionEvent pe)
        {
            if (ModelState.IsValid)
            {
                pe.Id = Guid.NewGuid().ToString();
                var result = await m_promotionEventManager.AddAsync(pe);

                if (result == ServiceResult.Success)
                {
                    ViewBag.SuccessfulMessage = "Thêm thành công";
                }
                else
                {
                    ViewBag.ErrorMessage = "Lỗi";
                }
            }
            return(View());
        }
Esempio n. 6
0
        public async Task <ActionResult> Delete(PromotionEvent pe)
        {
            var result = await m_promotionEventManager.DeleteAsync(pe.Id);

            return(RedirectToAction("Index", "PromotionEventAdmin"));
        }
Esempio n. 7
0
 internal void InvokePromotionEvent(PromotionEvent arg)
 {
     PromotionEvent?.Invoke(this, arg);
 }
Esempio n. 8
0
 internal void InvokePromotionEvent(PromotionEvent arg) => PromotionEvent?.Invoke(null, arg);