using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ChuPiao.AutoPrint.Services;
using ChuPiao.Common.Models;

namespace ChuPiao.AutoPrint.Desktop.AutoPrint
{
    public partial class TicketList : Form
    {
        private L_LotTicketEntity[] _tickets;

        public L_LotTicketEntity[] Tickets
        {
            get { return _tickets; }
            set { _tickets = value; }
        }

        public string MacNumber
        {
            get { return _macNumber; }
            set { _macNumber = value; }
        }

        private string _macNumber;

        public TicketList(string macNumber,L_LotTicketEntity[] tickets)
        {
            InitializeComponent();
            _macNumber = macNumber;
            _tickets = tickets;
        }

        private void TicketList_Load(object sender, EventArgs e)
        {
            try
            {
                this.Text = string.Concat(MacNumber, "等待出票任务列表【排序优先级：截止时间>彩种>期号>玩法>金额>下载时间】");
                if(_tickets!=null)
                {
                    this.lvwTicket.Items.Clear();
                    int index = 1;
                    foreach (L_LotTicketEntity ticket in Tickets)
                    {
                        //序号 彩种 玩法 用户订单号 生产流水号 金额 倍数 下载时间 截止时间 投注号码
                        lvwTicket.Items.Add(new ListViewItem(new string[] { index.ToString(), ticket.L_LotName, ticket.L_PlayName, ticket.L_OrderSn, ticket.L_TicketSn, ticket.L_Money.ToString("0"), ticket.L_Mutiple.ToString(), ticket.L_AddTime.ToString("yyyy-MM-dd HH:mm:ss"), ticket.L_EndTime.ToString("yyyy-MM-dd HH:mm:ss"), ticket.L_Code }));
                        index++;
                    }
                }
            }
            catch (Exception exception)
            {
                MessageService.ShowMessage(string.Concat("查看等待出票队列异常。错误信息：",exception.Message));
            }
        }

    }
}