예제 #1
0
        private void Executar()
        {
            try
            {
                SairTime();

                System.Net.IPAddress[] ip = Dns.GetHostAddresses(Dns.GetHostName());
                string      xmlUrl        = "http://192.168.10.27/sistema/app/a3_ws/ws.php?xip=" + ip[1].ToString();
                XmlDocument oXML          = new XmlDocument();
                oXML.Load(xmlUrl);

                string ACAO            = null;
                string CAMINHO         = null;
                string CAMINHOASSINADO = null;

                ACAO            = oXML.SelectSingleNode("a3").ChildNodes[0].InnerText;
                CAMINHO         = oXML.SelectSingleNode("a3").ChildNodes[1].InnerText;
                CAMINHOASSINADO = oXML.SelectSingleNode("a3").ChildNodes[2].InnerText;

                if (ACAO == "1")
                {
                    var assinante = new Assinante();
                    assinante.Assinar(@"\\192.168.10.27\a3\nao_assinado\" + CAMINHO, @"\\192.168.10.27\a3\assinado\" + CAMINHOASSINADO);
                    File.Delete(@"\\192.168.10.27\a3\nao_assinado\" + CAMINHO);
                    MessageBox.Show("Documento Assinado com suceso!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                ChamaTime();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Erro do sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ChamaTime();
            }
        }
예제 #2
0
        private void Executar()
        {
            SairTime();
            try
            {
                System.Net.IPAddress[] ip = Dns.GetHostAddresses(Dns.GetHostName());
                string      xmlUrl        = "http://192.168.10.27/sistema/app/a3_ws/ws.php?xip=" + ip[1].ToString();
                XmlDocument oXML          = new XmlDocument();
                oXML.Load(xmlUrl);

                string ACAO            = null;
                string CAMINHO         = null;
                string CAMINHOASSINADO = null;
                string CODIGO          = null;

                ACAO            = oXML.SelectSingleNode("a3").ChildNodes[0].InnerText;
                CAMINHO         = oXML.SelectSingleNode("a3").ChildNodes[1].InnerText;
                CAMINHOASSINADO = oXML.SelectSingleNode("a3").ChildNodes[2].InnerText;
                CODIGO          = oXML.SelectSingleNode("a3").ChildNodes[3].InnerText;

                if (ACAO == "1")
                {
                    string url_caminho = "http://192.168.10.27/sistema/app/a3_ws/ws_assinou.php?nCodigo=" + CODIGO;
                    Uri    uri         = new Uri(url_caminho);

                    WebClient wc = new WebClient();
                    wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
                    wc.Encoding = Encoding.UTF8;
                    wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wc_UploadStringCompleted);
                    wc.UploadStringAsync(uri, "POST", url_caminho.ToString());

                    var assinante = new Assinante();
                    assinante.Assinar(@"R:\nao_assinado\" + CAMINHO, @"R:\assinado\" + CAMINHOASSINADO);
                    File.Delete(@"R:\nao_assinado\" + CAMINHO);
                }
                ChamaTime();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Erro do sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ChamaTime();
            }
        }