using System;
using System.Collections.Generic;
using System.Text;
using ChuPiao.Common.Models;
using Newtonsoft.Json.Linq;

namespace ChuPiao.Common.Communication.GtdJson.Packs
{
    public class A10003GetBonusRet:PackRetBase
    {
        private int _abbdate;
        public int AbbDate
        {
            get { return _abbdate; }
            set { _abbdate = value; }
        }

        private int _page;
        /// <summary>
        /// 页
        /// </summary>
        public int Page
        {
            get { return _page; }
            set { _page = value; }
        }

        private int _size;
        /// <summary>
        /// 页大小
        /// </summary>
        public int Size
        {
            get { return _size; }
            set { _size = value; }
        }

        private int _total;
        /// <summary>
        /// 总条数
        /// </summary>
        public int Total
        {
            get { return _total; }
            set { _total = value; }
        }

        private List<L_LotTicketEntity> _ticketlist = new List<L_LotTicketEntity>();
        public List<L_LotTicketEntity> TicketList
        {
            get { return _ticketlist; }
            set { _ticketlist = value; }
        }

        public override void UnPackBody(Newtonsoft.Json.Linq.JToken body)
        {
            if (body["ticket"] != null)
            {
                AbbDate = Convert.ToInt32(body["abbdate"].ToString());
                Page = Convert.ToInt32(body["page"].ToString());
                Size = Convert.ToInt32(body["size"].ToString());
                Total = Convert.ToInt32(body["total"].ToString());
                JArray ticketlist = JArray.Parse(body["ticket"].ToString());
                foreach (JToken ticket in ticketlist)
                {
                    L_LotTicketEntity Ticket = new L_LotTicketEntity();
                    Ticket.L_TicketCode = ticket["ticketcode"].ToString();
                    Ticket.L_PrnText = ticket["prntext"].ToString().Replace("\\","");
                    if (!String.IsNullOrEmpty(Ticket.L_PrnText.Trim()))
                    {
                        TicketList.Add(Ticket);
                    }
                }
            }
        }
    }
}
