Пример #1
0
        public static CheckTicketTmp FromCheckXElement(XElement element, Guid customerId, Guid closeTicketCustomerId)
        {
            var checkTicket = new CheckTicketTmp(FromXElement(element, customerId))
            {
                BarCode = element.GetXAttributeValue("barcodeCheck"),
                Date    = element.GetXAttributeValue("date").ToDateTime(),
                CloseTicketCustomerId = closeTicketCustomerId,
                TotalTtc = element.GetXAttributeValue("sum").ToDecimal(),
                Rendu    = element.GetXAttributeValue("Rendu").ToDecimal()
            };

            if (element.Attribute("DCBC") != null)
            {
                checkTicket.Dcbc               = element.GetXAttributeValue("DCBC");
                checkTicket.DcbcBiloPoints     = element.GetXAttributeValue("DCBC_BiloPoints").ToInt();
                checkTicket.DcbcDobavilePoints = element.GetXAttributeValue("DCBC_DobavilePoints").ToInt();
                checkTicket.DcbcOtnayliPoints  = element.GetXAttributeValue("DCBC_OtnayliPoints").ToInt();
                checkTicket.DcbcOstalosPoints  = element.GetXAttributeValue("DCBC_OstalosPoints").ToInt();
                checkTicket.DcbcName           = element.GetXAttributeValue("DCBC_name");
            }

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

            return(checkTicket);
        }
Пример #2
0
 public static XElement ToXElement(PayProductTmp obj)
 {
     return(new XElement("rec",
                         new XElement("IdCheckTicket", obj.IdCheckTicket),
                         new XElement("ProductId", obj.ProductId),
                         new XElement("Name", obj.Name),
                         new XElement("Barcode", obj.Barcode),
                         new XElement("Qty", obj.Qty),
                         new XElement("Tva", obj.Tva),
                         new XElement("PriceHt", obj.PriceHt),
                         new XElement("Total", obj.Total),
                         new XElement("ChecksTicketCustomerId", obj.ChecksTicketCustomerId),
                         new XElement("Discount", obj.Discount),
                         new XElement("SumDiscount", obj.SumDiscount)));
 }