コード例 #1
0
        public string isCpfSenhaAceitos(string xml)
        {
            if (string.IsNullOrEmpty(xml))
            {
                return("N");
            }

            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(PeopleModel));

                var people = new PeopleModel();
                using (TextReader reader = new StringReader(xml))
                {
                    people = (PeopleModel)serializer.Deserialize(reader);
                }

                using (var file =
                           new StreamWriter(@"C:\cobol\bin\input\operation.data"))
                {
                    file.Write(Parametros.API_SERVICO_USUARIO_VALIDACAO);
                    file.Flush();
                }

                using (var file =
                           new StreamWriter(@"C:\cobol\bin\input\cpfexists.data"))
                {
                    file.Write(people.cpf);
                    file.Flush();
                }

                using (var file =
                           new StreamWriter(@"C:\cobol\bin\output\cpfexists.data"))
                {
                    file.Write("");
                    file.Flush();
                }
                var start = Process.Start(@"C:\cobol\bin\SystemBank.bat");
                start.WaitForExit();

                var ret = "";

                using (var file =
                           new StreamReader(@"C:\cobol\bin\output\cpfexists.data"))
                {
                    ret = file.ReadLine();
                }

                return(ret.Equals("1") ? "S" : "N");
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }
コード例 #2
0
        public string cadastrarCliente(string xml)
        {
            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(PeopleModel));

                var people = new PeopleModel();
                using (TextReader reader = new StringReader(xml))
                {
                    people = (PeopleModel)serializer.Deserialize(reader);
                }

                using (var file =
                           new StreamWriter(@"C:\cobol\bin\input\operation.data"))
                {
                    file.Write(Parametros.API_SERVICO_CLIENTE_CADASTRO);
                    file.Flush();
                }

                using (var file =
                           new StreamWriter(@"C:\cobol\bin\input\people.data"))
                {
                    file.Write(people.ToString());
                    file.Flush();
                }

                using (var file =
                           new StreamWriter(@"C:\cobol\bin\output\people.data"))
                {
                    file.Write("");
                    file.Flush();
                }

                var start = Process.Start(@"C:\cobol\bin\SystemBank.bat");
                start.WaitForExit();

                var ret = "";
                using (var file =
                           new StreamReader(@"C:\cobol\bin\output\people.data"))
                {
                    ret = file.ReadLine();
                }

                return(ret.Equals("1") ? "S" : "N");
            }
            catch (Exception e)
            {
                return("N");
            }
        }
コード例 #3
0
        public string isCpfSenhaAceitos(string xml)
        {
            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(PeopleModel));

                var people = new PeopleModel();
                using (TextReader reader = new StringReader(xml))
                {
                    people = (PeopleModel)serializer.Deserialize(reader);
                }
                var start = Process.Start(@"C:\cobol\bin\SystemBank.bat");
                start.WaitForExit();

                return(null);
            }catch (Exception e)
            {
                return("N");
            }
        }