public Task Execute(IJobExecutionContext context)
 {
     try
     {
         _logger.LogInformation($"IncreaseBalance Job started at {DateTime.UtcNow}");
         var info = _dbContext.Infos.FirstOrDefaultAsync().Result;
         var rate = _coinDeskClient.GetUSDdPrice();
         if (info == null)
         {
             info = new InfoEntity();
         }
         info.BitcoinAmount = +(500 / rate.Result);
         if (info.Id == 0)
         {
             _dbContext.Infos.Add(info);
         }
         else
         {
             _dbContext.Infos.Update(info);
         }
         _dbContext.SaveChanges();
         _logger.LogInformation($"IncreaseBalance Job ended at {DateTime.UtcNow}");
         return(Task.CompletedTask);
     }
     catch (Exception e)
     {
         _logger.LogError("IncreaseBalance Job failed", e);
         throw;
     }
 }
 public void SaveInfoEntity(InfoEntity infoEntity)
 {
     context.InfoEntities.RemoveRange(context.InfoEntities);
     context.SaveChanges();
     context.InfoEntities.Add(infoEntity);
     context.SaveChanges();
 }
Example #3
0
        private void Render(ResultData result)
        {
            var playerIndex = result.CorrectPlayerIndex;
            var player      = PlayerEntity.PlayerList[playerIndex];

            StageResultRenderer.Render(player.NickName, playerIndex, result.IsCorrect);

            // リストに追加する
            foreach (var stageResultListRenderer in StageResultListRendererList)
            {
                stageResultListRenderer.Render(result.Time, result.StageCount);
            }

            // 答えを表示する
            AnswerRenderer.Render(StageEntity.Answer, false);

            // Timelineを再生する
            StageResultTimelineRenderer.Play(result.IsCorrect);

            if (result.IsCorrect)
            {
                EffectCrackerRenderer.Play();
                InfoEntity.Set(Setting.CorrectInfoList.Random());
            }
            else
            {
                InfoEntity.Set(Setting.TimeoutInfoList.Random());
            }
        }
        // 接口5 获取公司信息
        public string GetCompanyInfo([FromBody] Models.GetCompanyInfo value)
        {
            ComInfo    ci = new ComInfo();
            InfoEntity ie = new InfoEntity();
            DataTable  dt = cii.GetList();

            try
            {
                //string Where = "FirmInfoID=1";
                //string sql = string.Format("select * from FirmInfo where FirmInfoID=1");
                ////DataTable dt = DALHelp.ExecuteDataTable(sql, null);
                //DataTable dt = ServerOrLit.isDataTable(LoginController.connType, sql);
                if (dt.Rows.Count > 0)
                {
                    ci.StateCode   = (int)Common.EnumParam.Code.Sucess;
                    ci.Reason      = "";
                    ci.Info        = ie;
                    ie.LogoUrl     = "http://" + dt.Rows[0]["LogoUrl"].ToString();
                    ie.CompanyName = dt.Rows[0]["CompanyName"].ToString();
                }
                else
                {
                    ci.StateCode = (int)Common.EnumParam.Code.Fail;
                    ci.Reason    = "获取数据失败";
                    ci.Info      = null;
                }
            }
            catch (Exception ex)
            {
                ci.StateCode = 104;
                ci.Reason    = ex.Message;
                ci.Info      = null;
            }
            return(JsonConvert.SerializeObject(ci));
        }
Example #5
0
        public IHttpActionResult AddWithPlace([FromBody] InfoPlacePostDTO info)
        {
            int id = 0;

            if (ModelState.IsValid)
            {
                try
                {
                    PlaceEntity placeDomain = _DTOAssempler.CreatePlaceEntity(info);
                    InfoEntity  infoDomain  = _DTOAssempler.CreateInfoEntity(info);

                    IInfoServices infoService = ServiceFactory.getInfoServices();
                    id = infoService.NewInfo(infoDomain, placeDomain);
                }
                catch (Exception e)
                {
                    return(BadRequest(e.Message));
                }
            }
            else
            {
                return(BadRequest("Neispravni podaci"));
            }

            return(Ok(id));
        }
Example #6
0
        public ActionResult EditSiteInfo(InfoEntity infoEntity, HttpPostedFileBase logoImg = null, HttpPostedFileBase homeImg = null)
        {
            if (ModelState.IsValid)
            {
                if (logoImg != null)
                {
                    infoEntity.ImageMimeType = logoImg.ContentType;
                    infoEntity.ImageData     = new byte[logoImg.ContentLength];
                    logoImg.InputStream.Read(infoEntity.ImageData, 0, logoImg.ContentLength);
                }
                siteInfoRepo.SaveInfoEntity(infoEntity);

                if (homeImg != null)
                {
                    infoEntity.ImageMimeType2 = homeImg.ContentType;
                    infoEntity.ImageData2     = new byte[homeImg.ContentLength];
                    homeImg.InputStream.Read(infoEntity.ImageData2, 0, homeImg.ContentLength);
                }

                siteInfoRepo.SaveInfoEntity(infoEntity);

                TempData["category"] = string.Format("Общая информация о сайте обновлена");
                return(RedirectToAction("Index"));
            }
            else
            {// there is something wrong with the data values
                return(View(infoEntity));
            }
        }
Example #7
0
        public InfoEntity ToDomainModel(Info info)
        {
            List <CommentEntity> comments = new List <CommentEntity>();

            foreach (var comment in info.Comment)
            {
                comments.Add(this.ToDomainModel(comment));
            }

            List <ReputationInfoEntity> reputations = new List <ReputationInfoEntity>();

            foreach (var rep in info.ReputationInfo)
            {
                reputations.Add(this.ToDomainModel(rep));
            }

            InfoEntity infoDomain = new InfoEntity()
            {
                Id         = info.Id,
                time       = info.Time,
                endTime    = (DateTime)info.EndTime,
                content    = info.Content,
                categoryId = info.CategoryId,
                userId     = info.UserId,
                placeId    = info.PlaceId,
                category   = this.ToDomainModel(info.Category),
                user       = this.ToDomainModel(info.User),
                place      = this.ToDomainModel(info.Place),
                comments   = comments,
                reputation = reputations
            };

            return(infoDomain);
        }
Example #8
0
        public static InfoEntity GetMyInfo(string url)
        {
            InfoEntity c = new InfoEntity();

            c.LastMsgid = LastMsgid;
            try
            {
                c.HVID   = Program.HVID;
                c.ProVer = Program.ProductVer;
                RequestEntity r = new RequestEntity();
                r.OptCommand = OptCom.GetMyInfo.ToString();
                r.Content    = ToJson(c);
                r.Content    = Security.EncryptCommon(r.Content);
                IAASResponse reponse = IAASRequest.Reauest(url, RequestMethod.POST, "", "", ToJson(r));
                if (reponse.StatusCode == HttpStatusCode.OK)
                {
                    c         = JsonToObj <InfoEntity>(reponse.Content);
                    LastMsgid = c.LastMsgid;
                }
                else
                {
                    c.InfoStr = string.Empty;
                }
            }
            catch
            {
                c.InfoStr = string.Empty;
            }
            return(c);
        }
Example #9
0
        //Unos novog infa s i bez mjesta
        public int NewInfo(InfoEntity info)
        {
            int new_id = _unitOfWork.InfoRepository.Insert(info, _unitOfWork.Save);

            //_unitOfWork.Save();
            return(new_id);
        }
Example #10
0
        public void BasicInfoTest()
        {
            var ie = new InfoEntity();

            ie.Id = 8;
            var time = DateTime.Now;

            ie.time    = time;
            ie.endTime = time.AddHours(100);
            ie.content = "Info content";

            Assert.AreEqual(ie.Id, 8, "Wrong Id");
            Assert.AreEqual(ie.time, time, "Wrong time");
            Assert.AreEqual(ie.endTime, time.AddHours(100), "Wrong endTime");
            Assert.AreEqual(ie.content, "Info content", "Wrong content");

            var reputation = new List <ReputationInfoEntity>();
            var rep        = new ReputationInfoEntity();

            rep.ContentCommentId = 7;
            rep.Id     = 4;
            rep.Score  = true;
            rep.UserId = 6;
            reputation.Add(rep);
            reputation.Add(rep);
            ie.reputation = reputation;
            Assert.AreEqual(ie.GetReputation(), 2, 0, "Wrong reputation calculation");

            rep       = new ReputationInfoEntity();
            rep.Score = false;
            reputation.Add(rep);
            ie.reputation = reputation;
            Assert.AreEqual(ie.GetReputation(), 1, 0, "Wrong reputation subtraction");
        }
Example #11
0
        public int NewInfo(InfoEntity info, PlaceEntity place)
        {
            info.placeId = _unitOfWork.PlaceRepository.Insert(place, _unitOfWork.Save);
            int new_id = _unitOfWork.InfoRepository.Insert(info, _unitOfWork.Save);

            //_unitOfWork.Save();
            return(new_id);
        }
Example #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id;

            if (int.TryParse(this.Request.QueryString["nodeid"], out id))
            {
                NodeManager      nodeManager = new NodeManager("EFConnectionString");
                NodeEntity       node        = nodeManager.Get(id);
                StringDictionary roles       = (this.Master as AdminLayout).UserRoles;

                if (!nodeManager.CheckNodeRole(node, roles, ActionType.ManageNode))
                {
                    this.Response.Write("<script>alert('无权限!');</script>");
                    this.Response.Write("<script>window.location = 'info_manager.aspx';</script>");
                    return;
                }

                int infoCount;

                if (node.ApplicationId == 3)
                {
                    InfoManager infoManager = new InfoManager("EFConnectionString");
                    this.infosView.DataSource = infoManager.GetByNodeId(id, true, int.Parse(this.pageIndex.Value), int.Parse(this.pageSize.Value), out infoCount);
                }
                else
                {
                    infoCount = 0;
                }

                this.infoCount.Value = infoCount.ToString();
                this.infosView.DataBind();
            }
            else if (int.TryParse(this.Request.QueryString["infoid"], out id))
            {
                InfoManager infoManager = new InfoManager("EFConnectionString");
                InfoEntity  info        = infoManager.Get(id);
                int         nodeId      = info.NodeId;

                NodeManager nodeManager = new NodeManager("EFConnectionString");
                NodeEntity  node        = nodeManager.Get(nodeId);

                if (string.IsNullOrWhiteSpace(ConfigurationManager.AppSettings[string.Format(updatePageString, node.ApplicationId.ToString())]))
                {
                    this.Response.Write("<script>alert('配置出错!请联系程序猿!');</script>");
                    this.Response.Write("<script>window.location = 'info_manager.aspx';</script>");
                }
                else
                {
                    this.Response.Redirect(ConfigurationManager.AppSettings[string.Format(updatePageString, node.ApplicationId.ToString())] + "?infoid=" + id);
                }
            }
            else
            {
                this.Response.Write("<script>alert('参数错误!');</script>");
                this.Response.Write("<script>window.location = 'info_manager.aspx';</script>");
            }
        }
Example #13
0
        private void btnInfoDetails_Click(object sender, EventArgs e)
        {
            int              infoIndex = dgvInfoTable.CurrentCell.RowIndex;
            InfoEntity       info      = AllInfos.ElementAt(infoIndex);
            CRUD_Information crudInfo  = new CRUD_Information(info, login.Id);

            crudInfo.makeReadOnly();
            crudInfo.Show();
        }
Example #14
0
        private void updownsync(string s)
        {
            double     temp = Convert.ToDouble(hold.Text) * Convert.ToDouble(s) * Convert.ToDouble(price.Text) / 100;
            InfoEntity IE   = new InfoEntity();

            IE.daywin += temp - daywinMark;
            daywinMark = temp;
            IE.upwin   = Convert.ToDouble(hold.Text) * (Convert.ToDouble(s) - upwinMark) * Convert.ToDouble(price.Text) / 100;
            upwinMark  = Convert.ToDouble(s);
            changeValues(IE);
        }
Example #15
0
        private void Render()
        {
            AudioPlayer.Play(AudioType.Main4);

            var totalTime  = ResultEntity.CalcTotalTime();
            var resultRank = ResultRankList.GetResultRankByTime(totalTime);

            ResultTotalTimeRenderer.Set(totalTime);
            ResultRankRenderer.Render(resultRank.Rank, resultRank.Comment);
            InfoEntity.Set("お疲れ様でした! また一緒に遊んでくださいね");
        }
Example #16
0
        public PestForm(UserEntity user)
        {
            InitializeComponent();
            this.user          = user;
            this.info          = null;
            this.place         = null;
            lblPestDialog.Text = "Are you sure you want to delete user " + user.Username + "?\n This cannot be undone.";

            btnPestYes.DialogResult = DialogResult.Yes;
            btnPestNo.DialogResult  = DialogResult.No;
        }
Example #17
0
 private void SetInfo()
 {
     if (PlayerEntity.IsOwner(PhotonNetwork.LocalPlayer))
     {
         InfoEntity.Set($"あなたは「出題者」です 限られた文字で「{StageEntity.Answer}」を表現しましょう");
     }
     else
     {
         InfoEntity.Set($"あなたは「回答者」です 出題者に質問をして「答え」を導きましょう");
     }
 }
Example #18
0
        private void btnInfoAdd_Click(object sender, EventArgs e)
        {
            InfoEntity       info     = new InfoEntity();
            CRUD_Information crudInfo = new CRUD_Information(info, login.Id);

            crudInfo.ShowDialog();
            if (crudInfo.DialogResult == DialogResult.OK)
            {
                AllInfos.Add(info);
                dgvInfoTable.Invalidate();
            }
        }
Example #19
0
        public void Initialize()
        {
            // 入力
            KeyboardKeyHandlerList.Select(x => x.OnDownAsObservable())
            .Merge()
            .Subscribe(Set)
            .AddTo(Disposable);

            // 送信
            KeyboardSendButtonHandler.OnDownAsObservable()
            .Where(_ => !KeyboardEntity.IsEmpty())
            .Subscribe(_ =>
            {
                switch (MainStateEntity.State)
                {
                case MainState.Wait:
                    Comment();
                    break;

                case MainState.StagePlay:
                    SendChat();
                    break;
                }
            })
            .AddTo(Disposable);

            //  削除
            KeyboardDeleteButtonHandler.OnDownAsObservable()
            .Subscribe(_ => Delete())
            .AddTo(Disposable);

            // Owenrの場合、徐々に文字が増えていく
            TimerEntity.OnUpdateTimerAsObservable()
            .Where(_ => PlayerEntity.IsOwner(PhotonNetwork.LocalPlayer))
            .Where(_ => MainStateEntity.Check(MainState.StagePlay))
            .Subscribe(time =>
            {
                var unlockKey = UnlockKeyList.List.ElementAtOrDefault(KeyboardEntity.UnlockKeyIndex);
                if (unlockKey != null && time >= unlockKey.ThresholdTime)
                {
                    foreach (var i in KeyboardEntity.EnableOwner(unlockKey.Count))
                    {
                        KeyboardKeyRendererList[i].Enable();
                    }

                    KeyboardEntity.IncreaseUnlockKeyIndex();
                    KeyboardListRenderer.PlayEnableSound();
                    InfoEntity.Set($"新しく {unlockKey.Count}文字 追加されました");
                }
            })
            .AddTo(Disposable);
        }
Example #20
0
    public static bool AABBCollision(InfoEntity Origin, InfoEntity Target)
    {
        Vector3 OriginPosition = Origin.Position;
        Vector3 TargetPosition = Target.Position;

        Vector2 Origin2D = new Vector2(OriginPosition.x, OriginPosition.z);
        Vector2 Target2D = new Vector2(TargetPosition.x, TargetPosition.z);

        Rect origin = new Rect(Origin2D, Origin.BodyBlock);
        Rect target = new Rect(Target2D, Target.BodyBlock);

        return(_AABB(origin, target));
    }
Example #21
0
        public InfoEntity CreateInfoEntity(InfoPlacePostDTO info)
        {
            InfoEntity infoDomain = new InfoEntity()
            {
                time       = info.startTime,
                endTime    = info.endTime,
                content    = info.content,
                categoryId = info.categoryId,
                userId     = info.userId
            };

            return(infoDomain);
        }
Example #22
0
        public FileContentResult GetImage2(int infoId, string imgElementName)
        {
            InfoEntity infoEntity = siteInfoRepo.InfoEntities.FirstOrDefault(p => p.InfoID == infoId);

            if (infoEntity != null)
            {
                if (infoEntity.ImageData2 != null && infoEntity.ImageMimeType2 != null)
                {
                    return(File(infoEntity.ImageData2, infoEntity.ImageMimeType2));
                }
            }
            return(null);
        }
 private async void ReplyToBridge(InfoEntity p_response, BridgeSpmResponse p_bridgeResponse)
 {
     p_bridgeResponse.responseCode = p_response.responseCode;
     p_bridgeResponse.info         = p_response;
     await Task.Run(() =>
     {
         Thread.Sleep(7000);
         var client = new HttpClient
         {
             BaseAddress = new Uri(m_cfg["Configuration:CelloParkBridgeUrl"])
         };
         var response = client.PostAsJsonAsync("", p_bridgeResponse);
     });
 }
Example #24
0
        public Info ToDALModel(InfoEntity info)
        {
            Info infoDAL = new Info()
            {
                Time       = info.time,
                CategoryId = info.categoryId,
                UserId     = info.userId,
                PlaceId    = info.placeId,
                Content    = info.content,
                EndTime    = info.endTime
            };

            return(infoDAL);
        }
Example #25
0
        private void btnInfoDelete_Click(object sender, EventArgs e)
        {
            int        infoIndex  = dgvInfoTable.CurrentCell.RowIndex;
            InfoEntity info       = AllInfos.ElementAt(infoIndex);
            PestForm   areYouSure = new PestForm(info);

            areYouSure.ShowDialog();

            if (areYouSure.DialogResult == DialogResult.Yes)
            {
                dgvInfoTable.Rows.RemoveAt(infoIndex);
                dgvInfoTable.Invalidate();
            }
        }
Example #26
0
        private void btnInfoEdit_Click(object sender, EventArgs e)
        {
            int        infoIndex = dgvInfoTable.CurrentCell.RowIndex;
            InfoEntity info      = AllInfos.ElementAt(infoIndex);

            CRUD_Information crudInfo = new CRUD_Information(info, login.Id);

            crudInfo.editing = true;
            crudInfo.ShowDialog();

            if (crudInfo.DialogResult == DialogResult.OK)
            {
                dgvInfoTable.InvalidateRow(infoIndex);
            }
        }
Example #27
0
        public ActionResult AddInfo(AddInfoVM vm)
        {
            var ie = new InfoEntity
            {
                categoryId = vm.SelectedCategoryId,
                content    = vm.Content,
                time       = vm.StartTime,
                endTime    = vm.EndTime,
                userId     = (Session["user"] as UserEntity).Id,
                placeId    = vm.PlaceId,
            };
            var infoService = ServiceFactory.getInfoServices();
            var id          = infoService.NewInfo(ie);

            return(RedirectToAction(nameof(InfoDetails), new { id = id, placeId = vm.PlaceId }));
        }
Example #28
0
        private List <InfoVM.Comment> getInfoComments(InfoEntity e)
        {
            var rv = new List <InfoVM.Comment>();

            foreach (var c in e.comments)
            {
                rv.Add(new InfoVM.Comment
                {
                    Id         = c.Id,
                    Username   = c.user.FullName,
                    Content    = c.Content,
                    Reputation = c.GetReputation(),
                });
            }

            return(rv);
        }
Example #29
0
        private void pricesync(TextBox tb, string s)
        {
            tb.Text = s;
            double m = Convert.ToDouble(hold.Text) * Convert.ToDouble(s);

            money.Text = m.ToString();
            double ud = m - basemoney;

            updown.Text = Adapter.DataAdapter.RealTwo(ud);

            InfoEntity IE = new InfoEntity();

            IE.win   = m - totalMark;
            IE.price = m - priceMark;
            changeValues(IE);
            totalMark = m;
            priceMark = m;
        }
Example #30
0
        public PestForm(InfoEntity info)
        {
            InitializeComponent();
            this.info = info;
            const int MAXLEN = 20;

            if (info.content.Length <= MAXLEN)
            {
                lblPestDialog.Text = "Are you sure you want to delete info \"" + info.content.Substring(0, info.content.Length) + "\"?\n This cannot be undone.";
            }
            else
            {
                lblPestDialog.Text = "Are you sure you want to delete info \"" + info.content.Substring(0, MAXLEN) + "...\"?\n This cannot be undone.";
            }

            btnPestYes.DialogResult = DialogResult.Yes;
            btnPestNo.DialogResult  = DialogResult.No;
        }