Ejemplo n.º 1
0
        public void RefreshPageData(DateTime dt)
        {
            try
            {
                using (var db = new ManageDataset())
                {
                    var t = db.TraderDailyDS.Where(_ => _.Date == dt).ToList();
                    var m = db.MarketDailyDS.Where(_ => _.TradeDate == dt.Date).ToList();

                    var listNotMatchedMarket = new List <MarketDetailDaily>();
                    var result = EntityCompareHelper.GetCompareData(m, t, listNotMatchedMarket);

                    this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => {
                        this.loading.HideLoading();
                        this.dgMarketMatched.ItemsSource    = result.Keys;
                        this.dgTradeMatched.ItemsSource     = result.Values;
                        this.dgNotMatchedMarket.ItemsSource = listNotMatchedMarket;

                        this.dgMarket.ItemsSource = m;
                        this.dgTrader.ItemsSource = t;
                    }));
                }
            }
            catch (Exception ex)
            {
                CommonUtils.ShowMsg(ex.Message);
            }
        }
#pragma warning disable RefCounter002
        public override int Diff(IGameEntity leftEntity, IGameEntity rightEntity, bool skipMissHandle)
#pragma warning restore RefCounter002
        {
            //YF TODO:

            bool needSkip = false;

            if (leftEntity.HasFlagImmutabilityComponent && rightEntity.HasFlagImmutabilityComponent)
            {
                var local  = leftEntity.FlagImmutabilityComponent;
                var remote = rightEntity.FlagImmutabilityComponent;
                if (local.LastModifyServerTime != remote.LastModifyServerTime)
                {
                    local.Reset();
                }
                else if (local.JudgeNeedSkipSyncLatest(serverTime))
                {
                    needSkip = true;
                }
            }

            if (needSkip)
            {
                return(0);
            }

            diffCacheData.LeftEntity  = leftEntity;
            diffCacheData.RightEntity = rightEntity;
            handler.DoDiffEntityStart(leftEntity, rightEntity);
            int count = EntityCompareHelper.CompareEnumeratableGameComponents(leftEntity.SyncLatestComponentDict,
                                                                              rightEntity.SyncLatestComponentDict, handler, diffCacheData);

            handler.DoDiffEntityFinish(leftEntity, rightEntity);
            return(count);
        }
#pragma warning disable RefCounter002
        public override int Diff(IGameEntity leftEntity, IGameEntity rightEntity, bool skipMissHandle)
#pragma warning restore RefCounter002
        {
            diffCacheData.LeftEntity  = leftEntity;
            diffCacheData.RightEntity = rightEntity;
            handler.DoDiffEntityStart(leftEntity, rightEntity);

            int count = EntityCompareHelper.CompareEnumeratableGameComponents(
                leftEntity.SortedComponentList,
                rightEntity.SortedComponentList,
                handler, diffCacheData);

            handler.DoDiffEntityFinish(leftEntity, rightEntity);
            return(count);
        }
Ejemplo n.º 4
0
        private void SetPageData(DateTime startDate, DateTime endDate)
        {
            try
            {
                List <CompareDaily>  lstCompareDaily  = null;
                List <CompareTrader> lstCompareTrader = null;

                using (var db = new ManageDataset())
                {
                    lstCompareDaily = db.CompareDailyDS.Where(_ => _.DATE >= startDate && _.DATE <= endDate).ToList();

                    lstCompareDaily  = lstCompareDaily.OrderBy(_ => _.DATE).ThenBy(_ => _.TRADER).ThenBy(_ => _.Symbol2).ThenBy(_ => _.Seq).ToList();
                    lstCompareTrader = EntityCompareHelper.GetCompareTrader(startDate, endDate.Date, lstCompareDaily);

                    CompareDailyList  = lstCompareDaily;
                    CompareTraderList = lstCompareTrader;
                }

                cbTrader.Items.Clear();
                List <string> lstTrader = lstCompareTrader.Select(_ => _.Trader).Distinct().ToList();
                lstTrader.ForEach(_ => this.cbTrader.Items.Add(new CheckBox()
                {
                    Content = _, IsChecked = true
                }));

                lstCompareDaily.ForEach(_ => { _.FormatData(); });
                lstCompareTrader.ForEach(_ => _.FormatData());

                this.dgDailyDetail.ItemsSource  = lstCompareDaily;
                this.dgTraderDetail.ItemsSource = lstCompareTrader;
                this.bdFilter.Visibility        = Visibility.Visible;
                this.loading.HideLoading();
            }
            catch (Exception ex)
            {
                this.loading.HideLoading();
                CommonUtils.Log("在显示界面时出错了!", ex);
                CommonUtils.ShowMsg("出错了,请查看日志");
            }
        }