Beispiel #1
0
        public override void OnScoreCallback(SyncScoreCallbckMessage msg)
        {
            var ml = new HistoryItemModel()
            {
                exam_attend_id = GlobalUser.AttendPaperItemId,
                item_id        = PaperInfoItem.items[0].item_id,
                token          = GlobalUser.USER.Token
            };
            var result1 = WebApiProxy.GetHtmlRespInfo(ml, ApiType.GetSyncHistory, null, "get");

            SyncScoreHistoryItem historyItem = new SyncScoreHistoryItem();

            try
            {
                if (result1?.retCode == 0)
                {
                    HistoryItem = JsonHelper.FromJson <SyncScoreHistoryItem>(result1.retData.ToString());
                }
            }
            catch (Exception e)
            {
                Log4NetHelper.Error($"抓取历史 单题答题记录 异常", e);
            }

            BindUserScoreBox(msg);
        }
        public PartialViewResult Exec(CalcModel model)
        {
            var result = double.NaN;

            if (Calc.getOperNames().Contains(model.OperName))
            {
                result = Calc.Exec(model.OperName, model.InputData);

                var operation = OperationRepository.LoadByName(model.OperName);

                if (operation != null)
                {
                    var history = new HistoryItemModel()
                    {
                        Operation = operation.Id,
                        Initiator = 1,
                        Result    = result,
                        Args      = string.Join(";", model.InputData),
                        CalcDate  = DateTime.Now,
                        Time      = 15
                    };

                    HistoryRepository.Save(history);
                }
            }

            return(PartialView("ExecResult", result));
        }
 public void SetItem(HistoryItemModel item)
 {
     if (item.CashInOut != null && string.IsNullOrEmpty(item.CashInOut.BlockChainHash))
     {
         SetCashInOut(item.CashInOut);
     }
     else if (item.Trade != null && string.IsNullOrEmpty(item.Trade.BlockChainHash))
     {
         SetTrade(item.Trade);
     }
     else if (item.Transfer != null && string.IsNullOrEmpty(item.Transfer.BlockChainHash))
     {
     }
     else if ((item.Transfer != null && !string.IsNullOrEmpty(item.Transfer.BlockChainHash)) || (item.Trade != null && !string.IsNullOrEmpty(item.Trade.BlockChainHash)) || (item.CashInOut != null && !string.IsNullOrEmpty(item.CashInOut.BlockChainHash)))
     {
         SetBlockchainInfo(item.Id);
     }
 }
Beispiel #4
0
        private void ShowSyncQsInfo()
        {
            Paper_InfoItem item = new Paper_InfoItem();

            if (_dgSyncQsListItems.Items == null || _dgSyncQsListItems.Items.Count <= 1)
            {
                item = SyncQsListItems[SelectedSyncQsShow < 1 ? 0 : _SelectedSyncQsShow].item;
            }
            else
            {
                item = (_dgSyncQsListItems.Items[SelectedSyncQsShow < 1 ? 0 : _SelectedSyncQsShow] as SelectableViewModel).item;
            }

            var ml = new HistoryItemModel()
            {
                exam_attend_id = GlobalUser.AttendPaperItemId,
                item_id        = item.items[0].item_id,
                token          = GlobalUser.USER.Token
            };
            var result1 = WebProxy(ml, ApiType.GetSyncHistory, null, "get");

            SyncScoreHistoryItem historyItem = new SyncScoreHistoryItem();

            try
            {
                if (result1?.retCode == 0)
                {
                    historyItem = JsonHelper.FromJson <SyncScoreHistoryItem>(result1.retData.ToString());
                }
            }
            catch (Exception e)
            {
                Log4NetHelper.Error($"抓取历史 单题答题记录 异常", e);
            }

            var lsType = GlobalUser.SelectPaperNumber.Split('#');

            if (lsType[2] == "4")
            {
                var view4 = new SyncWordView();
                view4.ScoreBoxView.Children.Clear();
                view4.DataContext = null;
                view4.DataContext =
                    new SyncWordViewModel(item, historyItem, view4,
                                          (SelectedSyncQsShow < 1 ? 1 : _SelectedSyncQsShow + 1),
                                          SyncQsListItems.Count);
                Messenger.Default.Send(new ExamQsNavigateMessage(SyncWordViewModel.ViewName, view4, null),
                                       "SyncQsMainWinView");
            }
            else if (lsType[2] == "5")
            {
                var view5 = new SyncPredView();

                view5.ScoreBoxView.Children.Clear();
                view5.DataContext = null;
                view5.DataContext =
                    new SyncPredViewModel(item, historyItem, view5,
                                          (SelectedSyncQsShow < 1 ? 1 : _SelectedSyncQsShow + 1),
                                          SyncQsListItems.Count);
                Messenger.Default.Send(new ExamQsNavigateMessage(SyncPredViewModel.ViewName, view5,
                                                                 null),
                                       "SyncQsMainWinView");
            }
        }