コード例 #1
0
        public static CloseTicket Close()
        {
            var document    = XDocument.Load(PathCheck);
            var closeTicket = CloseTicket.FromCheckXElement(document.GetXElement("checks"));

            closeTicket.DateClose = DateTime.Now;
            document.GetXAttribute("checks", "closeDate").SetValue(closeTicket.DateClose.ToString(Config.DateFormat));
            File.WriteAllText(PathCheck, document.ToString());

            var payProducts = new List <PayProduct>();
            var closeTicketCheckDiscounts = new List <CloseTicketCheckDiscount>();

            foreach (var check in closeTicket.ChecksTicket)
            {
                payProducts.AddRange(check.PayProducts);
                if (check.CheckDiscount != null)
                {
                    closeTicketCheckDiscounts.Add(check.CheckDiscount);
                }
            }

            Add(closeTicket);
            RepositoryCheckTicket.AddRange(closeTicket.ChecksTicket);
            RepositoryPayProduct.AddRange(payProducts);
            RepositoryCloseTicketCheckDiscount.AddRange(closeTicketCheckDiscounts);
            return(closeTicket);
        }
コード例 #2
0
        public static List <CloseTicket> GetByCloseTicketGId(Guid closeTicketGCustomerId)
        {
            if (CloseTickets.Count == 0)
            {
                Sync();
            }

            var closeTickets = CloseTickets.FindAll(ct => ct.CloseTicketGCustomerId == closeTicketGCustomerId);

            if (RepositoryCheckTicket.CheckTickets.Count == 0)
            {
                RepositoryCheckTicket.Sync();
            }

            foreach (var closeTicket in closeTickets)
            {
                closeTicket.ChecksTicket = RepositoryCheckTicket.GetByCloseTicketId(closeTicket.CustomerId);
                foreach (var checkTicket in closeTicket.ChecksTicket)
                {
                    checkTicket.PayProducts = RepositoryPayProduct.GetByCheckTicketId(checkTicket.CustomerId);
                }
            }
            return(closeTickets);
        }