Пример #1
0
        public void Read(MySqlDataReader rdr, bool StubOnly = false)
        {
            this.PageID  = rdr.GetInt32("PageID");
            this.PageNo  = rdr.GetInt32("PageNo");
            this.FrameNo = rdr.GetInt32("FrameNo");
            this.Title   = rdr.GetString("Title").Trim();
            if (string.IsNullOrEmpty(this.Title))
            {
                this.Title = "None";
            }
            decimal toPageFrameNo = rdr.GetDecimal("ToPageFrameNo");

            this.ToPageNo    = Convert.ToInt32(toPageFrameNo);
            this.ToFrameNo   = Convert.ToInt32((toPageFrameNo - this.ToPageNo) * 100);
            this.OwnerID     = rdr.GetInt32Safe("OwnerID");
            this.Updated     = rdr.GetDateTimeNullable("Updated");
            this.UpdatedByID = rdr.GetInt32Safe("UpdatedBy");
            if (StubOnly)
            {
                return;
            }
            this.Contents       = rdr.GetBytesNullable("Contents");
            this.URL            = rdr.GetStringNullable("URL").Trim();
            this.BoxMode        = rdr.GetBoolean("BoxMode");
            this.TeleSoftwareID = rdr.GetInt32Nullable("TeleSoftwareID");
            this.IsCarousel     = rdr.GetBooleanSafe("IsCarousel");
            this.CarouselWait   = rdr.GetInt32Safe("CarouselWait");
            this.ConvertContentsFromURL();
        }
Пример #2
0
        public void Read(MySqlDataReader rdr, bool IncludeKeyCode = true)
        {
            if (IncludeKeyCode)
            {
                this.KeyCode = rdr.GetByte("KeyCode");
            }
            int CurrentPageNo  = rdr.GetInt32Safe("CurrentPageNo");
            int CurrentFrameNo = rdr.GetInt32Safe("CurrentFrameNo");

            this.NextPageNo  = rdr.GetInt32Nullable("NextPageNo");
            this.NextFrameNo = rdr.GetInt32Nullable("NextFrameNo");
            this.GoNextPage  = rdr.GetBoolean("GoNextPage");
            this.GoNextFrame = rdr.GetBoolean("GoNextFrame");
            var master = Routes.MasterList.FirstOrDefault(r => r.KeyCode == KeyCode);

            this.Description = (master == null) ? Convert.ToChar(KeyCode).ToString() : master.Description;

            // 1) Next Page checked
            if (GoNextPage && !GoNextFrame)
            {
                this.GoesToPageID = rdr.GetInt32Safe("NextPageID");
                if (this.GoesToPageID > 0)
                {
                    this.GoesToPageNo        = rdr.GetInt32Safe("NextPagePageNo");
                    this.GoesToFrameNo       = rdr.GetInt32Safe("NextPageFrameNo");
                    this.GoesToPageFrameDesc = this.GoesToPageNo.ToString()
                                               + ((char)Convert.ToByte(((byte)"a"[0]) + this.GoesToFrameNo)).ToString();
                }
                else
                {
                    this.GoesToPageID        = Options.MainIndexPageID;
                    this.GoesToPageNo        = Options.MainIndexPageNo;
                    this.GoesToFrameNo       = Options.MainIndexFrameNo;
                    this.GoesToPageFrameDesc = Options.MainIndexPage;
                }
            }

            // 2) Next Frame checked
            else if (GoNextFrame && !GoNextPage)
            {
                this.GoesToPageID = rdr.GetInt32Safe("NextFrameID");
                if (this.GoesToPageID > 0)
                {
                    this.GoesToPageNo        = rdr.GetInt32Safe("NextFramePageNo");
                    this.GoesToFrameNo       = rdr.GetInt32Safe("NextFrameFrameNo");
                    this.GoesToPageFrameDesc = this.GoesToPageNo.ToString()
                                               + ((char)Convert.ToByte(((byte)"a"[0]) + this.GoesToFrameNo)).ToString();
                }
                else
                {
                    this.GoesToPageID = rdr.GetInt32Safe("NextPageID");
                    if (this.GoesToPageID > 0 && CurrentFrameNo == 25)
                    {
                        this.GoesToPageNo        = rdr.GetInt32Safe("NextPagePageNo");
                        this.GoesToFrameNo       = rdr.GetInt32Safe("NextPageFrameNo");
                        this.GoesToPageFrameDesc = this.GoesToPageNo.ToString()
                                                   + ((char)Convert.ToByte(((byte)"a"[0]) + this.GoesToFrameNo)).ToString();
                    }
                    else
                    {
                        this.GoesToPageID        = Options.MainIndexPageID;
                        this.GoesToPageNo        = Options.MainIndexPageNo;
                        this.GoesToFrameNo       = Options.MainIndexFrameNo;
                        this.GoesToPageFrameDesc = Options.MainIndexPage;
                    }
                }
            }

            // 3) Both checked
            else if (GoNextFrame && GoNextPage)
            {
                this.GoesToPageID = rdr.GetInt32Safe("NextFrameID");
                if (this.GoesToPageID > 0)
                {
                    this.GoesToPageNo        = rdr.GetInt32Safe("NextFramePageNo");
                    this.GoesToFrameNo       = rdr.GetInt32Safe("NextFrameFrameNo");
                    this.GoesToPageFrameDesc = this.GoesToPageNo.ToString()
                                               + ((char)Convert.ToByte(((byte)"a"[0]) + this.GoesToFrameNo)).ToString();
                }
                if (this.GoesToPageID <= 0)
                {
                    this.GoesToPageID = rdr.GetInt32Safe("NextPageID");
                    if (this.GoesToPageID > 0)
                    {
                        this.GoesToPageNo        = rdr.GetInt32Safe("NextPagePageNo");
                        this.GoesToFrameNo       = rdr.GetInt32Safe("NextPageFrameNo");
                        this.GoesToPageFrameDesc = this.GoesToPageNo.ToString()
                                                   + ((char)Convert.ToByte(((byte)"a"[0]) + this.GoesToFrameNo)).ToString();
                    }
                }
                if (this.GoesToPageID <= 0)
                {
                    this.GoesToPageID        = Options.MainIndexPageID;
                    this.GoesToPageNo        = Options.MainIndexPageNo;
                    this.GoesToFrameNo       = Options.MainIndexFrameNo;
                    this.GoesToPageFrameDesc = Options.MainIndexPage;
                }
            }

            // 4) Neither checked
            else
            {
                this.GoesToPageID = rdr.GetInt32Safe("DirectPageID");
                if (this.GoesToPageID > 0)
                {
                    this.GoesToPageNo        = rdr.GetInt32Safe("DirectPageNo");
                    this.GoesToFrameNo       = rdr.GetInt32Safe("DirectFrameNo");
                    this.GoesToPageFrameDesc = this.GoesToPageNo.ToString()
                                               + ((char)Convert.ToByte(((byte)"a"[0]) + this.GoesToFrameNo)).ToString();
                }
                else
                {
                    this.GoesToPageID        = -1;
                    this.GoesToPageNo        = -1;
                    this.GoesToFrameNo       = 0;
                    this.GoesToPageFrameDesc = "No Page";
                }
            }
        }