Esempio n. 1
0
 public MoveTicket(int _ShowIndex, int?_TicketIndex)
 {
     ShowIndex   = _ShowIndex;
     TicketIndex = _TicketIndex;
     InitializeComponent();
     item = FilePusher.shows[ShowIndex].Tickets[TicketIndex ?? 0];
     TBLNumTickets.Text = item.NumTickets + " Ticket" + (item.NumTickets == 1 ? "" : "s");
     TBLBuyerName.Text  = item.BuyerName;
     SetShows(item.ShowTime);
 }
Esempio n. 2
0
        public static void RemoveTicket(int ShowIndex, int?TicketIndex)
        {
            var item     = shows[ShowIndex].Tickets[TicketIndex ?? 0];
            var itemTime = item.ShowTime;

            shows[ShowIndex].Tickets.Remove(item);
            for (int i = 0; i < shows[ShowIndex].Tickets.Count; ++i)
            {
                shows[ShowIndex].Tickets[i].ID = i;
            }
            shows[ShowIndex].UpSeats();
            var lines = File.ReadAllLines(folder + "ticket" + itemTime.ToString("yyyyMMdd") + "-000.csv");
            var ticks = new List <TicketItem>();

            foreach (var l in lines)
            {
                var    dat = l.Split(',');
                var    st  = new DateTime(int.Parse(l.Substring(0, 4)), int.Parse(l.Substring(5, 2)), int.Parse(l.Substring(8, 2)), int.Parse(l.Substring(11, 2)), int.Parse(l.Substring(13, 2)), 0);
                string b   = dat[3];
                if (b.Length > 1 && (b[b.Length - 1] == '"' || b[b.Length - 1] == '\xFFFD') && (b[0] == '"' || b[0] == '\xFFFD'))
                {
                    b = b.Substring(1, b.Length - 2);
                }
                var t = new TicketItem()
                {
                    ShowTime = st, NumTickets = int.Parse(dat[1]), SaleType = dat[2][0], BuyerName = b, Phone = dat[4]
                };
                if (!(item.ShowTime.Equals(t.ShowTime) && item.NumTickets == t.NumTickets && item.SaleType == t.SaleType && item.BuyerName.Equals(t.BuyerName) && item.Phone.Equals(t.Phone)))
                {
                    ticks.Add(t);
                }
            }
            ticks.Sort();
            var outlines = new List <string>();

            foreach (var t in ticks)
            {
                outlines.Add(t.ShowTime.ToString("yyyy-MM-dd HHmm") + "," + t.NumTickets.ToString() + "," + t.SaleType + ",\"" + t.BuyerName + "\"," + t.Phone);
            }
            File.WriteAllLines(folder + "ticket" + itemTime.ToString("yyyyMMdd") + "-000.csv", outlines);
            if (item.ShowTime > DateTime.Now && item.ShowTime <= DateTime.Now.AddHours(2))
            {
                Push(null, null);
            }
        }
Esempio n. 3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var clean = new System.Text.RegularExpressions.Regex(@"[^\d]");
            var phone = clean.Replace(TBPhone.Text, "");

            if (phone.Length != 10 && phone.Length != 7)
            {
                phone = "";
            }
            var t = new TicketItem()
            {
                ShowTime = SchedItemShow, SaleType = RBFree.IsChecked ?? false ? 'F' : RBDiscount.IsChecked ?? false ? 'D' : 'P', NumTickets = CMBTicketAvalible.SelectedIndex + 1, BuyerName = TBName.Text.Replace(',', '.'), Phone = phone, Created = DateTime.Now
            };

            FilePusher.AddTicket(t);
            Close();
            FilePusher.TotMessage.Content = "Today's Total: " + FilePusher.TotalShows.ToString();
        }
Esempio n. 4
0
        public static void AddTicket(TicketItem t)
        {
            var s = shows.Find(x => x.DTShowTime == t.ShowTime);

            if (s != null)
            {
                t.ID = s.Tickets.Count;
                s.Tickets.Add(t);
                s.UpSeats();
            }
            MakeSched();
            File.AppendAllLines(folder + "ticket" + t.ShowTime.ToString("yyyyMMdd") + "-000.csv", new List <string>
            {
                t.ShowTime.ToString("yyyy-MM-dd HHmm") + "," + t.NumTickets.ToString() + "," + t.SaleType + ",\"" + t.BuyerName + "\"," + t.Phone + "," + t.Created.ToString("yyyy-MM-dd HHmmss")
            });
            if (t.ShowTime > DateTime.Now && t.ShowTime <= DateTime.Now.AddMinutes(120))
            {
                Push(null, null);
            }
        }