Ejemplo n.º 1
0
        public static CheckTicket FromCheckXElement(XElement element, Guid customerId, Guid closeTicketCustomerId)
        {
            var checkTicket = new CheckTicket(FromXElement(element, customerId))
            {
                BarCode = element.GetXAttributeValue("barcodeCheck"),
                Date    = element.GetXAttributeValue("date").ToDateTime(),
                CloseTicketCustomerId = closeTicketCustomerId,
                TotalTtc = element.GetXAttributeValue("sum").ToDecimal(),
                Rendu    = element.GetXAttributeValue("Rendu").ToDecimal()
            };
            var returnBarCodeAttribute = element.GetXAttributeOrNull("returnBarcodeCheck");

            if (returnBarCodeAttribute != null)
            {
                checkTicket.ReturnBarCode = returnBarCodeAttribute.Value;
            }

            if (element.Attribute("DCBC") != null)
            {
                checkTicket.CheckDiscount = CloseTicketCheckDiscount.FromXElement(element, Guid.NewGuid(), closeTicketCustomerId);
            }

            foreach (var el in element.Elements("product"))
            {
                checkTicket.PayProducts.Add(PayProduct.FromCheckXElement(el, Guid.NewGuid(), checkTicket.CustomerId, closeTicketCustomerId));
            }

            return(checkTicket);
        }
Ejemplo n.º 2
0
 public static XElement ToXElement(CloseTicketCheckDiscount obj)
 {
     return(new XElement("rec",
                         new XElement("CustomerId", obj.CustomerId),
                         new XElement("CloseTicketCheckcCustomer", obj.CloseTicketCheckcCustomer),
                         new XElement("DiscountCardsCustomerId", obj.DiscountCardsCustomerId),
                         new XElement("Dcbc", obj.Dcbc),
                         new XElement("DcbcBiloPoints", obj.DcbcBiloPoints),
                         new XElement("DcbcDobavilePoints", obj.DcbcDobavilePoints),
                         new XElement("DcbcOtnayliPoints", obj.DcbcOtnayliPoints),
                         new XElement("DcbcOstalosPoints", obj.DcbcOstalosPoints),
                         new XElement("DcbcName", obj.DcbcName)));
 }