Ejemplo n.º 1
0
 public static void SetTillProduct(TillProductModel tillProductModel, List<String> tillNames, List<String> ipAddresses)
 {
     string generatedXml = CreateProductXml("1", tillProductModel);
     for (int i = 0; i < ipAddresses.Count; i++)
     {
         SendXmlData(generatedXml, tillNames[i], ipAddresses[i]);
     }
 }
Ejemplo n.º 2
0
        private static string CreateProductXml(string fileNumber, TillProductModel tillProductModel)
        {
            XmlDocument doc = new XmlDocument();
            XmlNode rootNode = doc.CreateElement("SENDPROGRAMDATA");
            XmlAttribute rootNodeAttribute = doc.CreateAttribute("file");
            rootNode.Attributes.Append(rootNodeAttribute);
            rootNodeAttribute.Value = fileNumber;
            doc.AppendChild(rootNode);

            XmlNode dataNode = doc.CreateElement("DATA");
            rootNode.AppendChild(dataNode);

            XmlNode recordNode = doc.CreateElement("RECORD");
            recordNode.AppendChild(doc.CreateTextNode(Convert.ToString(tillProductModel.Record)));
            dataNode.AppendChild(recordNode);

            XmlNode nameNode = doc.CreateElement("NAME");
            nameNode.AppendChild(doc.CreateTextNode(tillProductModel.Name));
            dataNode.AppendChild(nameNode);

            XmlNode priceNode = doc.CreateElement("PRICE1L1");
            priceNode.AppendChild(doc.CreateTextNode(Convert.ToString(tillProductModel.Price1L1)));
            dataNode.AppendChild(priceNode);

            XmlNode quantityNode = doc.CreateElement("QTY1");
            quantityNode.AppendChild(doc.CreateTextNode("1.00"));
            dataNode.AppendChild(quantityNode);

            XmlNode groupNode = doc.CreateElement("GROUP");
            groupNode.AppendChild(doc.CreateTextNode(Convert.ToString(tillProductModel.GroupRecord)));
            dataNode.AppendChild(groupNode);

            XmlNode deptNode = doc.CreateElement("DEPT");
            deptNode.AppendChild(doc.CreateTextNode(Convert.ToString(tillProductModel.DepartmentRecord)));
            dataNode.AppendChild(deptNode);

            XmlNode taxRateNode = doc.CreateElement("TAXRATE");
            taxRateNode.AppendChild(doc.CreateTextNode(Convert.ToString(tillProductModel.ProductRateRecord)));
            dataNode.AppendChild(taxRateNode);

            return (doc.InnerXml) + "\n";
        }