示例#1
0
        public static void BarcodestoreImport(string fileName)
        {
            StreamReader source;
            XmlDocument  document;
            XmlNodeList  analyses;

            source   = new StreamReader(fileName, Encoding.UTF8);
            document = new XmlDocument();
            document.Load(source);

            analyses = document.GetElementsByTagName("Analyse");

            XmlSerializer deserializer = new XmlSerializer(typeof(DAO.Barcodestore));
            TextReader    reader       = new StreamReader(fileName);
            object        obj          = deserializer.Deserialize(reader);

            DAO.Barcodestore bcs = (DAO.Barcodestore)obj;
            reader.Close();

            foreach (DAO.Analyse analyse in bcs.Analyses)
            {
                ORM.Barcodestore.Save(analyse);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            string workingFolder = "C:\\ParserIO\\";
            string dateTime      = DateTime.Now.ToString("yyyymmddhhmmss");

            string masterFileName = workingFolder + "Barcodestore_master_20160926155425.xml";
            string sourceFileName = workingFolder + "Barcodestore_dll_20165426035448.xml";

            string outputFileName = workingFolder + "BenchmarkCompare_" + dateTime + ".txt";

            DAO.Barcodestore result = new DAO.Barcodestore();

            XmlSerializer deserializer = new XmlSerializer(typeof(DAO.Barcodestore));
            TextReader    reader       = new StreamReader(masterFileName);
            object        obj          = deserializer.Deserialize(reader);

            DAO.Barcodestore bcs = (DAO.Barcodestore)obj;
            reader.Close();

            reader = new StreamReader(sourceFileName);
            obj    = deserializer.Deserialize(reader);
            DAO.Barcodestore toCompare = (DAO.Barcodestore)obj;
            reader.Close();

            StreamWriter writetext = new StreamWriter(outputFileName);

            writetext.WriteLine("ParserIO.Benchmark.Compare");
            writetext.WriteLine(DateTime.Now.ToString());
            writetext.WriteLine(masterFileName);
            writetext.WriteLine(sourceFileName);
            writetext.WriteLine("Id" + "\t" + "Property" + "\t" + "MasterValue" + "\t" + "CheckedValue");

            int analysesVarianceCount = 0;

            foreach (DAO.Analyse masterItem in bcs.Analyses)
            {
                int analyseIdMaster = masterItem.AnalyseId;

                DAO.Analyse toCompareAnalyse = (from x in toCompare.Analyses
                                                where x.AnalyseId == analyseIdMaster
                                                select x).FirstOrDefault();

                List <Variance> varianceList = new List <Variance>();

                varianceList = Common.DetailedCompare(masterItem.InformationSet, toCompareAnalyse.InformationSet, analyseIdMaster);


                if (varianceList.Count != 0)
                {
                    analysesVarianceCount++;
                    foreach (Variance var in varianceList)
                    {
                        writetext.WriteLine(var.analyseId.ToString() + "\t" + analyseIdMaster.ToString() + "\t" + var.propertyName + "\t" + var.masterValue + "\t" + var.checkedValue);
                    }
                    writetext.WriteLine("");
                }
            }

            writetext.WriteLine("MasterFile Quantity Analyses : " + bcs.Analyses.Count.ToString());
            writetext.WriteLine("Variance Quantity Analyses : " + analysesVarianceCount.ToString());
            writetext.WriteLine("End");
            writetext.Flush();
        }
示例#3
0
        static void Main(string[] args)
        {
            Provider value          = Provider.dll;
            string   workingFolder  = "C:\\ParserIO\\";
            string   sourceFileName = workingFolder + "Barcodestore_master_20160926155425.xml";

            string outputFileName = workingFolder + "Barcodestore_" + value + "_" + DateTime.Now.ToString("yyyymmddhhmmss") + ".xml";

            StreamReader source;
            XmlDocument  document;
            XmlNodeList  analyses;

            source   = new StreamReader(sourceFileName, Encoding.UTF8);
            document = new XmlDocument();
            document.Load(source);

            DAO.Barcodestore bcs = new DAO.Barcodestore();
            bcs.Version      = DateTime.Now.ToString("yyyymmddhhmm");
            bcs.ProviderName = value.ToString();
            bcs.Analyses     = new List <DAO.Analyse>();

            analyses = document.GetElementsByTagName("Analyse");

            foreach (XmlElement sourceAnalyse in analyses)
            {
                DAO.Analyse        x             = new DAO.Analyse();
                DAO.InformationSet targetAnalyse = new DAO.InformationSet();
                x.AnalyseId  = Convert.ToInt32(sourceAnalyse.GetElementsByTagName("AnalyseId")[0].InnerText);
                x.TimeStamp  = Convert.ToDateTime(sourceAnalyse.GetElementsByTagName("TimeStamp")[0].InnerText);
                x.Barcode    = sourceAnalyse.GetElementsByTagName("Barcode")[0].InnerText;
                x.Commentary = sourceAnalyse.GetElementsByTagName("Commentary")[0].InnerText;

                if (value == Provider.dll)
                {
                    Core.Functions client = new Core.Functions();
                    targetAnalyse = client.GetFullInformationSet(x.Barcode);
                }
                else if (value == Provider.ws)
                {
                    //todo
                }
                else if (value == Provider.wcf)
                {
                    //todo
                }
                else if (value == Provider.webapi)
                {
                    targetAnalyse = Tools.Common.Wrapper(x.Barcode);
                }
                else if (value == Provider.fdagudid)
                {
                    //todo
                }

                x.InformationSet.Type                   = targetAnalyse.Type;
                x.InformationSet.SubType                = targetAnalyse.SubType;
                x.InformationSet.executeResult          = targetAnalyse.executeResult;
                x.InformationSet.ACL                    = targetAnalyse.ACL;
                x.InformationSet.ADDITIONALID           = targetAnalyse.ADDITIONALID;
                x.InformationSet.BESTBEFORE             = targetAnalyse.BESTBEFORE;
                x.InformationSet.CIP                    = targetAnalyse.CIP;
                x.InformationSet.Company                = targetAnalyse.Company;
                x.InformationSet.ContainsOrMayContainId = targetAnalyse.ContainsOrMayContainId;
                x.InformationSet.CONTENT                = targetAnalyse.CONTENT;
                x.InformationSet.COUNT                  = targetAnalyse.COUNT;
                x.InformationSet.EAN                    = targetAnalyse.EAN;
                x.InformationSet.Expiry                 = targetAnalyse.Expiry;
                x.InformationSet.Family                 = targetAnalyse.Family;
                x.InformationSet.GTIN                   = targetAnalyse.GTIN;
                x.InformationSet.INTERNAL_91            = targetAnalyse.INTERNAL_91;
                x.InformationSet.INTERNAL_92            = targetAnalyse.INTERNAL_92;
                x.InformationSet.INTERNAL_93            = targetAnalyse.INTERNAL_93;
                x.InformationSet.INTERNAL_94            = targetAnalyse.INTERNAL_94;
                x.InformationSet.INTERNAL_95            = targetAnalyse.INTERNAL_95;
                x.InformationSet.INTERNAL_96            = targetAnalyse.INTERNAL_96;
                x.InformationSet.INTERNAL_97            = targetAnalyse.INTERNAL_97;
                x.InformationSet.INTERNAL_98            = targetAnalyse.INTERNAL_98;
                x.InformationSet.INTERNAL_99            = targetAnalyse.INTERNAL_99;
                x.InformationSet.LIC                    = targetAnalyse.LIC;
                x.InformationSet.Lot                    = targetAnalyse.Lot;
                x.InformationSet.LPP                    = targetAnalyse.LPP;
                x.InformationSet.NaS7                   = targetAnalyse.NaS7;
                x.InformationSet.NaSIdParamName         = targetAnalyse.NaSIdParamName;
                x.InformationSet.NormalizedBESTBEFORE   = targetAnalyse.NormalizedBESTBEFORE;
                x.InformationSet.NormalizedExpiry       = targetAnalyse.NormalizedExpiry;
                x.InformationSet.NormalizedPRODDATE     = targetAnalyse.NormalizedPRODDATE;
                x.InformationSet.PCN                    = targetAnalyse.PCN;
                x.InformationSet.PRODDATE               = targetAnalyse.PRODDATE;
                x.InformationSet.Product                = targetAnalyse.Product;
                x.InformationSet.Quantity               = targetAnalyse.Quantity;
                x.InformationSet.Reference              = targetAnalyse.Reference;
                x.InformationSet.Serial                 = targetAnalyse.Serial;
                x.InformationSet.SSCC                   = targetAnalyse.SSCC;
                x.InformationSet.SymbologyID            = targetAnalyse.SymbologyID;
                x.InformationSet.UDI                    = targetAnalyse.UDI;
                x.InformationSet.UoM                    = targetAnalyse.UoM;
                x.InformationSet.UPN                    = targetAnalyse.UPN;
                x.InformationSet.VARCOUNT               = targetAnalyse.VARCOUNT;
                x.InformationSet.VARIANT                = targetAnalyse.VARIANT;
                x.InformationSet.AdditionalInformation  = targetAnalyse.AdditionalInformation;

                bcs.Analyses.Add(x);
                Console.WriteLine(x.AnalyseId);
            }


            using (StreamWriter myWriter = new StreamWriter(outputFileName, false))
            {
                XmlSerializer mySerializer = new XmlSerializer(typeof(DAO.Barcodestore), new XmlRootAttribute("Barcodestore"));
                mySerializer.Serialize(myWriter, bcs);
            }
        }