Пример #1
0
        public override void Deserialize(ISerializableObject so)
        {
            dynamic dso = so;


            this.MatchId                = dso.MatchId.Value;
            this.BtrMatchId             = dso.BtrMatchId.Value;
            this.StartDate.Value        = dso.StartDate.Value;
            this.ExpiryDate.Value       = dso.ExpiryDate.Value;
            this.EndDate.Value          = dso.EndDate.Value;
            this.HomeCompetitorId.Value = dso.HomeCompetitorId.Value;
            this.AwayCompetitorId.Value = dso.AwayCompetitorId.Value;
            this.Code.Value             = dso.Code.Value;
            this.Active.Value           = dso.Active.Value;
            this.IsLiveBet.Value        = dso.IsLiveBet.Value;
            this.NameTag.Value          = dso.NameTag.Value;
            this.CardsTeam1.Value       = dso.CardsTeam1.Value;
            this.CardsTeam2.Value       = dso.CardsTeam2.Value;
            this.TeamWon.Value          = dso.TeamWon.Value;
            this.VhcChannelId           = dso.VhcChannelId.Value;

            eServerSourceType    sst = this.IsLiveBet.Value ? eServerSourceType.BtrLive : eServerSourceType.BtrPre;
            SerializableProperty sp  = so.GetSerializableProperty("SourceType");

            this.SourceType = sp.IsSpecified ? (eServerSourceType)sp.PropertyValue : sst;
            SerializableProperty outrightType = so.GetSerializableProperty("outright_type");

            this.outright_type = outrightType.IsSpecified ? (eOutrightType)outrightType.PropertyValue : eOutrightType.None;
            if (this.outright_type == eOutrightType.Outright)
            {
                Debug.Assert(HomeCompetitorId.Value == 0 && this.outright_type == eOutrightType.Outright);
            }
            if (this.outright_type == eOutrightType.None)
            {
                Debug.Assert(HomeCompetitorId.Value > 0 && this.outright_type == eOutrightType.None);
            }
            this.ExtendedState.Value = dso.ExtendedState.Value;

            EnsureExternalObjects();
        }
Пример #2
0
        public virtual void MergeFrom(ISerializableObject so)
        {
            foreach (var pi in this.ObservablePropertyList)
            {
                ObservablePropertyBase opb = pi;
                Debug.Assert(opb != null);

                SerializableProperty sp = so.GetSerializableProperty(opb.PropertyName.Trim());
                Debug.Assert(sp != null);

                opb.MergeFrom(sp);
            }

            this.SetRelations();
        }