コード例 #1
0
ファイル: Program.cs プロジェクト: swatsm1/Questions
        private static List <Refcode> processFile(string v)
        {
            string stringfile = File.ReadAllText(v);

            XmlSerializer InDoc = new XmlSerializer(typeof(InputDocument));

            TextReader myreader = new StringReader(stringfile);
            string     myxml    = myreader.ReadToEnd();

            InputDocument inputDoc = new InputDocument();
            TextReader    myReader = new StringReader(myxml);

            inputDoc = (InputDocument)InDoc.Deserialize(myReader);

            InputDocumentDeclarationListDeclaration references = inputDoc.DeclarationList.Declaration;
            InputDocumentDeclarationListDeclarationDeclarationHeader DeclarationHeader = references.DeclarationHeader;

            var listofRefs = new List <Refcode>();

            foreach (InputDocumentDeclarationListDeclarationDeclarationHeaderReference reference in DeclarationHeader.Reference)
            {
                if (reference.RefCode == "MWB" || reference.RefCode == "TRV" || reference.RefCode == "CAR")
                {
                    var refs = new Refcode();

                    refs.refcode = reference.RefCode;

                    listofRefs.Add(refs);
                }
            }

            return(listofRefs);
        }
コード例 #2
0
ファイル: WebService.ashx.cs プロジェクト: swatsm1/Questions
        private WebServiceReponse processFile(string strXml)
        {
            //string stringfile = File.ReadAllText(strXml);

            XmlSerializer InDoc = new XmlSerializer(typeof(InputDocument));

            TextReader myreader = new StringReader(strXml);
            string     myxml    = myreader.ReadToEnd();

            InputDocument inputDoc = new InputDocument();
            TextReader    myReader = new StringReader(myxml);

            inputDoc = (InputDocument)InDoc.Deserialize(myReader);

            InputDocumentDeclarationListDeclaration references = inputDoc.DeclarationList.Declaration;
            InputDocumentDeclarationListDeclarationDeclarationHeader DeclarationHeader = references.DeclarationHeader;

            WebServiceReponse R = new WebServiceReponse();

            if (DeclarationHeader.SiteID != "DUB")
            {
                R.Status = -2;
                R.Reason = "– invalid Site specified";
            }

            else if (references.Command != "DEFAULT")
            {
                R.Status = -1;
                R.Reason = "1’ – which means invalid command specified.";
            }

            else
            {
                R.Status = 0;
                R.Reason = "SUCCESS";
            }

            return(R);
        }