Exemplo n.º 1
0
        /*
         * public string KeyName
         * {
         *  get { return GetKeyName(this.Discriminator, this.BetDomainNumber, this.IsLiveBet); }
         * }
         *
         * public static string GetKeyName(string sDiscriminator, string sBetDomainNumber, bool bIsLiveBet)
         * {
         *  return string.Format("{0}{1}{2}{3}{4}", sDiscriminator, KEY_SEPARATOR, sBetDomainNumber, KEY_SEPARATOR, bIsLiveBet ? "1" : "0");
         * }
         */

        public static BetDomainMapItem FromXmlElement(XmlElement el)
        {
            try
            {
                BetDomainMapItem bdmi = new BetDomainMapItem();

                string sIsLiveBet = el.GetAttribute("isLiveBet");

                string sBetDomainNumber = el.GetAttribute("betDomainNumber");
                string sSort            = el.GetAttribute("sort");
                string sPart            = el.GetAttribute("part");
                string sSubPart         = el.GetAttribute("subPart");
                string sArgsPart        = el.GetAttribute("argsCount");

                bdmi.Discriminator = el.GetAttribute("discriminator");
                bdmi.IsLiveBet     = sIsLiveBet == "1";
                bdmi.BetTag        = el.GetAttribute("betTag");
                bdmi.BetType       = el.GetAttribute("betType");
                bdmi.ScoreType     = el.GetAttribute("scoreType");
                bdmi.TimeType      = el.GetAttribute("timeType");
                bdmi.Generic       = el.GetAttribute("generic");

                //ExcpHelper.ThrowIf(string.IsNullOrEmpty(bdmi.Discriminator), "discriminator node is not set.");
                ExcpHelper.ThrowIf(string.IsNullOrEmpty(sBetDomainNumber), "betDomainNumber node is not set.");
                ExcpHelper.ThrowIf(string.IsNullOrEmpty(sIsLiveBet), "isLiveBet node is not set.");
                ExcpHelper.ThrowIf(string.IsNullOrEmpty(bdmi.BetTag), "betTag node is not set.");
                ExcpHelper.ThrowIf(string.IsNullOrEmpty(bdmi.BetType), "betType node is not set.");
                ExcpHelper.ThrowIf(string.IsNullOrEmpty(bdmi.ScoreType), "scoreType node is not set.");
                ExcpHelper.ThrowIf(string.IsNullOrEmpty(bdmi.TimeType), "timeType node is not set.");
                ExcpHelper.ThrowIf(string.IsNullOrEmpty(sSort), "sort node is not set.");
                ExcpHelper.ThrowIf(string.IsNullOrEmpty(sPart), "part node is not set.");

                bdmi.BetDomainNumber = Convert.ToInt32(sBetDomainNumber);
                bdmi.Sort            = Convert.ToInt32(sSort);
                bdmi.Part            = Convert.ToInt32(sPart);

                try
                {
                    bdmi.SubPart = string.IsNullOrEmpty(sSubPart) ? 0 : Convert.ToInt32(sSubPart);
                }
                catch (Exception)
                {
                    bdmi.SubPart = 0;
                }

                bdmi.ArgsCount = string.IsNullOrEmpty(sArgsPart) ? 0 : Convert.ToInt32(sArgsPart);

                return(bdmi);
            }
            catch (Exception excp)
            {
                m_logger.Excp(excp, "BetDomainMapItem() ERROR.");
                throw;
            }
        }
Exemplo n.º 2
0
        private static void GenerateBetDomainType(XmlElement el)
        {
            BetDomainMapItem bdmi = BetDomainMapItem.FromXmlElement(el);

            BetDomainMap.m_instance.m_di.Add(bdmi.BetDomainNumber, bdmi);

            if (bdmi.IsGeneric)
            {
                GenericCycle(bdmi.Generic, delegate(int iValue)
                {
                    string sTag     = string.Format(bdmi.BetTag, iValue);
                    string sTimeTag = string.Format(bdmi.TimeType, iValue);

                    GenerateBetDomainType(bdmi, iValue, sTag, sTimeTag);
                });
            }
            else
            {
                GenerateBetDomainType(bdmi, bdmi.SubPart, bdmi.BetTag, bdmi.TimeType);
            }
        }
Exemplo n.º 3
0
        private static void GenerateBetDomainType(BetDomainMapItem bdmi, int iSubPart, string sTag, string sTimeTag)
        {
            try
            {
                BetDomainMap.m_instance.m_di.SafelyAdd(bdmi.BetDomainNumber, bdmi);

                BetDomainTypeLn bdt = new BetDomainTypeLn();

                bdt.Tag                  = sTag;
                bdt.BetTypeTag           = bdmi.BetType;
                bdt.ScoreTypeTag         = bdmi.ScoreType;
                bdt.TimeTypeTag          = sTimeTag;
                bdt.Sort                 = bdmi.Sort;
                bdt.Part                 = bdmi.Part;
                bdt.SubPart              = iSubPart;
                bdt.TranslationArgsCount = bdmi.ArgsCount;

                LineSr.Instance.AllObjects.BetDomainTypes.MergeLineObject(bdt);
            }
            catch
            {
                throw;
            }
        }