Пример #1
0
        public static CloseTicket FromCheckXElement(XElement element)
        {
            var customerId  = GlobalVar.TicketWindow;
            var closeTicket = new CloseTicket(FromXElement(element.GetXElement("check"), customerId))
            {
                NameTicket             = element.GetXAttributeValue("ticket"),
                DateOpen               = element.GetXAttributeValue("openDate").ToDateTime(),
                DateClose              = !string.IsNullOrEmpty(element.GetXAttributeValue("closeDate")) ? element.GetXAttributeValue("closeDate").ToDateTime() : DateTime.Now,
                CloseTicketGCustomerId = GlobalVar.TicketWindowG
            };

            closeTicket.PayCash       = 0;
            closeTicket.PayResto      = 0;
            closeTicket.PayBankCards  = 0;
            closeTicket.PayBankChecks = 0;

            foreach (var checkTicket in element.GetXElements("check").Select(check => CheckTicket.FromCheckXElement(check, Guid.NewGuid(), closeTicket.CustomerId)))
            {
                closeTicket.PayCash       += checkTicket.PayCash - checkTicket.Rendu;
                closeTicket.PayResto      += checkTicket.PayResto;
                closeTicket.PayBankCards  += checkTicket.PayBankCards;
                closeTicket.PayBankChecks += checkTicket.PayBankChecks;
                closeTicket.ChecksTicket.Add(checkTicket);
            }

            return(closeTicket);
        }
Пример #2
0
        public static XElement ToXElement(CloseTicket obj)
        {
            var element = ToXElementBase(obj);

            element.Add(new XElement("DateOpen", obj.DateOpen));
            element.Add(new XElement("DateClose", obj.DateClose));
            element.Add(new XElement("NameTicket", obj.NameTicket));
            element.Add(new XElement("CloseTicketGCustomerId", obj.CloseTicketGCustomerId));
            return(element);
        }
Пример #3
0
        public static CloseTicket FromXElement(XContainer element)
        {
            var closeTicket = new CloseTicket(FromXElementBase(element))
            {
                DateOpen               = element.GetXElementValue("DateOpen").ToDateTime(),
                DateClose              = element.GetXElementValue("DateClose").ToDateTime(),
                NameTicket             = element.GetXElementValue("NameTicket"),
                CloseTicketGCustomerId = element.GetXElementValue("CloseTicketGCustomerId").ToGuid()
            };

            return(closeTicket);
        }