Пример #1
0
        public override void SetupData(XmlDocument doc)
        {
            XmlNodeList productTotals = null;

            try
            {
                FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.ProductTotals, SummaCommon.GetStoreId(doc));

                productTotals = doc.DocumentElement.SelectNodes("/TotalsProducts/Product");

                int counter = 0;
                foreach (XmlNode productTotalNode in productTotals)
                {
                    csvData.Add(new List <string>());

                    csvData[counter].Add(SummaProductTotalsCommon.GetProductId(productTotalNode));
                    csvData[counter].Add(SummaProductTotalsCommon.GetQty(productTotalNode));

                    #region Old Specs
                    //  csvData[counter].Add(SummaProductTotalsCommon.GetTotalSales(productTotalNode));
                    #endregion

                    #region Specs v1.2
                    csvData[counter].Add(SummaProductTotalsCommon.GetTotalSalesXTax(productTotalNode));
                    csvData[counter].Add(SummaProductTotalsCommon.GetTotalTaxAmount(productTotalNode));
                    #endregion

                    csvData[counter].Add(SummaProductTotalsCommon.GetTimestamp(productTotalNode));
                    csvData[counter].Add(SummaCommon.GetStoreId(doc));
                    csvData[counter].Add(SummaCommon.GetTillId(doc));

                    counter++;
                    csvLineData.Add(new StringBuilder());

/*
 *                  if ((counter == 1) || (counter > productTotals.Count))
 *                  {
 *                      csvLineData.Add(new StringBuilder());
 *                  }
 *                  else
 *                  {
 *                      csvLineData.Add(new StringBuilder(","));
 *                  }
 */
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing product totals", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #2
0
        public override void SetupData(XmlDocument doc)
        {
            FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.HourlyTotals, SummaCommon.GetStoreId(doc));

            XmlNodeList hourTotals = null;

            try
            {
                hourTotals = doc.DocumentElement.SelectNodes("/TotalsHourlySales/Hour");

                int counter = 0;
                foreach (XmlNode hourTotalNode in hourTotals)
                {
                    csvData.Add(new List <string>());

                    csvData[counter].Add(SummaHourlyTotalsCommon.GetHourId(hourTotalNode));
                    csvData[counter].Add(SummaHourlyTotalsCommon.GetTransQty(hourTotalNode));

                    #region Old Specs
                    //csvData[counter].Add(SummaHourlyTotalsCommon.GetHourlyTotal(hourTotalNode));
                    #endregion

                    #region Specs v1.2
                    csvData[counter].Add(SummaHourlyTotalsCommon.GetHourlySalesXTax(hourTotalNode));
                    csvData[counter].Add(SummaHourlyTotalsCommon.GetTotalTaxAmount(hourTotalNode));
                    #endregion

                    csvData[counter].Add(SummaHourlyTotalsCommon.GetDateTime(hourTotalNode));
                    csvData[counter].Add(SummaCommon.GetStoreId(doc));
                    csvData[counter].Add(SummaCommon.GetTillId(doc));

                    counter++;
                    csvLineData.Add(new StringBuilder());

/*
 *                  if ((counter == 1) || (counter > hourTotals.Count))
 *                  {
 *                      csvLineData.Add(new StringBuilder());
 *                  }
 *                  else
 *                  {
 *                      csvLineData.Add(new StringBuilder(","));
 *                  }
 */
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing hourly sales", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #3
0
        /// <summary>
        /// Get the Name as the Id.
        /// </summary>
        /// <param name="paymentNode"></param>
        /// <returns></returns>
        internal static string GetPaymentId(XmlNode paymentNode)
        {
            string code = paymentNode.Attributes["Code"].Value;

            if (code.Trim() == @"")
            {
                return(SummaCommon.StringToUnsignedHashValue(paymentNode.Attributes["Name"].Value));
            }
            else
            {
                return(code);
            }
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public static string GetDateStamp(XmlDocument doc)
        {
            XmlNode receiptNode = null;

            try {
                receiptNode = doc.DocumentElement.SelectSingleNode("/Transaction/Receipt");
            }
            catch (XPathException xpe) {
                throw xpe;
            }

            return(SummaCommon.GetSummaFormattedTimestamp(receiptNode.Attributes["Date"].Value,
                                                          receiptNode.Attributes["Time"].Value));
        }
Пример #5
0
        /// <summary>
        /// Return the Name as the Id converted to a uint.
        /// </summary>
        /// <param name="paymentTypeNode"></param>
        /// <returns></returns>
        internal static string GetPaymentTypeId(XmlNode paymentTypeNode)
        {
            string pID = paymentTypeNode.Attributes["Code"].Value;

            if (pID == @"")
            {
                return(SummaCommon.StringToUnsignedHashValue(paymentTypeNode.Attributes["Name"].Value));
            }
            else
            {
                return(pID);
            }

            //return SummaCommon.StringToUnsignedHashValue(paymentTypeNode.Attributes["Name"].Value);
        }
Пример #6
0
        public override void SetupData(System.Xml.XmlDocument doc)
        {
            try
            {
                // In case GetStoreId fails
                Summa.ErrorLevelFile = FileLogger.LogErrorLevelFile.TotalsDiscountsXMLFile;
                Summa.ErrorStrDetail = doc.DocumentElement.Attributes["id"].Name;

                FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.FreeListTotals, SummaCommon.GetStoreId(doc));

                XmlNodeList freeListTotals = null;

                freeListTotals = doc.DocumentElement.SelectNodes("/TotalsDiscounts/Discount");

                int counter = 0;
                foreach (XmlNode freeListTotalNode in freeListTotals)
                {
                    csvData.Add(new List <string>());

                    csvData[counter].Add(SummaFreeListTotals.GetId(freeListTotalNode));
                    csvData[counter].Add(SummaFreeListTotals.GetCount(freeListTotalNode));
                    csvData[counter].Add(SummaFreeListTotals.GetTotalSales(freeListTotalNode));
                    csvData[counter].Add(SummaFreeListTotals.GetTimestamp(freeListTotalNode));
                    csvData[counter].Add(SummaCommon.GetStoreId(doc));
                    csvData[counter].Add(SummaCommon.GetTillId(doc));

                    counter++;
                    csvLineData.Add(new StringBuilder());

/*
 *                  if ((counter == 1) || (counter > freeListTotals.Count))
 *                  {
 *                      csvLineData.Add(new StringBuilder());
 *                  }
 *                  else
 *                  {
 *                      csvLineData.Add(new StringBuilder(","));
 *                  }
 */
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing free list totals", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #7
0
        public override void SetupData(XmlDocument doc)
        {
            XmlNodeList departmentTotals = null;

            try
            {
                FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.CategoriesTotals, SummaCommon.GetStoreId(doc));

                // In case GetStoreId fails
                //Summa.ErrorLevelFile = FileLogger.LogErrorLevelFile.UpdateMemberXMLFile;
                //Summa.ErrorStrDetail = doc.DocumentElement.Attributes["id"].Name;

                departmentTotals = doc.DocumentElement.SelectNodes("/TotalsCategories/Category");

                int counter = 0;
                foreach (XmlNode departmentTotalNode in departmentTotals)
                {
                    csvData.Add(new List <string>());

                    csvData[counter].Add(SummaDepartmentTotals.GetDepartmentId(departmentTotalNode));
                    csvData[counter].Add(SummaDepartmentTotals.GetQtySold(departmentTotalNode));
                    csvData[counter].Add(SummaDepartmentTotals.GetTotalSales(departmentTotalNode));
                    csvData[counter].Add(SummaDepartmentTotals.GetTimestamp(departmentTotalNode));
                    csvData[counter].Add(SummaCommon.GetStoreId(doc));
                    csvData[counter].Add(SummaCommon.GetTillId(doc));

                    counter++;
                    csvLineData.Add(new StringBuilder());

/*
 *                  if ((counter == 1) || (counter > departmentTotals.Count))
 *                  {
 *                      csvLineData.Add(new StringBuilder());
 *                  }
 *                  else
 *                  {
 *                      csvLineData.Add(new StringBuilder(","));
 *                  }
 */
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing department totals", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public static string GetProductId(XmlNode node)
        {
            if (node.Attributes["Code"].Value == String.Empty)
            {
                StringBuilder b = new StringBuilder();
                b.Append(node.Attributes["Menu"].Value);
                b.Append(node.Attributes["Course"].Value);
                b.Append(node.Attributes["Item"].Value);
                b.Append(node.Attributes["Size"].Value);

                return(SummaCommon.StringToUnsignedHashValue(b.ToString()));
            }
            else
            {
                return(node.Attributes["Code"].Value);
            }
        }
Пример #9
0
        public override void SetupData(System.Xml.XmlDocument doc)
        {
            XmlNodeList discounts = null;

            try
            {
                // In case GetStoreId fails
                Summa.ErrorLevelFile = FileLogger.LogErrorLevelFile.ListCalculatedXMLFile;
                Summa.ErrorStrDetail = doc.DocumentElement.Attributes["id"].Name;

                FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.DailyTotalList, SummaCommon.GetStoreId(doc));

                discounts = doc.DocumentElement.SelectNodes("/ListCalculated/Calculated");


                int counter = 0;
                foreach (XmlNode discountNode in discounts)
                {
                    csvData.Add(new List <string>());

                    csvData[counter].Add(SummaFixedListCommon.GetFixedListId(discountNode));
                    csvData[counter].Add(SummaFixedListCommon.GetName(discountNode));
                    csvData[counter].Add(SummaCommon.GetStoreId(doc));

                    counter++;
                    csvLineData.Add(new StringBuilder());

/*
 *                   if ((counter == 1) || (counter > discounts.Count))
 *                   {
 *                       csvLineData.Add(new StringBuilder());
 *                   }
 *                   else
 *                   {
 *                       csvLineData.Add(new StringBuilder(","));
 *                   }
 */
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing fixed list", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #10
0
        public override void SetupData(System.Xml.XmlDocument doc)
        {
            XmlNodeList groupTotals = null;

            try
            {
                FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.GroupTotals, SummaCommon.GetStoreId(doc));

                groupTotals = doc.DocumentElement.SelectNodes("/TotalsGroups/Group");

                int counter = 0;
                foreach (XmlNode groupTotalNode in groupTotals)
                {
                    csvData.Add(new List <string>());

                    csvData[counter].Add(SummaGroupTotals.GetGroupId(groupTotalNode));
                    csvData[counter].Add(SummaGroupTotals.GetQtySold(groupTotalNode));
                    csvData[counter].Add(SummaGroupTotals.GetTotalSales(groupTotalNode));
                    csvData[counter].Add(SummaGroupTotals.GetTimestamp(groupTotalNode));
                    csvData[counter].Add(SummaCommon.GetStoreId(doc));
                    csvData[counter].Add(SummaCommon.GetTillId(doc));

                    counter++;
                    csvLineData.Add(new StringBuilder());

/*
 *                  if ((counter == 1) || (counter > groupTotals.Count))
 *                  {
 *                      csvLineData.Add(new StringBuilder());
 *                  }
 *                  else
 *                  {
 *                      csvLineData.Add(new StringBuilder(","));
 *                  }
 */
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing group totals", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #11
0
        public override void SetupData(XmlDocument doc)
        {
            FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.PaymentTotals, SummaCommon.GetStoreId(doc));

            XmlNodeList paymentMethodTotals = null;

            try {
                paymentMethodTotals = doc.DocumentElement.SelectNodes("/TotalsPayments/TotalPayment");

                int counter = 0;
                foreach (XmlNode paymentTotalNode in paymentMethodTotals)
                {
                    csvData.Add(new List <string>());

                    csvData[counter].Add(SummaPaymentMethodTotalsCommon.GetPaymentId(paymentTotalNode));
                    csvData[counter].Add(SummaPaymentMethodTotalsCommon.GetTransactionCount(paymentTotalNode));
                    csvData[counter].Add(SummaPaymentMethodTotalsCommon.GetTotal(paymentTotalNode));
                    csvData[counter].Add(SummaPaymentMethodTotalsCommon.GetTimestamp(paymentTotalNode));
                    csvData[counter].Add(SummaCommon.GetStoreId(doc));
                    csvData[counter].Add(SummaCommon.GetTillId(doc));

                    counter++;
                    csvLineData.Add(new StringBuilder());

/*
 *                  if ((counter == 1) || (counter > paymentMethodTotals.Count))
 *                  {
 *                      csvLineData.Add(new StringBuilder());
 *                  }
 *                  else
 *                  {
 *                      csvLineData.Add(new StringBuilder(","));
 *                  }
 */
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing payment method totals", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #12
0
        /// <summary>
        /// Deconstruct xml document and populate internal data fields
        /// </summary>
        /// <param name="doc"></param>
        public override void SetupData(XmlDocument doc)
        {
            try
            {
                // In case GetStoreId fails
                Summa.ErrorLevelFile = FileLogger.LogErrorLevelFile.VersionXMLFile;
                Summa.ErrorStrDetail = doc.DocumentElement.Attributes["id"].Name;

                FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.Version, SummaCommon.GetStoreId(doc));

                csvData.Add(new List <string>());
                csvLineData.Add(new StringBuilder());

                csvData[0].Add(SummaCommon.GetPOSVersion(doc));
                csvData[0].Add(SummaCommon.GetInterfaceVersion(doc));
            }
            catch (Exception e)
            {
                SummaException se = new SummaException("Problem processing version", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #13
0
 internal static string GetDepartmentGroupId(XmlNode departmentNode)
 {
     return(SummaCommon.StringToUnsignedHashValue(departmentNode.Attributes["GroupID"].Value));
 }
Пример #14
0
        /// <summary>Starts communication with client.</summary>
        public void Process(string Transaction, string outputFilePath, string outputFilePathIsAccessDoor, bool doorAccessFlag)
        {
            StreamWriter streamWriter = new StreamWriter(NetStream);

            try
            {
                // All writes will be done immediately and not cached:
                streamWriter.AutoFlush = true;

                // Start loop and handle commands:
                // Convert to an xml object.
                XmlDocument xmlData = new XmlDocument();
                xmlData.LoadXml(Transaction);

                // USED TO DEBUG. Save the xmal file reveived from Menumate
                //xmlData.Save(string.Format(@"{0}XMLData{1}.xml", @".\archive\", Transaction.GetHashCode()));

                string messageId = SummaCommon.GetMessageId(xmlData);

                if (xmlData.FirstChild.Name == "xml")
                {
                    if (xmlData.DocumentElement.Name == "Request")
                    {
                        if (xmlData.DocumentElement.Attributes.GetNamedItem("Type").Value == "Status")
                        {
                            // Send the xml responce.
                            XmlDocument xmlResponse = BuildResponse(messageId, "ACK", "");
                            string      hResponse   = ResponseWithHeader(xmlResponse.OuterXml);
                            streamWriter.WriteLine(hResponse);

                            // Process the xml object.
                            _singletonLogger.Log("XML Response : " + hResponse);
                        }
                        else
                        {
                            streamWriter.WriteLine(ResponseWithHeader(BuildResponse("1", "NAK", "Unknown Request Type").OuterXml));

                            _singletonLogger.LogError(FileLogger.LogErrorLevel.InternalXMLError,
                                                      FileLogger.LogErrorLevelFile.RequestXMLFile,
                                                      @"Error occured: Not an xml Document", Transaction);

                            _singletonLogger.LogWarning(@"Summa failed processing a Menumate XML file.  See the log file for details");
                        }
                    }
                    else
                    {
                        // create instance of summa interface
                        IPOSMessage summa = new Summa(outputFilePath, outputFilePathIsAccessDoor, doorAccessFlag);

                        try
                        {
                            summa.Process(xmlData);
                            streamWriter.WriteLine(ResponseWithHeader(BuildResponse(messageId, "ACK", "").OuterXml));

                            _singletonLogger.Log("Transaction OK, id = " + messageId);
                        }
                        catch (SummaException se)
                        {
                            // fail
                            streamWriter.WriteLine(ResponseWithHeader(BuildResponse(messageId, "NAK", se.Message).OuterXml));

                            //_singletonLogger.LogError("Summa returned an error, " + se.ToString());
                            //_singletonLogger.LogException(@"Failed to process an XML file", se);

                            //:::::::::::::::::::::::::::::::::::::::::::::::::::::::
                            // Save the document to a file and auto-indent the output.
                            //:::::::::::::::::::::::::::::::::::::::::::::::::::::::
                            SaveXML.SaveInFolder(@"XML Failed", xmlData);
                        }
                        catch (XPathException xpe)
                        {
                            // fail
                            streamWriter.WriteLine(ResponseWithHeader(BuildResponse(messageId, "NAK", xpe.Message).OuterXml));

                            //_singletonLogger.LogError("Summa returned an error, " + xpe.ToString());
                            //_singletonLogger.LogException(@"Failed to process an XML file", xpe);

                            //:::::::::::::::::::::::::::::::::::::::::::::::::::::::
                            // Save the document to a file and auto-indent the output.
                            //:::::::::::::::::::::::::::::::::::::::::::::::::::::::
                            SaveXML.SaveInFolder(@"XML Failed", xmlData);
                        }
                    }
                }
                else
                {
                    string message = "Not an XML Document";
                    streamWriter.WriteLine(ResponseWithHeader(BuildResponse("1", "NAK", message).OuterXml));

                    _singletonLogger.LogError(FileLogger.LogErrorLevel.InternalXMLError,
                                              FileLogger.LogErrorLevelFile.UnknownXMLFile,
                                              "Not an XML Document: ", Transaction);

                    _singletonLogger.LogWarning(@"Summa failed processing a Menumate XML file.  See the log file for details");


                    //logger.Error("Error occured: " + message);

                    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::
                    // Save the document to a file and auto-indent the output.
                    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::
                    SaveXML.SaveInFolder(@"XML Failed", xmlData);
                }
            }
            catch (Exception ex)
            {
                // Generate a negitive xml responce here.
                streamWriter.WriteLine(ResponseWithHeader(BuildResponse("1", "NAK", ex.Message).OuterXml));

                _singletonLogger.LogError(FileLogger.LogErrorLevel.InternalXMLError,
                                          FileLogger.LogErrorLevelFile.UnknownXMLFile,
                                          string.Format(@"An Exception occured: {0}", ex.Message),
                                          Transaction);

                _singletonLogger.LogWarning(@"Summa failed processing a Menumate XML file.  See the log file for details");

                //_singletonLogger.LogError(@"Raw Data Received: " + Transaction);

                //logger.Error("An Exception occured: " + ex.ToString());
                //logger.Error("Raw Data Received: " + Transaction);

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::
                // Save Transaction string.
                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::
                SaveXML.SaveInFolder(@"XML Failed", Transaction);
            }
            finally
            {
                streamWriter.Close();
                streamWriter.Dispose();
            }
        }
Пример #15
0
        public override void SetupData(System.Xml.XmlDocument doc)
        {
            try
            {
                XmlNodeList payments = null;

                // In case GetStoreId fails
                Summa.ErrorLevelFile = FileLogger.LogErrorLevelFile.ListPaymentTypesXMLFile;
                Summa.ErrorStrDetail = doc.DocumentElement.Attributes["id"].Name;

                FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.PaymentMethodTypes, SummaCommon.GetStoreId(doc));

                payments = doc.DocumentElement.SelectNodes("/ListPaymentTypes/Payment");

                int counter = 0;
                foreach (XmlNode paymentTypeNode in payments)
                {
                    csvData.Add(new List <string>());

                    csvData[counter].Add(SummaPaymentTypeCommon.GetPaymentTypeId(paymentTypeNode));
                    csvData[counter].Add(SummaPaymentTypeCommon.GetPaymentTypeName(paymentTypeNode));
                    csvData[counter].Add(SummaPaymentTypeCommon.GetStoreId(doc));

                    counter++;
                    csvLineData.Add(new StringBuilder());

/*
 *                  if ((counter == 1 ) || (counter > payments.Count))
 *                  {
 *                      csvLineData.Add(new StringBuilder());
 *                  }
 *                  else
 *                  {
 *                      csvLineData.Add(new StringBuilder(","));
 *                  }
 */
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing payment method types", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #16
0
        public override void SetupData(XmlDocument doc)
        {
            FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.Products, SummaCommon.GetStoreId(doc));

            List <string> productIds = new List <string>();

            XmlNodeList menus = null;

            try
            {
                // In case GetStoreId fails
                Summa.ErrorLevelFile = FileLogger.LogErrorLevelFile.ListProductTypesXMLFile;
                Summa.ErrorStrDetail = doc.DocumentElement.Attributes["id"].Name;

                menus = doc.DocumentElement.SelectNodes("//Menu");

                int lineCounter = 0;
                foreach (XmlNode menuNode in menus)
                {
                    XmlNodeList courses = null;

                    courses = menuNode.SelectNodes("./Courses/Course");


                    foreach (XmlNode courseNode in courses)
                    {
                        XmlNodeList items = null;

                        items = courseNode.SelectNodes("./Items/Item");


                        foreach (XmlNode itemNode in items)
                        {
                            XmlNodeList sizes = null;

                            sizes = itemNode.SelectNodes("./Sizes/Size");


                            foreach (XmlNode sizeNode in sizes)
                            {
                                csvData.Add(new List <string>());

                                string productId = SummaProductsListCommon.GetProductId(menuNode, courseNode, itemNode, sizeNode);

                                if (productIds.Contains(productId))
                                {
                                    _singletonLogger.LogError(FileLogger.LogErrorLevel.InternalXMLError, FileLogger.LogErrorLevelFile.ListProductTypesXMLFile,
                                                              string.Format("Duplicate Product Id found: {0}, {1} ", productId,
                                                                            SummaProductsListCommon.GetProductName(menuNode, courseNode, itemNode, sizeNode)), @"");

                                    //Summa.LOGGER.Error("Duplicate Product Id found: {0}, {1] ",
                                    //	productId,
                                    //	SummaProductsListCommon.GetProductName(menuNode, courseNode, itemNode, sizeNode));
                                }
                                else
                                {
                                    productIds.Add(productId);

                                    csvData[lineCounter].Add(productId);
                                    csvData[lineCounter].Add(SummaProductsListCommon.GetProductName(menuNode, courseNode, itemNode, sizeNode));
                                    csvData[lineCounter].Add(SummaProductsListCommon.GetProductBarcode(itemNode));
                                    csvData[lineCounter].Add(SummaProductsListCommon.GetProductPrice1(sizeNode));
                                    csvData[lineCounter].Add(SummaProductsListCommon.GetProductPrice2(sizeNode));
                                    csvData[lineCounter].Add(SummaProductsListCommon.GetProductGroupId(sizeNode));
                                    csvData[lineCounter].Add(SummaProductsListCommon.GetProductDepartmentId(sizeNode));
                                    csvData[lineCounter].Add(SummaProductsListCommon.GetProductCost(sizeNode));
                                    csvData[lineCounter].Add(SummaProductsListCommon.GetStoreId(doc));

                                    lineCounter++;
                                    csvLineData.Add(new StringBuilder());
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing products", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #17
0
        public override void SetupData(XmlDocument doc)
        {
            FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.ListPatronsTypes, SummaCommon.GetStoreId(doc));

            XmlNodeList patrons = null;

            try
            {
                patrons = doc.DocumentElement.SelectNodes("/ListPatronTypes/PatronType");
                int c = 0;
                foreach (XmlNode patronNode in patrons)
                {
                    csvData.Add(new List <string>());

                    csvData[c].Add(GetPatronId(patronNode));
                    csvData[c].Add(GetPatronName(patronNode));
                    csvData[c].Add(GetStoreId(doc));
                    c++;
                    csvLineData.Add(new StringBuilder());
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing patron types", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #18
0
 private string GetTimestamp(XmlNode node)
 {
     return(SummaCommon.GetSummaFormattedTimestamp(node.Attributes["Date"].Value,
                                                   node.Attributes["Time"].Value));
 }
Пример #19
0
 internal static string GetDepartmentId(XmlNode departmentTotalNode)
 {
     return(SummaCommon.StringToUnsignedHashValue(departmentTotalNode.Attributes["Name"].Value));
 }
Пример #20
0
        public override void SetupData(XmlDocument doc)
        {
            XmlNodeList patronTotals = null;

            try
            {
                FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.PatronCountsTotals, SummaCommon.GetStoreId(doc));

                patronTotals = doc.DocumentElement.SelectNodes("/TotalsPatron/PatronType");
                int c = 0;
                foreach (XmlNode patronTotalNode in patronTotals)
                {
                    csvData.Add(new List <string>());

                    csvData[c].Add(GetPatronId(patronTotalNode));
                    csvData[c].Add(GetPatronCount(patronTotalNode));
                    csvData[c].Add(GetTimestamp(patronTotalNode));
                    csvData[c].Add(GetTillId(doc));
                    csvData[c].Add(doc.DocumentElement.Attributes["SiteID"].Value);

                    c++;
                    csvLineData.Add(new StringBuilder());
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing patron totals", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #21
0
 internal static string GetGroupId(XmlNode groupTotalNode)
 {
     return(SummaCommon.StringToUnsignedHashValue(groupTotalNode.Attributes["Name"].Value));
 }
Пример #22
0
        public override void SetupData(System.Xml.XmlDocument doc)
        {
            XmlNodeList operators = null;

            try
            {
                // In case GetStoreId fails
                Summa.ErrorLevelFile = FileLogger.LogErrorLevelFile.ListStaffXMLFile;
                Summa.ErrorStrDetail = doc.DocumentElement.Attributes["id"].Name;

                FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.Operators, SummaCommon.GetStoreId(doc));

                operators = doc.DocumentElement.SelectNodes("/ListStaff/Staff");

                int counter = 0;
                foreach (XmlNode operatorNode in operators)
                {
                    csvData.Add(new List <string>());

                    csvData[counter].Add(SummaOperatorsCommon.GetOperatorId(operatorNode));
                    csvData[counter].Add(SummaOperatorsCommon.GetOperatorName(operatorNode));
                    csvData[counter].Add(SummaOperatorsCommon.GetStoreId(doc));

                    counter++;
                    csvLineData.Add(new StringBuilder());

/*
 *                  if ((counter == 1) || (counter > operators.Count))
 *                  {
 *                      csvLineData.Add(new StringBuilder());
 *                  }
 *                  else
 *                  {
 *                      csvLineData.Add(new StringBuilder(","));
 *                  }
 */
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing operators", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #23
0
 internal static string GetId(XmlNode operatorTotalNode)
 {
     return(SummaCommon.StringToUnsignedHashValue(operatorTotalNode.Attributes["id"].Value));
 }
Пример #24
0
 internal static string GetTimestamp(XmlNode productTotalNode)
 {
     return(SummaCommon.GetSummaFormattedTimestamp(productTotalNode.Attributes["Date"].Value,
                                                   productTotalNode.Attributes["Time"].Value));
 }
Пример #25
0
        public override void SetupData(System.Xml.XmlDocument doc)
        {
            FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.DailyTotals, SummaCommon.GetStoreId(doc));

            XmlNodeList fixedListTotals = null;

            try {
                fixedListTotals = doc.DocumentElement.SelectNodes("/TotalsCalculated/Calculated");

                int counter = 0;
                foreach (XmlNode fixedListTotalNode in fixedListTotals)
                {
                    csvData.Add(new List <string>());

                    csvData[counter].Add(SummaFixedListTotals.GetId(fixedListTotalNode));
                    csvData[counter].Add(SummaFixedListTotals.GetCount(fixedListTotalNode));

                    #region Old Specs
                    //csvData[counter].Add(SummaFixedListTotals.GetTotalSales(fixedListTotalNode));
                    #endregion

                    #region Specs v1.2

                    int tId = Convert.ToInt16(SummaFixedListTotals.GetId(fixedListTotalNode));

                    if (tId == 4) // Discount always positive
                    {
                        string total = SummaFixedListTotals.GetSalesTotalXTax(fixedListTotalNode);

                        csvData[counter].Add(Convert.ToString(Math.Abs(Convert.ToDecimal(total))));
                    }
                    else
                    {
                        csvData[counter].Add(SummaFixedListTotals.GetSalesTotalXTax(fixedListTotalNode));
                    }

                    csvData[counter].Add(SummaFixedListTotals.GetSalesTotalTaxAmount(fixedListTotalNode));

                    #endregion

                    csvData[counter].Add(SummaFixedListTotals.GetTimestamp(fixedListTotalNode));
                    csvData[counter].Add(SummaCommon.GetStoreId(doc));
                    csvData[counter].Add(SummaCommon.GetTillId(doc));

                    counter++;
                    csvLineData.Add(new StringBuilder());

/*
 *                  if ((counter == 1) || (counter > fixedListTotals.Count))
 *                  {
 *                      csvLineData.Add(new StringBuilder());
 *                  }
 *                  else
 *                  {
 *                      csvLineData.Add(new StringBuilder(","));
 *                  }
 */
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing fixed list totals", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #26
0
 internal static string GetProductGroupId(XmlNode sizeNode)
 {
     return(SummaCommon.StringToUnsignedHashValue(sizeNode.Attributes["GroupID"].Value));
 }
Пример #27
0
 internal static string GetProductDepartmentId(XmlNode sizeNode)
 {
     return(SummaCommon.StringToUnsignedHashValue(sizeNode.Attributes["CategoryName"].Value));
 }
Пример #28
0
 internal static string GetFreeListId(XmlNode discountNode)
 {
     return(SummaCommon.StringToUnsignedHashValue(discountNode.Attributes["id"].Value));
 }
Пример #29
0
        public override void SetupData(XmlDocument doc)
        {
            try
            {
                // In case GetStoreId fails
                Summa.ErrorLevelFile = FileLogger.LogErrorLevelFile.ListGroupsXMLFile;
                Summa.ErrorStrDetail = doc.DocumentElement.Attributes["id"].Name;

                FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.Categories, SummaCommon.GetStoreId(doc));

                XmlNodeList groups = null;

                groups = doc.DocumentElement.SelectNodes("/CategoryGroups/Group");

                int counter = 0;
                foreach (XmlNode groupNode in groups)
                {
                    csvData.Add(new List <string>());

                    csvData[counter].Add(SummaGroupsCommon.GetGroupId(groupNode));
                    csvData[counter].Add(SummaGroupsCommon.GetGroupName(groupNode));
                    csvData[counter].Add(SummaGroupsCommon.GetStoreId(doc));

                    counter++;
                    csvLineData.Add(new StringBuilder());

/*
 *                  if ((counter == 1) || (counter > groups.Count))
 *                  {
 *                      csvLineData.Add(new StringBuilder());
 *                  }
 *                  else
 *                  {
 *                      csvLineData.Add(new StringBuilder(","));
 *                  }
 */
                }
            }
            catch (Exception e) {
                SummaException se = new SummaException("Problem processing groups", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }
Пример #30
0
        public override void SetupData(XmlDocument doc)
        {
            XmlNodeList customers = null;

            try
            {
                Summa.ErrorLevelFile = FileLogger.LogErrorLevelFile.UpdateMemberXMLFile;
                Summa.ErrorStrDetail = doc.DocumentElement.Attributes["id"].Name;

                FULLFILEPATH += SummaFileName.GetName(SummaFileName.SummaFileType.Customers, SummaCommon.GetStoreId(doc));

                customers = doc.DocumentElement.SelectNodes("/UpdateMember/Member");

                int counter = 0;
                foreach (XmlNode customerNode in customers)
                {
                    csvData.Add(new List <string>());

                    csvData[counter].Add(GetCustomerId(customerNode));

                    //string id = GetCustomerId(customerNode);
                    //CheckCustomerID.Check(id);
                    //csvData[counter].Add(id);

                    csvData[counter].Add(GetCustomerTitle(customerNode));
                    csvData[counter].Add(GetFirstName(customerNode));
                    csvData[counter].Add(GetMiddleName(customerNode));
                    csvData[counter].Add(GetLastName(customerNode));
                    csvData[counter].Add(GetNickName(customerNode));
                    csvData[counter].Add(GetGender(customerNode));
                    csvData[counter].Add(GetCustomerDOB(customerNode));
                    csvData[counter].Add(GetEnrolmentDate(customerNode));
                    csvData[counter].Add(GetCustomerCode(customerNode));
                    csvData[counter].Add(GetExternalCustomerId(customerNode));
                    csvData[counter].Add(GetActiveStatus(customerNode));
                    csvData[counter].Add(GetAddress1(customerNode));
                    csvData[counter].Add(GetAddress2(customerNode));
                    csvData[counter].Add(GetSuburb(customerNode));
                    csvData[counter].Add(GetCity(customerNode));
                    csvData[counter].Add(GetState(customerNode));
                    csvData[counter].Add(GetCountry(customerNode));
                    csvData[counter].Add(GetPostalAddress1(customerNode));
                    csvData[counter].Add(GetPostalAddress2(customerNode));
                    csvData[counter].Add(GetPostalAddressSuburb(customerNode));
                    csvData[counter].Add(GetPostalAddressCity(customerNode));
                    csvData[counter].Add(GetPostalAddressState(customerNode));
                    csvData[counter].Add(GetPostalAddressCountry(customerNode));
                    csvData[counter].Add(PostalCode(customerNode));
                    csvData[counter].Add(GetPhoneMobile(customerNode));
                    csvData[counter].Add(GetPhoneWork(customerNode));
                    csvData[counter].Add(GetPhoneHome(customerNode));
                    csvData[counter].Add(GetFax(customerNode));
                    csvData[counter].Add(GetEmail(customerNode));
                    csvData[counter].Add(GetBankAccount1(customerNode));
                    csvData[counter].Add(GetBankAccount2(customerNode));
                    csvData[counter].Add(GetBankAccount3(customerNode));
                    csvData[counter].Add(GetBankAccount4(customerNode));
                    csvData[counter].Add(GetWebsite(customerNode));
                    csvData[counter].Add(GetCompany(customerNode));
                    csvData[counter].Add(GetJobTitle(customerNode));
                    csvData[counter].Add(GetEthnicityId(customerNode));
                    csvData[counter].Add(GetMarriedStatus(customerNode));
                    csvData[counter].Add(GetNumberOfChildren(customerNode));
                    csvData[counter].Add(GetRankingId(customerNode));
                    csvData[counter].Add(GetIncomeId(customerNode));
                    csvData[counter].Add(GetOccupationId(customerNode));
                    csvData[counter].Add(GetCustomerGroupId(customerNode));
                    csvData[counter].Add(GetCurrentBalance(customerNode));
                    csvData[counter].Add(GetRewardBalance(customerNode));
                    csvData[counter].Add(GetGiftBalance(customerNode));
                    csvData[counter].Add(GetVoucherBalance(customerNode));
                    csvData[counter].Add(GetLogin(customerNode));
                    csvData[counter].Add(GetPassword(customerNode));
                    csvData[counter].Add(GetLastModified(customerNode));
                    csvData[counter].Add(GetIPAddress(customerNode));
                    csvData[counter].Add(GetExtra1(customerNode));
                    csvData[counter].Add(GetExtra2(customerNode));
                    csvData[counter].Add(GetExtra3(customerNode));
                    csvData[counter].Add(GetExtra4(customerNode));
                    csvData[counter].Add(GetExtra5(customerNode));
                    csvData[counter].Add(GetExtra6(customerNode));
                    csvData[counter].Add(GetExtra7(customerNode));
                    csvData[counter].Add(GetExtra8(customerNode));
                    csvData[counter].Add(GetExtra9(customerNode));
                    csvData[counter].Add(GetExtra10(customerNode));
                    csvData[counter].Add(GetComments(customerNode));
                    csvData[counter].Add(GetCardId(customerNode));
                    csvData[counter].Add(GetCardExpiryDate(customerNode));
                    csvData[counter].Add(GetCardActiveStatus(customerNode));
                    csvData[counter].Add(GetCardPrintStatus(customerNode));

                    csvData[counter].Add(GetStoreId(doc.DocumentElement));
                    //csvData[counter].Add(GetStoreId(customerNode));

                    counter++;
                    csvLineData.Add(new StringBuilder());

/*
 *                  if ((counter == 1) || (counter > customers.Count))
 *                  {
 *                      csvLineData.Add(new StringBuilder());
 *                  }
 *                  else
 *                  {
 *                      csvLineData.Add(new StringBuilder(","));
 *                  }
 */
                }
            }
            catch (Exception e)
            {
                SummaException se = new SummaException("Problem processing customer", e);
                se.Data = doc.OuterXml;
                throw se;
            }
        }