public override void EndElement(string uri, string name, string qName)
        {
            string str = XMLUtils.UnmangleXmlString(cbuf.ToString(), false).Trim();

            cbuf = new StringBuilder();
            switch (state)
            {
            case OfflineEditsXmlLoader.ParseState.ExpectEditsTag:
            {
                throw new XMLUtils.InvalidXmlException("expected <EDITS/>");
            }

            case OfflineEditsXmlLoader.ParseState.ExpectVersion:
            {
                if (!name.Equals("EDITS_VERSION"))
                {
                    throw new XMLUtils.InvalidXmlException("expected </EDITS_VERSION>");
                }
                try
                {
                    int version = System.Convert.ToInt32(str);
                    visitor.Start(version);
                }
                catch (IOException e)
                {
                    // Can't throw IOException from a SAX method, sigh.
                    throw new RuntimeException(e);
                }
                state = OfflineEditsXmlLoader.ParseState.ExpectRecord;
                break;
            }

            case OfflineEditsXmlLoader.ParseState.ExpectRecord:
            {
                if (name.Equals("EDITS"))
                {
                    state = OfflineEditsXmlLoader.ParseState.ExpectEnd;
                }
                else
                {
                    if (!name.Equals("RECORD"))
                    {
                        throw new XMLUtils.InvalidXmlException("expected </EDITS> or </RECORD>");
                    }
                }
                break;
            }

            case OfflineEditsXmlLoader.ParseState.ExpectOpcode:
            {
                if (!name.Equals("OPCODE"))
                {
                    throw new XMLUtils.InvalidXmlException("expected </OPCODE>");
                }
                opCode = FSEditLogOpCodes.ValueOf(str);
                state  = OfflineEditsXmlLoader.ParseState.ExpectData;
                break;
            }

            case OfflineEditsXmlLoader.ParseState.ExpectData:
            {
                throw new XMLUtils.InvalidXmlException("expected <DATA/>");
            }

            case OfflineEditsXmlLoader.ParseState.HandleData:
            {
                stanza.SetValue(str);
                if (stanzaStack.Empty())
                {
                    if (!name.Equals("DATA"))
                    {
                        throw new XMLUtils.InvalidXmlException("expected </DATA>");
                    }
                    state = OfflineEditsXmlLoader.ParseState.ExpectRecord;
                    FSEditLogOp op = opCache.Get(opCode);
                    opCode = null;
                    try
                    {
                        op.DecodeXml(stanza);
                        stanza = null;
                    }
                    finally
                    {
                        if (stanza != null)
                        {
                            System.Console.Error.WriteLine("fromXml error decoding opcode " + opCode + "\n" +
                                                           stanza.ToString());
                            stanza = null;
                        }
                    }
                    if (fixTxIds)
                    {
                        if (nextTxId <= 0)
                        {
                            nextTxId = op.GetTransactionId();
                            if (nextTxId <= 0)
                            {
                                nextTxId = 1;
                            }
                        }
                        op.SetTransactionId(nextTxId);
                        nextTxId++;
                    }
                    try
                    {
                        visitor.VisitOp(op);
                    }
                    catch (IOException e)
                    {
                        // Can't throw IOException from a SAX method, sigh.
                        throw new RuntimeException(e);
                    }
                    state = OfflineEditsXmlLoader.ParseState.ExpectRecord;
                }
                else
                {
                    stanza = stanzaStack.Pop();
                }
                break;
            }

            case OfflineEditsXmlLoader.ParseState.ExpectEnd:
            {
                throw new XMLUtils.InvalidXmlException("not expecting anything after </EDITS>");
            }
            }
        }
Exemple #2
0
 public static ITRetConsCad ConsultarCadastro(SoapHttpClientProtocol oServico, ITConsCad oEnviNFe3, Parametro oParam, VersaoXML versao)
 {
     return((ITRetConsCad)XMLUtils.CarregaXML_STR(ExecutaServico(oServico, oEnviNFe3, oParam),
                                                  versao, "TRetConsCad"));
 }
Exemple #3
0
 public static ITRetDownloadNFe DownloadNF(SoapHttpClientProtocol oServico, ITDownloadNFe xmlEnvio, Parametro oParam, VersaoXML versao)
 {
     return((ITRetDownloadNFe)XMLUtils.CarregaXML_STR(ExecutaServico(oServico, xmlEnvio, oParam),
                                                      versao, "TRetDownloadNFe"));
 }
        //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
        #region --Misc Methods (Public)--


        #endregion

        #region --Misc Methods (Private)--


        #endregion

        #region --Misc Methods (Protected)--
        protected bool doesNodeContainPartialList(XmlNode n)
        {
            return(XMLUtils.getChildNode(n, "set", Consts.XML_XMLNS, "http://jabber.org/protocol/rsm") != null);
        }
Exemple #5
0
        public void SaveStateTo(ScriptData script, bool forced, bool saveBackup)
        {
            if (!forced)
            {
                if (script.Script == null)
                {
                    return; //If it didn't compile correctly, this happens
                }
                if (!script.Script.NeedsStateSaved)
                {
                    return; //If it doesn't need a state save, don't save one
                }
            }
            if (script.Script != null)
            {
                script.Script.NeedsStateSaved = false;
            }
            StateSave stateSave = new StateSave
            {
                State           = script.State,
                ItemID          = script.ItemID,
                Running         = script.Running,
                MinEventDelay   = script.EventDelayTicks,
                Disabled        = script.Disabled,
                UserInventoryID = script.UserInventoryItemID,
                AssemblyName    = script.AssemblyName,
                Compiled        = script.Compiled,
                Source          = script.Source == null ? "" : script.Source
            };

            //Allow for the full path to be put down, not just the assembly name itself
            if (script.InventoryItem != null)
            {
                stateSave.PermsGranter = script.InventoryItem.PermsGranter;
                stateSave.PermsMask    = script.InventoryItem.PermsMask;
            }
            else
            {
                stateSave.PermsGranter = UUID.Zero;
                stateSave.PermsMask    = 0;
            }
            stateSave.TargetOmegaWasSet = script.TargetOmegaWasSet;

            //Vars
            Dictionary <string, object> vars = new Dictionary <string, object>();

            if (script.Script != null)
            {
                vars = script.Script.GetStoreVars();
            }
            stateSave.Variables = XMLUtils.BuildXmlResponse(vars);

            //Plugins
            stateSave.Plugins =
                OSDParser.SerializeJsonString(m_module.GetSerializationData(script.ItemID, script.Part.UUID));

            lock (StateSaveLock)
                script.Part.StateSaves[script.ItemID] = stateSave;
            if (saveBackup)
            {
                script.Part.ParentEntity.HasGroupChanged = true;
            }
        }
 /// <summary>
 /// Parses the given HOCR model
 /// </summary>
 /// <param name="path">The path to the file with a model content to parse</param>
 /// <returns></returns>
 public static IEnumerable <TextGeometryModel> ParseHocrResults(string path)
 {
     return(ParseHocrResults(XMLUtils.OpenXMLDocument(path)));
 }
 /// <summary>
 /// Parses the given HOCR model
 /// </summary>
 /// <param name="hocrDataStream">The stream with a HOCR model content</param>
 /// <returns></returns>
 public static IEnumerable <TextGeometryModel> ParseHocrResults(Stream hocrDataStream)
 {
     return(ParseHocrResults(XMLUtils.OpenXMLDocument(hocrDataStream)));
 }
        public static ResultadoAssinatura AssinaXML(String arqxml, String SUri, X509Certificate2 cert, VersaoXML versao)
        {
            var retorno = new ResultadoAssinatura();

            string _stringXml;
            string newArqXml;
            var    stType = string.Empty;

            if (SUri == "infNFe")
            {
                stType    = "TNFe";
                newArqXml = arqxml.Substring(0, arqxml.Length - 51) + "ass" + arqxml.Substring(arqxml.Length - 51, 51);
            }
            else if (SUri == "infCanc")
            {
                stType    = "TCancNFe";
                newArqXml = arqxml.Substring(0, arqxml.Length - 7) + "-ped-can.xml";
            }
            else if (SUri == "infInut")
            {
                stType    = "TInutNFe";
                newArqXml = arqxml.Substring(0, arqxml.Length - 7) + "-ped-inu.xml";
            }
            else if (SUri == "infEvento")
            {
                stType    = "TEvento";
                newArqXml = arqxml.Substring(0, arqxml.Length - 7) + "-ass-env.xml";
            }
            else
            {
                retorno.codigoRetorno = TRetornoAssinatura.RefURiNaoExiste;// 4; //erro refURi
                return(retorno);
            }


            //Verifica se arquivo da nota Existe;
            if (File.Exists(arqxml))
            {
                _stringXml = XMLUtils.GetXML(XMLUtils.CarregaXML_HD(arqxml, versao, stType), versao);

                // realiza assinatura
                AssinaturaDigital AD = new AssinaturaDigital();

                retorno.codigoRetorno = AD.AssinarNFe(_stringXml, SUri, cert);

                //limpar certificado
                cert.Reset();

                //assinatura bem sucedida
                if (retorno.codigoRetorno == TRetornoAssinatura.Assinada)
                {
                    if (File.Exists(newArqXml))
                    {
                        File.Delete(newArqXml);
                    }

                    XMLUtils.SalvaXML(newArqXml, (XMLUtils.CarregaXML_STR(AD.XMLStringAssinado, versao, stType)), versao);
                }
                else
                {
                    retorno.mensagem = AD.mensagemResultado;
                }

                return(retorno); //Retorna o resultado da assinatura
            }
            else
            {
                retorno.codigoRetorno = TRetornoAssinatura.ArquivoNaoEncontrado;// 11;//Arquivo nao encontrado
                return(retorno);
            }
        }
 /// <exception cref="System.IO.IOException"/>
 private void WriteTag(string tag, string value)
 {
     Write("<" + tag + ">" + XMLUtils.MangleXmlString(value, true) + "</" + tag + ">\n"
           );
 }
Exemple #10
0
 //--------------------------------------------------------Constructor:----------------------------------------------------------------\\
 #region --Constructors--
 /// <summary>
 /// Basic Constructor
 /// </summary>
 /// <history>
 /// 20/08/2017 Created [Fabian Sauter]
 /// </history>
 public StreamFeature(XmlNode n)
 {
     NAME      = n.Name;
     NAMESPACE = n.NamespaceURI;
     REQUIRED  = XMLUtils.getChildNode(n, "required") != null;
 }
Exemple #11
0
        public string SendMessage(string to, string subject = "", string body = "", Dictionary <string, byte[]> attachments = null, string cc = "", string bcc = "", bool saveItem = true)
        {
            var type = attachments != null && attachments.Count > 0 ? "SaveOnly" : saveItem ? "SendAndSaveCopy" : "SendOnly";
            var _to  = ""; foreach (var v in to.Split(";"))
            {
                _to += "<t:Mailbox><t:EmailAddress>" + v.Trim() + "</t:EmailAddress></t:Mailbox>";
            }
            var _cc = ""; foreach (var v in cc.Split(";"))
            {
                _cc += "<t:Mailbox><t:EmailAddress>" + v.Trim() + "</t:EmailAddress></t:Mailbox>";
            }
            var _bcc = ""; foreach (var v in bcc.Split(";"))
            {
                _bcc += "<t:Mailbox><t:EmailAddress>" + v.Trim() + "</t:EmailAddress></t:Mailbox>";
            }


            var xml = GetResponse("<m:CreateItem MessageDisposition=\"" + type + "\"><m:SavedItemFolderId><t:DistinguishedFolderId Id=\"sentitems\" /></m:SavedItemFolderId><m:Items>" +
                                  "<t:Message><t:Subject>" + subject + "</t:Subject><t:Body BodyType=\"HTML\">" + XMLUtils.Encode(body) + "</t:Body>" +
                                  "<t:ToRecipients>" + _to + "</t:ToRecipients><t:CcRecipients>" + _cc + "</t:CcRecipients><t:BccRecipients>" + _bcc + "</t:BccRecipients></t:Message></m:Items></m:CreateItem>");

            if (type == "SaveOnly")
            {
                var pid = xml.SelectSingleNode("//t:ItemId/@Id", _namespaceManager).Value;
                var s   = "<CreateAttachment xmlns=\"" + URI_MSG + "\" xmlns:t=\"" + URI_TYPES + "\"><ParentItemId Id=\"" + pid + "\"/><Attachments>";
                foreach (var att in attachments)
                {
                    s += "<t:FileAttachment><t:Name>" + att.Key + "</t:Name><t:Content>" + Convert.ToBase64String(att.Value) + "</t:Content></t:FileAttachment>";
                }
                xml = GetResponse(s + "</Attachments></CreateAttachment>");
                xml = GetResponse("<SendItem xmlns=\"" + URI_MSG + "\" SaveItemToFolder=\"" + (saveItem + "").ToLower() + "\"><ItemIds><t:ItemId Id=\"" + pid + "\" ChangeKey=\"" +
                                  xml.SelectSingleNode("//t:AttachmentId/@RootItemChangeKey", _namespaceManager).Value + "\"/></ItemIds></SendItem>");
            }
            return(xml.InnerXml);
        }
        private void btInutiliza_Click(object sender, EventArgs e)
        {
            ClientEnvironment manager = null;
            Parametro         oParam  = null;
            FuncaoAutomacao   oFuncao = null;

            try
            {
                manager = Conexao.CreateManager(Program.ConAux);
                oParam  = Program.GetParametro(Program.empresaSelecionada, manager);
                oFuncao = new FuncaoAutomacao(Program.empresaSelecionada, manager, Program.enviarInformacoesSobreErros);

                if (Int32.Parse(tbNotaInicial.Text) > Int32.Parse(tbNotaFinal.Text))
                {
                    throw new Exception("Nota Inicial deve ser menor que Nota Final.");
                }


                //Código da UF + CNPJ + modelo + série + nro inicial e nro final precedida do literal “ID”
                ITInutNFe oInutilizacao = (ITInutNFe)XMLUtils.XMLFactory(oParam.versao, "TInutNFe");

                oInutilizacao.versao       = oParam.versaoDados;
                oInutilizacao.infInut      = (ITInutNFeInfInut)XMLUtils.XMLFactory(oParam.versao, "TInutNFeInfInut");
                oInutilizacao.infInut.ano  = tbAno.Text;
                oInutilizacao.infInut.CNPJ = tbCNPJ.Text;

                oInutilizacao.infInut.cUF = NFeUtils.DefineUF(cbUF.SelectedValue.ToString());

                oInutilizacao.infInut.Id = "ID" + cbUF.SelectedValue.ToString() + tbAno.Text.PadLeft(2, '0') + tbCNPJ.Text + tbMod.Text +
                                           tbSerie.Text.PadLeft(3, '0') + tbNotaInicial.Text.PadLeft(9, '0') + tbNotaFinal.Text.PadLeft(9, '0');

                oInutilizacao.infInut.mod    = oParam.conexao == TipoConexao.NFCe ? TMod.Item65 : TMod.Item55;
                oInutilizacao.infInut.nNFIni = tbNotaInicial.Text;
                oInutilizacao.infInut.nNFFin = tbNotaFinal.Text;
                oInutilizacao.infInut.serie  = tbSerie.Text;

                oInutilizacao.infInut.tpAmb = (TAmb)NFeUtils.DefineEnum(cbTipoAmbiente.SelectedValue.ToString(), typeof(TAmb));
                oInutilizacao.infInut.xJust = tbJust.Text;
                oInutilizacao.infInut.xServ = TInutNFeInfInutXServ.INUTILIZAR;

                String cStat   = String.Empty;
                String xMotivo = String.Empty;

                oFuncao.InutilizaNumeracao(oInutilizacao, ref cStat, ref xMotivo, oParam.versao);


                if (cStat == String.Empty && xMotivo == String.Empty) //recebeu resposta da sefaz
                {
                    throw new Exception("Não foi possível executar Inutilização. Consulte o LOG do sistema.");
                }

                if (cStat != "102")
                {
                    throw new Exception(xMotivo);
                }

                ITRetInutNFe oRetInut = (ITRetInutNFe)
                                        XMLUtils.CarregaXML_HD(oParam.pastaRecibo + oInutilizacao.infInut.Id + "-inu.xml",
                                                               oParam.versao, "TRetInutNFe");

                oInutilizacao = (ITInutNFe)XMLUtils.CarregaXML_HD(oParam.pastaRecibo + oInutilizacao.infInut.Id + "-ped-inu.xml",
                                                                  oParam.versao, "TInutNFe");



                Int32 notaInicial = Int32.Parse(oInutilizacao.infInut.nNFIni);
                Int32 notaFinal   = Int32.Parse(oInutilizacao.infInut.nNFFin);

                while (notaInicial <= notaFinal)
                {
                    NotaInutilizada oNota = new NotaInutilizada();
                    oNota.numeroNota = notaInicial.ToString();

                    //setar a serie da nota
                    oNota.serieNota = oInutilizacao.infInut.serie;
                    oNota.data      = DateTime.Today;
                    oNota.empresa   = oParam.empresa;

                    oNota.XMLResposta = XMLUtils.GetXML(oRetInut, oParam.versao);
                    oNota.XMLPedido   = XMLUtils.GetXML(oInutilizacao, oParam.versao);

                    oNota.Save(manager);

                    notaInicial++;
                }

                MessageBox.Show(xMotivo);
            }
            catch (Exception ex)
            {
                if (oFuncao != null)
                {
                    oFuncao.CriaLog(999, "Inutilização de Notas", ex);
                }
                MessageBox.Show(ex.Message);
            }
            finally
            {
                oParam  = null;
                oFuncao = null;
                Conexao.DisposeManager(manager);
            }
        }
Exemple #13
0
 public GameLeaving(STGMain game, IGameState ongoingOrBossState)
 {
     stgGame = game;
     state   = ongoingOrBossState;
     XMLUtils.WriteSav(stgGame.Archive);
 }
        protected async void btnActualizar_Click(object sender, EventArgs e)
        {
            try
            {
                using (var conexion = new DataModelFE())
                {
                    EmisorReceptorIMEC  emisor   = (EmisorReceptorIMEC)Session["elEmisor"];
                    string              ambiente = ConfigurationManager.AppSettings["ENVIROMENT"].ToString();
                    OAuth2.OAuth2Config config   = conexion.OAuth2Config.Where(x => x.enviroment == ambiente).FirstOrDefault();
                    config.username = emisor.usernameOAuth2;
                    config.password = emisor.passwordOAuth2;

                    await OAuth2.OAuth2Config.getTokenWeb(config);

                    string clave         = Session["clave"].ToString();
                    string respuestaJSON = await Services.getRecepcion(config.token, clave);

                    if (!string.IsNullOrWhiteSpace(respuestaJSON))
                    {
                        WSRecepcionGET respuesta = JsonConvert.DeserializeObject <WSRecepcionGET>(respuestaJSON);
                        if (respuesta.respuestaXml != null)
                        {
                            string respuestaXML = EncodeXML.XMLUtils.base64Decode(respuesta.respuestaXml);

                            MensajeHacienda mensajeHacienda = new MensajeHacienda(respuestaXML);

                            using (var conexionWS = new DataModelFE())
                            {
                                WSRecepcionPOST dato = conexionWS.WSRecepcionPOST.Find(clave);
                                dato.mensaje             = mensajeHacienda.mensajeDetalle;
                                dato.indEstado           = mensajeHacienda.mensaje;
                                dato.fechaModificacion   = Date.DateTimeNow();
                                dato.usuarioModificacion = Session["usuario"].ToString();
                                //dato.receptorIdentificacion = mensajeHacienda.receptorNumeroCedula;
                                dato.montoTotalFactura  = mensajeHacienda.montoTotalFactura;
                                dato.montoTotalImpuesto = mensajeHacienda.montoTotalImpuesto;
                                dato.comprobanteRespXML = respuestaXML;

                                if (mensajeHacienda.montoTotalFactura == 0)
                                {
                                    string xml = XMLUtils.base64Decode(dato.comprobanteXml);
                                    dato.montoTotalImpuesto = Convert.ToDecimal(XMLUtils.buscarValorEtiquetaXML("ResumenFactura", "TotalImpuesto", xml));
                                    dato.montoTotalFactura  = Convert.ToDecimal(XMLUtils.buscarValorEtiquetaXML("ResumenFactura", "TotalComprobante", xml));
                                }


                                conexionWS.Entry(dato).State = EntityState.Modified;
                                conexionWS.SaveChanges();

                                Session["indEstado"] = dato.indEstado;
                            }
                        }
                        else
                        {
                            if (respuesta.indEstado.Equals("recibido"))
                            {
                                using (var conexionWS = new DataModelFE())
                                {
                                    WSRecepcionPOST dato = conexionWS.WSRecepcionPOST.Find(clave);
                                    dato.indEstado               = 8 /*recibido por hacienda*/;
                                    dato.fechaModificacion       = Date.DateTimeNow();
                                    dato.usuarioModificacion     = Usuario.USUARIO_AUTOMATICO;
                                    conexionWS.Entry(dato).State = EntityState.Modified;
                                    conexionWS.SaveChanges();
                                }
                            }

                            this.alertMessages.Attributes["class"] = "alert alert-info";
                            this.alertMessages.InnerText           = String.Format("Documento eléctronico se encuentra RECIBIDO pero aún pendiente de ser ACEPTADO");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(Utilidades.validarExepcionSQL(ex), ex.InnerException);
            }
            finally
            {
                //refescar los datos
                this.refreshData();
            }
        }
Exemple #15
0
        void oFrm_DoOnOkClick(object sender, EventArgs e)
        {
            ClientEnvironment manager = null;

            try
            {
                //FrmInfNRec oFrm = (FrmInfNRec)((Button)sender).Parent;
                String nRec = oFrm.TextResposta.Text;


                if (String.IsNullOrEmpty(nRec))
                {
                    throw new Exception("Informe o número do Recibo.");
                }

                manager = Conexao.CreateManager(Program.ConAux);

                ServicoPendente oServicoPendente = (ServicoPendente)ServicoPendenteDAL.Instance.Find(oSrv.keyString, manager);
                Parametro       oParam           = Program.GetParametro(oServicoPendente.empresa, manager);

                //criar o recibo no disco
                RDI.NFe2.SchemaXML.NFe_v200.TRetEnviNFe oRetEnviNFe = new RDI.NFe2.SchemaXML.NFe_v200.TRetEnviNFe();
                oRetEnviNFe.tpAmb    = oServicoPendente.tipoAmbiente;
                oRetEnviNFe.verAplic = "2.00";
                oRetEnviNFe.cUF      = oServicoPendente.UF;
                oRetEnviNFe.cStat    = "103";
                oRetEnviNFe.xMotivo  = "Lote recebido com sucesso";
                oRetEnviNFe.dhRecbto = DateTime.Now;
                oRetEnviNFe.infRec   = new RDI.NFe2.SchemaXML.NFe_v200.TRetEnviNFeInfRec();

                oRetEnviNFe.infRec.nRec = nRec;
                oRetEnviNFe.infRec.tMed = "1";
                XMLUtils.SaveXML(oParam.pastaRecibo + oServicoPendente.numeroLote.ToString() + "-rec.xml", oRetEnviNFe, oServicoPendente.versao);

                oServicoPendente.xmlRecibo = XMLUtils.GetXML(oRetEnviNFe, oServicoPendente.versao);

                oServicoPendente.numeroRecibo = nRec;

                oServicoPendente.dataSituacao   = DateTime.Now;
                oServicoPendente.codigoSituacao = TipoSituacaoServico.Enviado;
                //setar todas as notas desse servico como enviadas.

                NotaFiscalQry oNFeQry = new NotaFiscalQry();
                oNFeQry.empresa    = oServicoPendente.empresa;
                oNFeQry.numeroLote = oServicoPendente.numeroLote.ToString();

                //somente as que foram assinadas e inseridas no lote.
                oNFeQry.codigoSituacao = TipoSituacaoNota.Assinada;// "0";

                ArrayList notasProcessadas = NotaFiscalDAL.Instance.GetInstances(oNFeQry, manager);
                foreach (NotaFiscal oNFeProc in notasProcessadas)
                {
                    oNFeProc.codigoSituacao    = TipoSituacaoNota.Enviada;// 12; //Enviada
                    oNFeProc.descricaoSituacao = "Nota enviada";
                    oNFeProc.dataSituacao      = oServicoPendente.dataSituacao;
                    oNFeProc.Save(manager);

                    Log oLog = new Log();
                    oLog.codigoSituacao    = 13;
                    oLog.descricaoSituacao = "Nota Enviada";
                    oLog.nota           = new NotaFiscal();
                    oLog.nota.chaveNota = oNFeProc.chaveNota;
                    oLog.data           = DateTime.Now;
                    oLog.empresa        = oServicoPendente.empresa;
                    oLog.Save(manager);
                }
                oServicoPendente.Save(manager);

                Log oLogSrv = new Log();
                oLogSrv.codigoSituacao    = 998;
                oLogSrv.descricaoSituacao = "Recibo informado pelo usuario.";
                oLogSrv.nota           = new NotaFiscal();
                oLogSrv.nota.chaveNota = String.Empty;
                oLogSrv.data           = DateTime.Now;
                oLogSrv.empresa        = oServicoPendente.empresa;
                oLogSrv.Save(manager);

                MessageBox.Show("Lote atualizado com sucesso.");
                oFrm.Close();
                oFrm.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Conexao.DisposeManager(manager);
            }
        }
Exemple #16
0
        public StreamFeaturesMessage getStreamFeaturesMessage(XmlNode node)
        {
            XmlNode n = XMLUtils.getChildNode(node, "stream:features");

            return(n == null ? null : new StreamFeaturesMessage(n));
        }
Exemple #17
0
        //--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\
        #region --Set-, Get- Methods--
        private string getValue(XmlNode node)
        {
            XmlNode value = XMLUtils.getChildNode(node, "value");

            return(value?.InnerText);
        }
Exemple #18
0
        //--------------------------------------------------------Constructor:----------------------------------------------------------------\\
        #region --Constructors--
        public Set(XmlNode answer)
        {
            XmlNode afterNode = XMLUtils.getChildNode(answer, "after");

            if (!(afterNode is null))
            {
                AFTER = afterNode.InnerText;
            }

            XmlNode beforeNode = XMLUtils.getChildNode(answer, "before");

            if (!(beforeNode is null))
            {
                BEFORE = beforeNode.InnerText;
            }

            XmlNode countNode = XMLUtils.getChildNode(answer, "count");

            if (!(countNode is null))
            {
                if (uint.TryParse(countNode.InnerText, out uint count))
                {
                    COUNT = count;
                }
                else
                {
                    Logger.Error("Failed to parse XEP-0313 SET count node value as uint: " + countNode.InnerText);
                }
            }

            XmlNode firstNode = XMLUtils.getChildNode(answer, "first");

            if (!(firstNode is null))
            {
                FIRST = firstNode.InnerText;
                string tmp = firstNode.Attributes["index"]?.Value;
                if (!(tmp is null))
                {
                    if (uint.TryParse(tmp, out uint index))
                    {
                        FIRST_INDEX = index;
                    }
                    else
                    {
                        Logger.Error("Failed to parse XEP-0313 SET first_index node value as uint: " + tmp);
                    }
                }
            }

            XmlNode indexNode = XMLUtils.getChildNode(answer, "index");

            if (!(indexNode is null))
            {
                if (uint.TryParse(indexNode.InnerText, out uint index))
                {
                    INDEX = index;
                }
                else
                {
                    Logger.Error("Failed to parse XEP-0313 SET index node value as uint: " + indexNode.InnerText);
                }
            }

            XmlNode lastNode = XMLUtils.getChildNode(answer, "last");

            if (!(lastNode is null))
            {
                LAST = lastNode.InnerText;
            }

            XmlNode maxNode = XMLUtils.getChildNode(answer, "max");

            if (!(maxNode is null))
            {
                MAX = maxNode.InnerText;
            }
        }
 /// <summary>
 /// Parses the given HOCR model
 /// </summary>
 /// <param name="path">The path to the file with a model content to parse</param>
 /// <param name="encoding">The character encoding to use to decode the stream (autodetected if specified as null)</param>
 /// <returns></returns>
 public static IEnumerable <TextGeometryModel> ParseHocrResults(string path, [NotNull] Encoding encoding)
 {
     return(ParseHocrResults(XMLUtils.OpenXMLDocument(path, encoding)));
 }
Exemple #20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tieneFirma">determina si el XML esta firmado o no</param>
        /// <param name="documento">puede ser cualquer tipo de documento electronico</param>
        /// <param name="responsePost">respuesta del webs ervices</param>
        /// <param name="tipoDocumento">Facura, Nota Crédito, Nota Débito</param>
        public static async Task <string> enviarDocumentoElectronico(bool tieneFirma, DocumentoElectronico documento, EmisorReceptorIMEC emisor, string tipoDocumento, string usuario)
        {
            String responsePost = "";

            try
            {
                string xmlFile = EncodeXML.XMLUtils.getXMLFromObject(documento);

                using (var conexion = new DataModelFE())
                {
                    OAuth2.OAuth2Config config = null;
                    if (System.Web.HttpContext.Current.Session["token"] != null)
                    {
                        config = (OAuth2.OAuth2Config)System.Web.HttpContext.Current.Session["token"];
                    }

                    if (requiereNuevoToken(config))
                    {
                        //Sessison["horaToken"]
                        string ambiente = ConfigurationManager.AppSettings["ENVIROMENT"].ToString();
                        config          = conexion.OAuth2Config.Where(x => x.enviroment == ambiente).FirstOrDefault();
                        config.username = emisor.usernameOAuth2;
                        config.password = emisor.passwordOAuth2;

                        await OAuth2.OAuth2Config.getTokenWeb(config);

                        System.Web.HttpContext.Current.Session["token"]     = config;
                        System.Web.HttpContext.Current.Session["tokenTime"] = Date.DateTimeNow();
                    }

                    WSRecepcionPOST trama = new WSRecepcionPOST();
                    trama.clave = XMLUtils.buscarValorEtiquetaXML(XMLUtils.tipoDocumentoXML(xmlFile), "Clave", xmlFile);
                    trama.fecha = DateTime.ParseExact(XMLUtils.buscarValorEtiquetaXML(XMLUtils.tipoDocumentoXML(xmlFile), "FechaEmision", xmlFile), "yyyy-MM-ddTHH:mm:ss-06:00",
                                                      System.Globalization.CultureInfo.InvariantCulture);


                    string emisorIdentificacion = XMLUtils.buscarValorEtiquetaXML("Emisor", "Identificacion", xmlFile);
                    trama.emisor.tipoIdentificacion   = emisorIdentificacion.Substring(0, 2);
                    trama.emisor.numeroIdentificacion = emisorIdentificacion.Substring(2);
                    trama.emisorTipo           = trama.emisor.tipoIdentificacion;
                    trama.emisorIdentificacion = trama.emisor.numeroIdentificacion;

                    string receptorIdentificacion = XMLUtils.buscarValorEtiquetaXML("Receptor", "Identificacion", xmlFile);

                    if (!string.IsNullOrWhiteSpace(receptorIdentificacion))
                    {
                        trama.receptor.tipoIdentificacion   = receptorIdentificacion.Substring(0, 2);
                        trama.receptor.numeroIdentificacion = receptorIdentificacion.Substring(2);
                    }
                    else
                    {
                        trama.receptor.tipoIdentificacion   = "99";
                        trama.receptor.numeroIdentificacion = XMLUtils.buscarValorEtiquetaXML("Receptor", "IdentificacionExtranjero", xmlFile);
                    }

                    trama.receptorTipo           = trama.receptor.tipoIdentificacion;
                    trama.receptorIdentificacion = trama.receptor.numeroIdentificacion;
                    trama.tipoDocumento          = tipoDocumento;

                    //trama.callbackUrl = ConfigurationManager.AppSettings["ENVIROMENT_URL"].ToString();

                    if (!tieneFirma)
                    {
                        xmlFile = FirmaXML.getXMLFirmadoWeb(xmlFile, emisor.llaveCriptografica, emisor.claveLlaveCriptografica.ToString());
                    }

                    trama.comprobanteXml = EncodeXML.XMLUtils.base64Encode(xmlFile);

                    string jsonTrama = JsonConvert.SerializeObject(trama);

                    if (config.token.access_token != null)
                    {
                        responsePost = await postRecepcion(config.token, jsonTrama);
                    }
                    else
                    {
                        // facturar guardada para envio en linea
                        trama.indEstado = 9;
                    }


                    WSRecepcionPOST tramaExiste = conexion.WSRecepcionPOST.Find(trama.clave);

                    if (tramaExiste != null)
                    {// si existe
                        trama.fechaModificacion   = Date.DateTimeNow();
                        trama.usuarioModificacion = usuario;
                        trama.indEstado           = 0;
                        trama.cargarEmisorReceptor();
                        conexion.Entry(tramaExiste).State = EntityState.Modified;

                        documento.resumenFactura.clave = documento.clave;
                        conexion.Entry(documento.resumenFactura).State = EntityState.Modified;
                    }
                    else//si no existe
                    {
                        trama.fechaCreacion   = Date.DateTimeNow();
                        trama.usuarioCreacion = usuario;
                        trama.cargarEmisorReceptor();
                        conexion.WSRecepcionPOST.Add(trama);              //trama

                        documento.resumenFactura.clave = documento.clave; //resumen
                        conexion.ResumenFactura.Add(documento.resumenFactura);
                    }
                    conexion.SaveChanges();

                    //guarda la relacion de clientes asociados al emisor
                    Cliente cliente = conexion.Cliente.Where(x => x.emisor == trama.emisor.numeroIdentificacion).Where(x => x.receptor == trama.receptor.numeroIdentificacion).FirstOrDefault();
                    if (cliente == null && !string.IsNullOrWhiteSpace(trama.receptor.numeroIdentificacion))
                    {
                        cliente          = new Cliente();
                        cliente.emisor   = trama.emisor.numeroIdentificacion;
                        cliente.receptor = trama.receptor.numeroIdentificacion;
                        conexion.Cliente.Add(cliente);
                        conexion.SaveChanges();
                    }
                }
            }
            catch (DbEntityValidationException ex)
            {
                // Retrieve the error messages as a list of strings.
                var errorMessages = ex.EntityValidationErrors
                                    .SelectMany(x => x.ValidationErrors)
                                    .Select(x => x.ErrorMessage);

                // Join the list to a single string.
                var fullErrorMessage = string.Join("; ", errorMessages);
                // Throw a new DbEntityValidationException with the improved exception message.
                throw new DbEntityValidationException(fullErrorMessage, ex.EntityValidationErrors);
            }
            catch (Exception ex)
            {
                throw new Exception(Utilidades.validarExepcionSQL(ex), ex.InnerException);
            }
            return(responsePost);
        }
 /// <summary>
 /// Parses the given HOCR model
 /// </summary>
 /// <param name="hocrDataStream">The stream with a HOCR model content</param>
 /// <param name="encoding">The character encoding to use to decode the stream (autodetected if specified as null)</param>
 /// <returns></returns>
 public static IEnumerable <TextGeometryModel> ParseHocrResults(Stream hocrDataStream, [NotNull] Encoding encoding)
 {
     return(ParseHocrResults(XMLUtils.OpenXMLDocument(hocrDataStream, encoding)));
 }
 internal PMLStackFrame(XmlElement frame) :
     this(XMLUtils.GetInnerText(frame, ProcMonXMLTagNames.StackFrame_Address).HexStringToLong(),
          XMLUtils.GetInnerText(frame, ProcMonXMLTagNames.StackFrame_Path),
          XMLUtils.GetInnerText(frame, ProcMonXMLTagNames.StackFrame_Location))
 {
 }
        //--------------------------------------------------------Constructor:----------------------------------------------------------------\\
        #region --Constructors--
        /// <summary>
        /// Basic Constructor
        /// </summary>
        /// <history>
        /// 10/11/2017 Created [Fabian Sauter]
        /// </history>
        public DiscoResponseMessage(XmlNode n) : base(n)
        {
            IDENTITIES   = new List <DiscoIdentity>();
            FEATURES     = new List <DiscoFeature>();
            ITEMS        = new List <DiscoItem>();
            ERROR_RESULT = null;
            XmlNode qNode = XMLUtils.getChildNode(n, "query", Consts.XML_XMLNS, Consts.XML_XEP_0030_INFO_NAMESPACE);

            if (qNode is null)
            {
                qNode = XMLUtils.getChildNode(n, "query", Consts.XML_XMLNS, Consts.XML_XEP_0030_ITEMS_NAMESPACE);
                if (qNode is null)
                {
                    Logging.Logger.Warn("Invalid disco result message received! " + n.ToString().Replace('\n', ' '));
                    DISCO_TYPE = DiscoType.UNKNOWN;
                    return;
                }
                DISCO_TYPE = DiscoType.ITEMS;
            }
            else
            {
                DISCO_TYPE = DiscoType.INFO;
            }

            // Load content:
            if (qNode != null)
            {
                foreach (XmlNode n1 in qNode.ChildNodes)
                {
                    switch (n1.Name)
                    {
                    case "feature":
                        FEATURES.Add(new DiscoFeature(n1));
                        break;

                    case "identity":
                        IDENTITIES.Add(new DiscoIdentity(n1));
                        break;

                    case "item":
                        ITEMS.Add(new DiscoItem(n1));
                        break;

                    case "error":
                        ERROR_RESULT = new ErrorNode(n1);
                        break;
                    }
                }
                isPartialList = doesNodeContainPartialList(qNode);
            }

            // Sort disco items alphabetically:
            ITEMS.Sort((a, b) =>
            {
                if (a is null || a.NAME is null)
                {
                    if (b is null || b.NAME is null)
                    {
                        return(0);
                    }
                    return(-1);
                }

                if (b is null || b.NAME is null)
                {
                    return(1);
                }

                return(a.NAME.CompareTo(b.NAME));
            });
        }
Exemple #24
0
        /// <summary>Provide different printing options via a String keyword.</summary>
        /// <remarks>
        /// Provide different printing options via a String keyword.
        /// The recognized options are currently "xml", and "predicate".
        /// Otherwise the default toString() is used.
        /// </remarks>
        public override string ToString(string format)
        {
            switch (format)
            {
            case "xml":
            {
                return("  <dep>\n    <governor>" + XMLUtils.EscapeXML(Governor().Value()) + "</governor>\n    <dependent>" + XMLUtils.EscapeXML(Dependent().Value()) + "</dependent>\n  </dep>");
            }

            case "predicate":
            {
                return("dep(" + Governor() + "," + Dependent() + "," + Name() + ")");
            }

            default:
            {
                return(ToString());
            }
            }
        }
Exemple #25
0
        private static String ExecutaServico(
            System.Web.Services.Protocols.SoapHttpClientProtocol oServico,
            Object DADOS, Parametro oParam)
        {
            try
            {
                string dados = XMLUtils.GetXML(DADOS, oParam.versao);
                #region particularidades
                if (oParam.UF == TCodUfIBGE.Parana && (DADOS.GetType() == typeof(SchemaXML200.TEnviNFe) ||
                                                       DADOS.GetType() == typeof(SchemaXML300.TEnviNFe) ||
                                                       DADOS.GetType() == typeof(SchemaXML310.TEnviNFe)))
                {
                    dados = dados.Replace("<NFe>", "<NFe xmlns=\"http://www.portalfiscal.inf.br/nfe\">");
                }
                #endregion
                XmlNode node = null;

                XmlDocument doc    = new XmlDocument();
                XmlReader   reader = XmlReader.Create(new StringReader(dados));
                reader.MoveToContent();

                node = doc.ReadNode(reader);

                InicializaServico(oServico, oParam);


                if (DADOS.GetType() == typeof(RDI.NFe2.GNRE.TLote_GNRE))
                {
                    XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("processar",
                                                                           System.Reflection.BindingFlags.InvokeMethod,
                                                                           null, oServico, new object[] { node });

                    return(XMLUtils.GetXML(ret, oParam.versao));
                }
                else if (DADOS.GetType() == typeof(RDI.NFe2.GNRE.TConsLote_GNRE))
                {
                    XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("consultar",
                                                                           System.Reflection.BindingFlags.InvokeMethod,
                                                                           null, oServico, new object[] { node });

                    return(XMLUtils.GetXML(ret, oParam.versao));
                }
                else if (DADOS.GetType() == typeof(RDI.NFe2.GNRE.TConsultaConfigUf))
                {
                    XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("consultar",
                                                                           System.Reflection.BindingFlags.InvokeMethod,
                                                                           null, oServico, new object[] { node });

                    return(XMLUtils.GetXML(ret, oParam.versao));
                }
                else if (DADOS.GetType().GetInterface("ITConsCad") != null)
                {
                    XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("consultaCadastro2",
                                                                           System.Reflection.BindingFlags.InvokeMethod,
                                                                           null, oServico, new object[] { node });

                    return(XMLUtils.GetXML(ret, oParam.versao));
                }
                else if (DADOS.GetType().GetInterface("ITEnvEvento") != null)
                {
                    XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("nfeRecepcaoEvento",
                                                                           System.Reflection.BindingFlags.InvokeMethod,
                                                                           null, oServico, new object[] { node });

                    return(XMLUtils.GetXML(ret, oParam.versao));
                }
                else if (DADOS.GetType().GetInterface("ITEnviNFe") != null)
                {
                    if (((ITEnviNFe)DADOS).versao == "2.00")
                    {
                        //versao 2.00

                        #region particularidades
                        if (oParam.UF == TCodUfIBGE.Parana)
                        {
                            if (oParam.tipoAmbiente == TAmb.Homologacao)
                            {
                                oServico.Url = @"https://homologacao.nfe2.fazenda.pr.gov.br/nfe/NFeRecepcao2";
                            }
                            else
                            {
                                oServico.Url = @"https://nfe2.fazenda.pr.gov.br/nfe/NFeRecepcao2";
                            }
                        }
                        #endregion

                        XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("nfeRecepcaoLote2",
                                                                               System.Reflection.BindingFlags.InvokeMethod,
                                                                               null, oServico, new object[] { node });

                        return(XMLUtils.GetXML(ret, oParam.versao));
                    }
                    else
                    {
                        //versao 3.00
                        //Somente meto Assincrono
                        //var test = (SchemaXML300.TEnviNFe)DADOS;
                        //test.indSinc = SchemaXML300.TEnviNFeIndSinc.Item0;//Não indica sincrono
                        //test.indSinc = SchemaXML300.TEnviNFeIndSinc.Item1; //indica sincrono, mas depende da SEFAZ autorizadora implementar servico.

                        //***.**.Autorizacao.NfeAutorizacao proxy = new ***.**.Autorizacao.NfeAutorizacao();
                        //var ret = proxy.nfeAutorizacaoLote(node);
                        //sincrono poderá ter o Nó : TProtNFe
                        //assincrono terá o Nó : TRetEnviNFeInfRec

                        var fnNome = "nfeAutorizacaoLote";

                        XmlNode ret = (XmlNode)oServico.GetType().InvokeMember(fnNome,
                                                                               System.Reflection.BindingFlags.InvokeMethod,
                                                                               null, oServico, new object[] { node });
                        return(XMLUtils.GetXML(ret, oParam.versao));
                    }
                }
                else if (DADOS.GetType().GetInterface("ITConsReciNFe") != null)
                {
                    if (((ITConsReciNFe)DADOS).versao == "2.00")
                    {
                        //versao 2.00

                        #region particularidades
                        if (oParam.UF == TCodUfIBGE.Parana)
                        {
                            if (oParam.tipoAmbiente == TAmb.Homologacao)
                            {
                                oServico.Url = @"https://homologacao.nfe2.fazenda.pr.gov.br/nfe/NFeRetRecepcao2";
                            }
                            else
                            {
                                oServico.Url = @"https://nfe2.fazenda.pr.gov.br/nfe/NFeRetRecepcao2";
                            }
                        }
                        #endregion

                        XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("nfeRetRecepcao2",
                                                                               System.Reflection.BindingFlags.InvokeMethod,
                                                                               null, oServico, new object[] { node });

                        return(XMLUtils.GetXML(ret, oParam.versao));
                    }
                    else
                    {
                        var fnNome = "nfeRetAutorizacaoLote";
                        if (oParam.UF == TCodUfIBGE.Parana && oParam.versao == VersaoXML.NFe_v310)
                        {
                            fnNome = "nfeRetAutorizacao";
                        }


                        //versao 3.00 ou 3.10
                        XmlNode ret = (XmlNode)oServico.GetType().InvokeMember(fnNome,
                                                                               System.Reflection.BindingFlags.InvokeMethod,
                                                                               null, oServico, new object[] { node });

                        var temp = XMLUtils.GetXML(ret, oParam.versao);

                        if (oParam.UF == TCodUfIBGE.Pernambuco)
                        {
                            //SEFAZ PE está retornando retEnviNFe ao inves de retConsReciNFe quando lote ainda está em processamento
                            temp = temp.Replace("retEnviNFe", "retConsReciNFe");
                        }

                        return(temp);
                    }
                }
                else if (DADOS.GetType().GetInterface("ITConsStatServ") != null)
                {
                    var fnNome = "nfeStatusServicoNF2";
                    if ((oParam.UF == TCodUfIBGE.Parana || oParam.UF == TCodUfIBGE.Bahia) &&
                        oParam.tipoEmissao == TNFeInfNFeIdeTpEmis.Normal &&
                        oParam.versao == VersaoXML.NFe_v310)
                    {
                        fnNome = "nfeStatusServicoNF";
                    }

                    XmlNode ret = (XmlNode)oServico.GetType().InvokeMember(fnNome,
                                                                           System.Reflection.BindingFlags.InvokeMethod,
                                                                           null, oServico, new object[] { node });

                    return(XMLUtils.GetXML(ret, oParam.versao));
                }
                else if (DADOS.GetType().GetInterface("ITInutNFe") != null)
                {
                    var fnNome = "nfeInutilizacaoNF2";
                    if ((oParam.UF == TCodUfIBGE.Parana || oParam.UF == TCodUfIBGE.Bahia) &&
                        oParam.tipoEmissao == TNFeInfNFeIdeTpEmis.Normal &&
                        oParam.versao == VersaoXML.NFe_v310)
                    {
                        fnNome = "nfeInutilizacaoNF";
                    }

                    XmlNode ret = (XmlNode)oServico.GetType().InvokeMember(fnNome,
                                                                           System.Reflection.BindingFlags.InvokeMethod,
                                                                           null, oServico, new object[] { node });

                    return(XMLUtils.GetXML(ret, oParam.versao));
                }
                else if (DADOS.GetType().GetInterface("ITConsSitNFe") != null)
                {
                    string fnNome = "nfeConsultaNF2";
                    if ((oParam.UF == TCodUfIBGE.Parana || oParam.UF == TCodUfIBGE.Bahia) &&
                        oParam.tipoEmissao == TNFeInfNFeIdeTpEmis.Normal &&
                        oParam.versao == VersaoXML.NFe_v310)
                    {
                        fnNome = "nfeConsultaNF";
                    }

                    XmlNode ret = (XmlNode)oServico.GetType().InvokeMember(fnNome,
                                                                           System.Reflection.BindingFlags.InvokeMethod,
                                                                           null, oServico, new object[] { node });
                    return(XMLUtils.GetXML(ret, oParam.versao));
                }
                else if (DADOS.GetType().GetInterface("IDistDFeInt") != null)
                {
                    XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("nfeDistDFeInteresse",
                                                                           System.Reflection.BindingFlags.InvokeMethod,
                                                                           null, oServico, new object[] { node });

                    return(XMLUtils.GetXML(ret, oParam.versao));
                }
                else if (DADOS.GetType().GetInterface("ITDownloadNFe") != null)
                {
                    XmlNode ret = (XmlNode)oServico.GetType().InvokeMember("nfeDownloadNF",
                                                                           System.Reflection.BindingFlags.InvokeMethod,
                                                                           null, oServico, new object[] { node });

                    return(XMLUtils.GetXML(ret, oParam.versao));
                }
                else
                {
                    throw new Exception("Tipo de objeto de envio não mapeado. Consulte o administrador do Sistema.");
                }
            }
            catch (Exception ex)
            {
                String msg = ex.Message;
                if (ex.InnerException != null)
                {
                    msg += " inner : " + ex.InnerException.Message;
                }
                if (ex.InnerException.InnerException != null)
                {
                    msg += " inner : " + ex.InnerException.InnerException.Message;
                }

                throw new Exception("Erro ao executar Serviço : typeof(" + DADOS.GetType().ToString() + "). Verifique sua conexão com a Internet, configurações de proxy e certificado. " + msg);
            }
        }
        /// <summary>Provide different printing options via a String keyword.</summary>
        /// <remarks>
        /// Provide different printing options via a String keyword.
        /// The recognized options are currently "xml", and "predicate".
        /// Otherwise the default toString() is used.
        /// </remarks>
        public override string ToString(string format)
        {
            switch (format)
            {
            case "xml":
            {
                string govIdxStr = " idx=\"" + headIndex + "\"";
                string depIdxStr = " idx=\"" + depIndex + "\"";
                return("  <dep>\n    <governor" + govIdxStr + ">" + XMLUtils.EscapeXML(Governor().Value()) + "</governor>\n    <dependent" + depIdxStr + ">" + XMLUtils.EscapeXML(Dependent().Value()) + "</dependent>\n  </dep>");
            }

            case "predicate":
            {
                return("dep(" + Governor() + "," + Dependent() + ")");
            }

            default:
            {
                return(ToString());
            }
            }
        }
Exemple #27
0
 public static IRetDistDFeInt ConsultarDFe(SoapHttpClientProtocol oServico, IDistDFeInt xmlEnvio, Parametro oParam, VersaoXML versao)
 {
     return((IRetDistDFeInt)XMLUtils.CarregaXML_STR(ExecutaServico(oServico, xmlEnvio, oParam),
                                                    versao, "retDistDFeInt"));
 }
Exemple #28
0
        public Field(XmlNode node)
        {
            var   = node.Attributes["var"]?.Value;
            label = node.Attributes["label"]?.Value;

            switch (node.Attributes["type"]?.Value)
            {
            case "boolean":
                value = XMLUtils.tryParseToBool(getStringValue(node));
                type  = FieldType.BOOLEAN;
                break;

            case "text-private":
                value = getStringValue(node);
                type  = FieldType.TEXT_PRIVATE;
                break;

            case "text-single":
                value = getStringValue(node);
                type  = FieldType.TEXT_SINGLE;
                break;

            case "text-multi":
                type = FieldType.TEXT_MULTI;
                break;

            case "fixed":
                value = getStringValue(node);
                type  = FieldType.FIXED;
                break;

            case "list-single":
                options         = getOptions(node);
                selectedOptions = getSelectedOptions(node, options);
                type            = FieldType.LIST_SINGLE;
                break;

            case "list-multi":
                options         = getOptions(node);
                selectedOptions = getSelectedOptions(node, options);
                type            = FieldType.LIST_MULTI;
                break;

            case "hidden":
                value = getStringValue(node);
                type  = FieldType.HIDDEN;
                break;

            case "button":     // XEP-IoT
                type = FieldType.BUTTON;
                break;

            case "header":     // XEP-IoT
                value = getStringValue(node);
                type  = FieldType.HEADER;
                break;

            case "slider":     // XEP-IoT
                addIoTProps = new SliderFieldProperties(node);
                type        = FieldType.SLIDER;
                break;

            default:
                value = getStringValue(node);
                type  = FieldType.NONE;
                break;
            }
            dfConfiguration = new DynamicFormsConfiguration(node);
        }
Exemple #29
0
 // Use this for initialization
 void Start()
 {
     print("ID equals: " + XMLUtils.TitleToID(CrewTitle.Engineer));
 }
Exemple #30
0
 public XElement GetSubsystem(string name)
 {
     return(XMLUtils.FindValuesByName(Root.Element("Subsystems"), name));
 }