private Boolean ExcelWriteRequiredReleasenotes(string fileName, string oid, string xmlFileDir, IEnumerable releaseNoteReqEnumerable)
        {
            Boolean WrongFormatItems = false;

            foreach (string required in releaseNoteReqEnumerable)
            {
                Dictionary <CReleaseNoteAsset, Dictionary <int, string> > refinedReleaseNotes = GetRefinedReleaseNotesDictionary(oid);
                var extractedXmlIdentifierCollection = new ExtractXML().ExtractXMLFile(xmlFileDir);

                ExcelWriter excel = new ExcelWriter(refinedReleaseNotes, extractedXmlIdentifierCollection);
                if (required.Equals("Yes"))
                {
                    WrongFormatItems = (WriteRequiredExcelReleaseNotes(fileName + " Yes", true, excel) || WrongFormatItems);
                }
                if (required.Equals("YesCmd"))
                {
                    excel.setCmdHide(true);
                    WriteRequiredExcelReleaseNotes(fileName, true, excel);
                }
                else if (required.Equals("No"))
                {
                    WrongFormatItems = (WriteRequiredExcelReleaseNotes(fileName + " No", false, excel) || WrongFormatItems);
                }
                else if (required.Equals("AssetsWithNull"))
                {
                    WrongFormatItems = (WriteRequiredExcelReleaseNotes(fileName + " WithNull", null, excel) || WrongFormatItems);
                }
            }
            return(WrongFormatItems);
        }
Beispiel #2
0
        public void TestMethod1()
        {
            string xmlValido = @"<?xml version=""1.0"" encoding=""UTF - 8""?>
  <InputDocument>
      <DeclarationList>
        <Declaration Command = ""DEFAULT"" Version = ""5.13"" />
              <DeclarationHeader>
                <Jurisdiction> IE </Jurisdiction>
                <CWProcedure> IMPORT </CWProcedure>
                <DeclarationDestination> CUSTOMSWAREIE </DeclarationDestination>
                <DocumentRef> 71Q0019681 </DocumentRef>
                      <SiteID> DUB </SiteID>
                      <AccountCode> G0779837 </AccountCode>
                      <Reference RefCode = ""MWB"">
                          <RefText> 586133622 </RefText>
                        </Reference>
                        <Reference RefCode = ""KEY"">
                            <RefText> DUB16049 </RefText>
                          </Reference>
                          <Reference RefCode = ""CAR"">
                              <RefText> 71Q0019681 </RefText>
                                  </Reference>
                                  <Reference RefCode = ""COM"">
                                      <RefText> 71Q0019681 </RefText>
                                         </Reference>
                                         <Reference RefCode = ""SRC"">
                                            <RefText> ECUS </RefText>
                         </Reference>
                         <Reference RefCode = ""TRV"">
                            <RefText> 1 </RefText>
                          </Reference>
                          <Reference RefCode = ""CAS"">
                             <RefText> 586133622 </RefText>
                           </Reference>
                           <Reference RefCode = ""HWB"">
                              <RefText> 586133622 </RefText>
                            </Reference>
                            <Reference RefCode = ""UCR"">
                               <RefText> 586133622 </RefText>
                             </Reference>
                             <Country CodeType = ""NUM"" CountryType = ""Destination""> IE </Country>
                                <Country CodeType = ""NUM"" CountryType = ""Dispatch""> CN </Country>
                                 </DeclarationHeader>
                               </DeclarationList>
                             </InputDocument>";

            List <string> itensToBeListed = new List <string> {
                "MWB", "TRV", "CAR"
            };



            var result = ExtractXML.LoadFromString(xmlValido, "Reference", "RefCode", itensToBeListed);
        }
Beispiel #3
0
        internal void run()
        {
            //question 02


            var ediREsultList = EdiParser.loadFromString(util._edifactString);

            string[][] result = ediREsultList.Select(list => list.DataElements.Split(new char[] { '&' })).ToArray();
            Console.WriteLine("---------------------------------------------------------- ");
            Console.WriteLine("Question 1  ");
            Console.WriteLine("---------------------------------------------------------- ");
            foreach (var item in result)
            {
                Console.WriteLine("{" + item[0].ToString() + "," + item[1].ToString() + "}"); // Assumes a console application
            }


            Console.WriteLine(" ");
            Console.WriteLine("---------------------------------------------------------- ");
            List <string> itensToBeListed = new List <string> {
                "MWB", "TRV", "CAR"
            };

            Console.WriteLine("Question 2 ");
            Console.WriteLine("---------------------------------------------------------- ");

            string path = Path.GetFullPath("../../../ABM/XML/Question2.xml");

            var resultQuestion2 = ExtractXML.LoadFromString(path, "Reference", "RefCode", itensToBeListed);

            foreach (var it in resultQuestion2)
            {
                Console.WriteLine("{" + it.Identifier + "," + it.value + "}");
            }


            Console.WriteLine(" ");
            Console.WriteLine("Question 3 ");
            Console.WriteLine("---------------------------------------------------------- ");

            string path3   = Path.GetFullPath("../../../ABM/XML/Question3.xml");
            string pathxsd = Path.GetFullPath("../../../ABM/XML/Question3.xsd");

            //     var b = XmlValidatorToXSD.load(path3);
            ServiceReference1.IService1 obj = new ServiceReference1.Service1Client();
            int resultQuestion3             = obj.ValidationXml(path3, pathxsd);

            Console.WriteLine("{" + resultQuestion3 + "}");  // Assumes a console application

            Console.ReadLine();
        }
        public bool WriteReport(string fileName, string oid, string xmlFileDir, IEnumerable fileTypesEnumerator, IEnumerable releaseNoteReqEnumerable = null)
        {
            Boolean WrongFormatItemsOrReportFailure = true;

            foreach (string fileType in fileTypesEnumerator)
            {
                if (fileType.Contains("XML"))
                {
                    if (releaseNoteReqEnumerable == null)
                    {
                        Dictionary <CReleaseNoteAsset, Dictionary <int, string> > refinedReleaseNotes = GetRefinedReleaseNotesDictionary(oid);
                        XmlWriter xml = new XmlWriter(refinedReleaseNotes);
                        xml.WriteAllReleaseNotes(fileName);
                    }
                    else
                    {
                        XmlWriteRequiredReleasenotes(fileName, oid, releaseNoteReqEnumerable);
                    }
                }
                else if (fileType.Contains("EXCEL"))
                {
                    if (releaseNoteReqEnumerable == null)
                    {
                        Dictionary <CReleaseNoteAsset, Dictionary <int, string> > refinedReleaseNotes = GetRefinedReleaseNotesDictionary(oid);
                        Dictionary <int, Dictionary <int, string> > extractedXmlIdentifierCollection  = new ExtractXML().ExtractXMLFile(xmlFileDir);

                        ExcelWriter excel = new ExcelWriter(refinedReleaseNotes, extractedXmlIdentifierCollection);
                        excel.WriteAllReleaseNotes(fileName);
                    }
                    else
                    {
                        WrongFormatItemsOrReportFailure = ExcelWriteRequiredReleasenotes(fileName, oid, xmlFileDir, releaseNoteReqEnumerable);
                    }
                }
            }
            return(WrongFormatItemsOrReportFailure);
        }
Beispiel #5
0
        public void PracticeXmlDiagramCorrectOutput()
        {
            Dictionary <int, Dictionary <int, string> > expectedDictionary = new Dictionary <int, Dictionary <int, string> >
            {
                { 1, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "tom" }, { 3, "chipotle" }, { 4, "cheese" }
                  } },
                { 2, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "tom" }, { 3, "chipotle" }, { 4, "meat" }
                  } },
                { 3, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "tom" }, { 3, "mission burrito" }, { 4, "cheese" }
                  } },
                { 4, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "tom" }, { 3, "mission burrito" }, { 4, "meat" }
                  } },
                { 5, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "tom" }, { 3, "uburrito" }, { 4, "cheese" }
                  } },
                { 6, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "tom" }, { 3, "uburrito" }, { 4, "meat" }
                  } },
                { 7, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "jerry" }, { 3, "chipotle" }, { 4, "cheese" }
                  } },
                { 8, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "jerry" }, { 3, "chipotle" }, { 4, "meat" }
                  } },
                { 9, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "jerry" }, { 3, "mission burrito" }, { 4, "cheese" }
                  } },
                { 10, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "jerry" }, { 3, "mission burrito" }, { 4, "meat" }
                  } },
                { 11, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "jerry" }, { 3, "uburrito" }, { 4, "cheese" }
                  } },
                { 12, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "jerry" }, { 3, "uburrito" }, { 4, "meat" }
                  } },
                { 13, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "john" }, { 3, "chipotle" }, { 4, "cheese" }
                  } },
                { 14, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "john" }, { 3, "chipotle" }, { 4, "meat" }
                  } },
                { 15, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "john" }, { 3, "mission burrito" }, { 4, "cheese" }
                  } },
                { 16, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "john" }, { 3, "mission burrito" }, { 4, "meat" }
                  } },
                { 17, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "john" }, { 3, "uburrito" }, { 4, "cheese" }
                  } },
                { 18, new Dictionary <int, string> {
                      { 1, "hello" }, { 2, "john" }, { 3, "uburrito" }, { 4, "meat" }
                  } },
                { 19, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "tom" }, { 3, "chipotle" }, { 4, "cheese" }
                  } },
                { 20, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "tom" }, { 3, "chipotle" }, { 4, "meat" }
                  } },
                { 21, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "tom" }, { 3, "mission burrito" }, { 4, "cheese" }
                  } },
                { 22, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "tom" }, { 3, "mission burrito" }, { 4, "meat" }
                  } },
                { 23, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "tom" }, { 3, "uburrito" }, { 4, "cheese" }
                  } },
                { 24, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "tom" }, { 3, "uburrito" }, { 4, "meat" }
                  } },
                { 25, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "jerry" }, { 3, "chipotle" }, { 4, "cheese" }
                  } },
                { 26, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "jerry" }, { 3, "chipotle" }, { 4, "meat" }
                  } },
                { 27, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "jerry" }, { 3, "mission burrito" }, { 4, "cheese" }
                  } },
                { 28, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "jerry" }, { 3, "mission burrito" }, { 4, "meat" }
                  } },
                { 29, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "jerry" }, { 3, "uburrito" }, { 4, "cheese" }
                  } },
                { 30, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "jerry" }, { 3, "uburrito" }, { 4, "meat" }
                  } },
                { 31, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "john" }, { 3, "chipotle" }, { 4, "cheese" }
                  } },
                { 32, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "john" }, { 3, "chipotle" }, { 4, "meat" }
                  } },
                { 33, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "john" }, { 3, "mission burrito" }, { 4, "cheese" }
                  } },
                { 34, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "john" }, { 3, "mission burrito" }, { 4, "meat" }
                  } },
                { 35, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "john" }, { 3, "uburrito" }, { 4, "cheese" }
                  } },
                { 36, new Dictionary <int, string> {
                      { 1, "hey" }, { 2, "john" }, { 3, "uburrito" }, { 4, "meat" }
                  } },
            };

            Dictionary <int, Dictionary <int, string> > actualDictionary = new ExtractXML().ExtractXMLFile(@"XMLFile1.xml");

            Assert.AreEqual(true, AreEqual(actualDictionary, expectedDictionary));
        }