private void GetToClipboard(Generico.Highlighter codeLang) { try { DTE2 dte = Package.GetGlobalService(typeof(DTE)) as DTE2; if (dte.ActiveDocument != null) { var selection = (EnvDTE.TextSelection)dte.ActiveDocument.Selection; //selection.Unindent(100); string code = selection.Text; string result = Generico.WrapCode(codeLang, code); ClipboardHandle.GetTextToClipboard(result); System.Windows.Forms.MessageBox.Show("Kopieret"); this.Close(); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Noget gik galt: " + ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SqlDataReader dr = Generico.ObtenerValorGenerico("EstatusVotacion"); while (dr.Read()) { if (dr["ValorGenerico"].ToString() == "Cerrada") { Response.Redirect("Vista/VotacionCerrada.aspx"); } else if (dr["ValorGenerico"].ToString() == "Ganador") { Response.Redirect("Vista/Ganador.aspx"); } } dr.Close(); if (Request.Cookies["login"] != null) { if (Request.Cookies["login"].Value != "") { ProcesoLogin(); } } } }
public void InsertGenerico(Generico g) { using (var connection = new SqlConnection(this._connectionString)) { connection.Open(); connection.Execute(@"USE[tick] INSERT INTO [dbo].[Generico] ([gnr_Nome] ,[gnr_Marca] ,[gnr_Modello] ,[gnr_Serie] ,[gnr_Descrizione] ,[gnr_UltimaInstallazione] ,[gnr_UltimoIntervento] ,[gnr_OreUltimoIntervento] ,[gnr_Impianto] ,[gnr_Rimosso]) VALUES (@gnr_Nome ,@gnr_Marca ,@gnr_Modello ,@gnr_Serie ,@gnr_Descrizione ,@gnr_UltimaInstallazione ,@gnr_UltimoIntervento ,@gnr_OreUltimoIntervento ,@gnr_Impianto ,@gnr_Rimosso)", g); } }
public void GenericItemAddtoInventoryByIdDuplicate() { int idinventario = 100; int itemid = 100; // Limpa o inventário Inventario.getInstance(idinventario).RemoveAll(); // Cria um item com o id itemid Item _item = new Generico(itemid); // Diz ao item para se adicionar ao inventário com instancia idinventario 2 vezes _item.AddToInventario(idinventario); Assert.Throws <ArgumentException>(() => { _item.AddToInventario(idinventario); }); Item _item2 = (Item)Inventario .getInstance(idinventario) .GetItemById(itemid); Assert.AreEqual(_item2.Id, itemid); }
public static Produto fabricar(string textLine) { string[] campos = textLine.Split(';'); string nome = campos[0]; string categoria = campos[1]; string foto = campos[2]; float preco = float.Parse(campos[3]); Produto produto; if (categoria.ToLower() == "sapato") { produto = new Sapato(); } else if (categoria.ToLower() == "camisa") { produto = new Camisa(); } else { produto = new Generico(); } produto.Nome = nome; produto.Categoria = categoria; produto.Foto = foto; produto.Preco = preco; return(produto); }
public static Generico BuscarGenerico(String nome) { Generico generico = new Generico(); var uri = ConfigurationManager.AppSettings["DeezerBuscaGenerica"].ToString(); foreach (JToken result in ResponseJsonGenericoAPI(String.Format(uri, nome))) { String tipo = result["type"].ToString(); switch ((TypeDeezer)Enum.Parse(typeof(TypeDeezer), tipo)) { case TypeDeezer.artist: generico.Artistas.Add(result.ToObject <Artistas>()); break; case TypeDeezer.album: generico.Albuns.Add(result.ToObject <Albuns>()); break; case TypeDeezer.track: generico.Faixas.Add(result.ToObject <Faixas>()); break; default: break; } } return(generico); }
public async Task <IActionResult> Edit(Guid id, Generico generico) { if (id != generico.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(generico); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GenericoExists(generico.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(generico)); }
public void Create_GenericItemInvalido() { Assert.Throws <IdBadException>(() => { Item _item = new Generico(-123); }); }
public void TailTest() { int[] Arreglo1 = { 10, 20, 30, 40 }; Genericos gen = new Generico(); int[] Arreglo2 = genericos.Tail <int>(Arreglo1); Assert.AreEqual(Arreglo1[0], Arreglo2[0]); }
public void TailTest() { int[] ArregloBase = { 10, 20, 30, 40 }; Genericos generico = new Generico(); int[] NuevoArreglo = genericos.Tail <int>(ArregloBase); Assert.AreEqual(ArregloBase[0], NuevoArreglo[0]); }
public void RemoveItemExistente_Inventario() { var _item1 = new Generico(1, "Serial 1"); Inventario.getInstance().Adiciona(_item1); Assert.IsTrue( Inventario.getInstance().Remove(_item1) ); }
public void Create_GenericItem() { Item _item = new Generico(123); // Verifica o Id do item correspondo ao inicializado Assert.AreEqual(_item.Id, 123); // Verifica se ficou inicializado Assert.IsTrue(_item.Initialized); // Verifica o tipo de item no inventário Assert.AreEqual(_item.Tipo, (new Generico(1)).GetType()); }
public void EditNotExists_Trows() { Assert.Throws <NotExists>(() => { var _inv = Inventario.getInstance(20); _inv.RemoveAll(); var item1 = new Generico(22); _inv.Edita(item1); }); }
public void AdicionaInventarioDuplicate_Trows() { Assert.Throws <ArgumentException>(() => { var _inv = Inventario.getInstance(20); var item1 = new Generico(1); var item2 = new Generico(1); // Tenta adicionar um inventário no inventário _inv.Adiciona(item1); _inv.Adiciona(item2); }); }
public void RemoveItemExistenteById_Inventario() { { Inventario inv = Inventario.getInstance(); var _item1 = new Generico(1, "Serial 1"); inv.Adiciona(_item1); Assert.IsTrue( inv.RemoveById(1) ); } }
public void GenericItemAddtoInventoryDuplicate() { Assert.Throws <ArgumentException>(() => { // Limpa o inventário Inventario.getInstance().RemoveAll(); // Cria um item com o id 123 Item _item = new Generico(123); // Diz ao item para se adicionar ao inventário com instancia 0 2 vezes bool result = _item.AddToInventario(Inventario.getInstance()); bool result2 = _item.AddToInventario(Inventario.getInstance()); }); }
static void Main(string[] args) { var valor1 = new Generico<int>(); var valor2 = new Generico<string>(); var valor3 = new Generico<double>(); valor1.Valor = 5; valor2.Valor = "Hola, mundo!!!"; valor3.Valor = 3.1416; valor1.Imprime(); valor2.Imprime(); valor3.Imprime(); Console.Read(); }
public override string ConsultarNfsePorRps() { string retornar = string.Empty; string XMLRetorno = RequestWS(Envelopar(ArquivoXml, CabecMsg, "ConsultarNfsePorRps"), WSSoap.EnderecoWeb, this.NameSpaces + "ConsultarNfsePorRps"); MemoryStream stream = Generico.StringXmlToStream(XMLRetorno); XmlDocument doc = new XmlDocument(); doc.Load(stream); XmlNodeList xmlList = doc.GetElementsByTagName("outputXML"); retornar = Generico.TrataCaracteres(xmlList[0].OuterXml).Replace("<outputXML>", "").Replace("</outputXML>", ""); return(retornar); }
public void GenericItemDelfromInventory() { int idinventario = 100; int itemid = 100; // Limpa o inventário Inventario.getInstance(idinventario).RemoveAll(); // Cria um item com o id itemid Item _item = new Generico(itemid); // Diz ao item para se adicionar ao inventário com instancia idinventario 2 vezes _item.AddToInventario(Inventario.getInstance(idinventario)); bool res = _item.RemoveFromInventario(idinventario); Assert.IsTrue(res); }
public async Task <IActionResult> Create(Generico generico) { if (ModelState.IsValid) { try { //generico.Id = Guid.NewGuid(); _context.Add(generico); await _context.SaveChangesAsync(); } catch (Exception e) { throw new Exception(e.Message); } return(RedirectToAction(nameof(Index))); } return(View(generico)); }
public override string RecepcionarLoteRps() { string retornar = string.Empty; string XMLRetorno = RequestWS(Envelopar(ArquivoXml, CabecMsg, "RecepcionarLoteRpsSincrono"), WSSoap.EnderecoWeb, WSSoap.ActionSoap.Replace("{metodo}", "ARECEPCIONARLOTERPSSINCRONO")); MemoryStream stream = Generico.StringXmlToStream(XMLRetorno); XmlDocument doc = new XmlDocument(); doc.Load(stream); XmlNodeList xmlList = doc.GetElementsByTagName("outputXML"); retornar = Generico.TrataCaracteres(xmlList[0].OuterXml).Replace("<outputXML>", "").Replace("</outputXML>", ""); return(retornar.ToString()); }
private void button1_Click(object sender, EventArgs e) { Produto produto = null; if (rbGenerico.Checked) { produto = new Generico(); } else if (rbSapato.Checked) { produto = new Sapato(); } else if (rbCamisa.Checked) { produto = new Camisa(); } produto.Nome = txtNome.Text; produto.Categoria = txtCategoria.Text; produto.Foto = txtFoto.Text; try { produto.Preco = float.Parse(txtPreco.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } /* * { * MessageBox.Show("Coloque um valor de preço menor ou igual a 1,99"); * } * else * {*/ listBoxProdutos.Items.Add(txtNome.Text); loja.adicionarProduto(produto); apagarCampos(); loja.escreveTxtProdutos(); // } }
public void GenericItemAddtoInventory() { // Limpa o inventário Inventario.getInstance().RemoveAll(); // Cria um item com o id 123 Item _item = new Generico(123); // Diz ao item para se adicionar ao inventário com instancia 0 bool result = _item.AddToInventario(Inventario.getInstance()); // Vai ao inventário buscar o item com o id 123 Item _item2 = (Item)Inventario.getInstance(0).GetItemById(123); // Verifica se o tipo do item buscado corresponde Assert.AreEqual(_item2.Tipo, (new Generico(1)).GetType()); // Verifica se foi adicionado Assert.IsTrue(result); }
public void EditaItem_Inventario() { int id = 20; var _inv = Inventario.getInstance(id); _inv.RemoveAll(); var _item1 = new Generico(1, "DESC"); _inv.Adiciona(_item1); var _item2 = new Generico(1, "ADIHDSAUDYAISUDSAD"); _inv.Edita(_item2); Assert.AreEqual( _item2.Descricao , (_inv.GetItemById(1) as Generico).Descricao ); }
public void UpdateGenerico(Generico g) { using (var connection = new SqlConnection(_connectionString)) { connection.Open(); connection.Execute(@" USE [tick] UPDATE [dbo].[Generico] SET [gnr_Nome] = @gnr_Nome ,[gnr_Marca] = @gnr_Marca ,[gnr_Modello] = @gnr_Modello ,[gnr_Serie] = @gnr_Serie ,[gnr_Descrizione] = @gnr_Descrizione ,[gnr_UltimaInstallazione] = @gnr_UltimaInstallazione ,[gnr_UltimoIntervento] =@gnr_UltimoIntervento ,[gnr_OreUltimoIntervento] = @gnr_OreUltimoIntervento ,[gnr_Impianto] = @gnr_Impianto ,[gnr_Rimosso] = @gnr_Rimosso WHERE gnr_Id = @gnr_Id", g); } }
static void Main(string[] args) { int i = 1; Console.Write("as" + i + 1 + "asd"); //Testando Lista Encadeada. Lista simples = new Encadeada(); simples.Add(new Generico("teste1")); simples.Add(new Generico("teste2")); simples.Add(new Generico("teste3")); simples.Add(new Generico("teste4")); Dados rem = new Generico("teste3"); simples.Remover(rem); //Testando Lista Circular Lista circular = new Circular(); simples.Add(new Generico("teste1")); simples.Add(new Generico("teste2")); simples.Add(new Generico("teste3")); simples.Add(new Generico("teste4")); Dados rem2 = new Generico("teste4"); circular.Remover(rem); //Testando Lista duplamente encadeada Lista dupla = new Duplamente_Encadeada(); dupla.Add(new Generico("teste1")); dupla.Add(new Generico("teste2")); dupla.Add(new Generico("teste3")); dupla.Add(new Generico("teste4")); Dados rem3 = new Generico("teste4"); Console.ReadLine(); }
public override RetornoTransmitir LerRetorno(FrgNFSe nota, XmlDocument xmlResposta) { var sucesso = false; var cancelamento = false; var numeroNF = ""; var numeroRPS = ""; DateTime?dataEmissaoRPS = null; var situacaoRPS = ""; var codigoVerificacao = ""; var protocolo = ""; long numeroLote = nota.Documento.TDFe.Tide.FNumeroLote; var descricaoProcesso = ""; var descricaoErro = ""; var area = EnumAreaLeitura.Nenhum; var codigoErroOuAlerta = ""; var _EnumRespostaRPS = EnumRespostaRPS.Nenhum; var linkImpressaoAux = string.Empty; var numNF = nota.Documento.TDFe.Tide.FNumeroLote.ToString(); using (XmlReader x = new XmlNodeReader(xmlResposta)) { while (x.Read()) { if (x.NodeType == XmlNodeType.Element && area != EnumAreaLeitura.Erro) { switch (_EnumRespostaRPS) { case EnumRespostaRPS.Nenhum: #region "EnumRespostaRPS" { switch (x.Name.ToString().ToLower()) { case "retorno": // Consultar RPS _EnumRespostaRPS = EnumRespostaRPS.ConsultarNfseRpsResposta; break; } break; } #endregion "EnumRespostaRPS" case EnumRespostaRPS.EnviarLoteRpsResposta: { switch (x.Name.ToString().ToLower()) { case "protocolo": protocolo = x.ReadString(); sucesso = true; break; case "listamensagemretorno": case "mensagemretorno": area = EnumAreaLeitura.Erro; break; } break; } case EnumRespostaRPS.ConsultarNfseRpsResposta: { switch (x.Name.ToString().ToLower()) { case "codigo": if (x.ReadString().ToLower().Contains("sucesso")) { sucesso = true; } else { area = EnumAreaLeitura.Erro; } break; case "numero_nfse": if (numeroNF.Equals("")) { numeroNF = x.ReadString(); } else if (numeroRPS.Equals("")) { numeroRPS = x.ReadString(); //long.TryParse(numeroRPS, out numeroLote); } break; case "data_nfse": DateTime emissao; DateTime.TryParse(x.ReadString(), out emissao); dataEmissaoRPS = emissao; break; case "situacao_codigo_nfse": if (x.ReadString().Equals("2")) { sucesso = true; situacaoRPS = "C"; } break; case "datahoracancelamento": if (cancelamento) { sucesso = true; situacaoRPS = "C"; } break; case "cod_verificador_autenticidade": codigoVerificacao = x.ReadString(); break; case "link_nfse": linkImpressaoAux = x.ReadString(); break; case "listamensagemretorno": case "mensagemretorno": area = EnumAreaLeitura.Erro; break; } break; } case EnumRespostaRPS.CancelarNfseResposta: { switch (x.Name.ToString().ToLower()) { case "cancelamento": cancelamento = true; break; case "datahoracancelamento": if (cancelamento) { sucesso = true; situacaoRPS = "C"; } break; case "numero": if (numeroNF.Equals("")) { numeroNF = x.ReadString(); } else if (numeroRPS.Equals("")) { numeroRPS = x.ReadString(); //long.TryParse(numeroRPS, out numeroLote); } break; case "listamensagemretorno": case "mensagemretorno": area = EnumAreaLeitura.Erro; break; } break; } } } #region Erro if (area == EnumAreaLeitura.Erro) { if (x.NodeType == XmlNodeType.Element && x.Name == "codigo") { codigoErroOuAlerta = x.ReadString(); } else if (x.NodeType == XmlNodeType.Element && x.Name == "mensagem") { if (string.IsNullOrEmpty(descricaoErro)) { descricaoErro = string.Concat("[", codigoErroOuAlerta, "] ", x.ReadString()); codigoErroOuAlerta = ""; } else { descricaoErro = string.Concat(descricaoErro, "\n", "[", codigoErroOuAlerta, "] ", x.ReadString()); codigoErroOuAlerta = ""; } } else if (x.NodeType == XmlNodeType.Element && x.Name == "correcao") { var correcao = x.ReadString().ToString().Trim() ?? ""; if (correcao != "") { descricaoErro = string.Concat(descricaoErro, " ( Sugestão: " + correcao + " ) "); } } } #endregion Erro } x.Close(); } var dhRecbto = ""; var error = ""; var success = ""; if (dataEmissaoRPS != null && dataEmissaoRPS.Value != null) { nota.Documento.TDFe.Tide.DataEmissaoRps = dataEmissaoRPS.Value; nota.Documento.TDFe.Tide.DataEmissao = dataEmissaoRPS.Value; dhRecbto = dataEmissaoRPS.Value.ToString(); } var xMotivo = descricaoErro != "" ? string.Concat(descricaoProcesso, "[", descricaoErro, "]") : descricaoProcesso; if ((sucesso && !string.IsNullOrEmpty(numeroNF)) || (!string.IsNullOrEmpty(numNF) && Generico.MesmaNota(numeroNF, numNF) && situacaoRPS != "")) { sucesso = true; success = "Sucesso"; } else { var msgRetornoAux = xMotivo; if ((msgRetornoAux.Contains("O numero do lote do contribuinte informado, já existe.") || msgRetornoAux.Contains("O número do lote do contribuinte informado, já existe.")) && msgRetornoAux.Contains("Protocolo:")) { var protocoloAux = msgRetornoAux.Substring(msgRetornoAux.LastIndexOf("Protocolo: ") + 10); protocoloAux = Generico.RetornarApenasNumeros(protocoloAux); if (!String.IsNullOrEmpty(protocoloAux)) { protocolo = protocoloAux; xMotivo = String.Empty; } } error = xMotivo; if (string.IsNullOrEmpty(xMotivo)) { if (protocolo != "") { error = "Não foi possível finalizar a transmissão. Aguarde alguns minutos e execute um consulta para finalizar a operação. Protocolo gerado: " + protocolo.ToString().Trim(); } else { error = "Não foi possível finalizar a transmissão. Tente novamente mais tarde ou execute uma consulta."; } } } var cStat = ""; var xml = ""; if (sucesso && situacaoRPS != "C") { cStat = "100"; nota.Documento.TDFe.Tide.FStatus = EnumNFSeRPSStatus.srNormal; xMotivo = "NFSe Normal"; } else if (sucesso && situacaoRPS == "C") { cStat = "101"; nota.Documento.TDFe.Tide.FStatus = EnumNFSeRPSStatus.srCancelado; xMotivo = "NFSe Cancelada"; } //if (cStat == "100" || cStat == "101") //{ //var xmlRetorno = nota.MontarXmlRetorno(nota, numeroNF, protocolo); xml = xmlResposta.OuterXml; //} return(new RetornoTransmitir(error, success) { chave = numeroNF != "" && numeroNF != "0" ? GerarChaveNFSe(nota.Documento.TDFe.TPrestador.FIdentificacaoPrestador.FEmitIBGEUF, nota.Documento.TDFe.Tide.DataEmissaoRps, nota.Documento.TDFe.TPrestador.FCnpj, numeroNF, 56) : "", cStat = cStat, xMotivo = xMotivo, numero = numeroNF, nProt = protocolo, xml = xml, digVal = codigoVerificacao, NumeroLote = numeroLote, NumeroRPS = numeroRPS, DataEmissaoRPS = dataEmissaoRPS, dhRecbto = dhRecbto, CodigoRetornoPref = codigoErroOuAlerta, LinkImpressao = linkImpressaoAux }); }
public static Generico validarUsuario(string usuario, string password) { Generico generico = new Generico(); Utils.adoDAL ado = new Utils.adoDAL(); UserPlayer Usuario = new UserPlayer(); int idUser; try { ado.Conectar(); ado.CrearComando(@" IF EXISTS (SELECT UserName FROM Users WHERE UPPER(UserName) = UPPER(@UserName)) BEGIN SELECT idUser AS VALUE FROM Users WHERE UPPER(UserName) = UPPER(@UserName) END ELSE BEGIN SELECT 0 AS VALUE END "); ado.Comando.Parameters.Add(new SqlParameter("@UserName", usuario)); DbDataReader reader = ado.EjecutarConsulta(); if (reader.HasRows) { reader.Read(); if (Convert.ToInt16(reader["VALUE"]) == 0) { generico.existeError = true; generico.mensaje = "Usuario No Existe"; } else { idUser = Convert.ToInt16(reader["VALUE"]); reader.Close(); ado.CrearComando(@" SELECT U.idUser, U.UserName, U.FirstName, U.LastName, U.DateOfBirth, U.Email, U.idSecurityUser, U.Active, SU.SecurityUserDescr FROM Users AS U JOIN SecurityUser SU ON SU.idSecurityUser = U.idSecurityUser WHERE idUser = @idUser "); ado.Comando.Parameters.Add(new SqlParameter("@idUser", idUser)); reader = ado.EjecutarConsulta(); if (reader.HasRows) { reader.Read(); Usuario.idUser = Convert.ToInt32(reader["idUser"]); Usuario.UserName = Convert.ToString(reader["UserName"]); Usuario.FirstName = Convert.ToString(reader["FirstName"]); Usuario.LastName = Convert.ToString(reader["LastName"]); Usuario.DateOfBirth = Convert.ToDateTime(reader["DateOfBirth"]); Usuario.Email = Convert.ToString(reader["Email"]); Usuario.Active = Convert.ToBoolean(reader["Active"]); Usuario.idSecurityUser = Convert.ToInt32(reader["idSecurityUser"]); Usuario.SecurityUserDescr = Convert.ToString(reader["SecurityUserDescr"]); //suario.UserPassword = Convert.ToString(reader["UserPassword"]); generico.obj = Usuario; } } } else { generico.existeError = true; generico.mensaje = "Usuario No Existe"; } } catch (SqlException sqlEx) { generico.existeError = true; generico.mensaje = sqlEx.Message; } catch (Exception ex) { generico.existeError = true; generico.mensaje = ex.Message; } finally { ado.Desconectar(); } return(generico); }
public override XmlDocument GeraXmlNota(FrgNFSe nota) { var doc = new XmlDocument(); #region EnviarLoteRpsEnvio var nodeEnviarLoteRpsEnvio = CriaHeaderXml("EnviarLoteRpsEnvio", ref doc); #region LoteRps var nodeLoteRps = Extensions.CriarNo(doc, nodeEnviarLoteRpsEnvio, "LoteRps", "", "Id", "L" + nota.Documento.TDFe.Tide.FNumeroLote); var vsAttribute = doc.CreateAttribute("versao"); vsAttribute.Value = "2.04"; nodeLoteRps.Attributes.Append(vsAttribute); Extensions.CriarNoNotNull(doc, nodeLoteRps, "NumeroLote", nota.Documento.TDFe.Tide.FNumeroLote.ToString()); #region Prestador var nodePrestador = Extensions.CriarNo(doc, nodeLoteRps, "Prestador"); var CPFCNPJNode = Extensions.CriarNo(doc, nodePrestador, "CpfCnpj"); Extensions.CriarNoNotNull(doc, CPFCNPJNode, "Cnpj", nota.Documento.TDFe.TPrestador.FCnpj); Extensions.CriarNoNotNull(doc, nodePrestador, "InscricaoMunicipal", nota.Documento.TDFe.TPrestador.FInscricaoMunicipal); #endregion fim - Prestador Extensions.CriarNoNotNull(doc, nodeLoteRps, "QuantidadeRps", "1"); #region ListaRps var nodeListarps = Extensions.CriarNo(doc, nodeLoteRps, "ListaRps"); #region Rps var rpsNode = Extensions.CriarNo(doc, nodeListarps, "Rps"); #region InfDeclaracaoPrestacaoServico var nodeInfDeclaracaoPrestacaoServico = Extensions.CriarNo(doc, rpsNode, "InfDeclaracaoPrestacaoServico"); #region RPS var nodeRPS = Extensions.CriarNo(doc, nodeInfDeclaracaoPrestacaoServico, "Rps"); vsAttribute = doc.CreateAttribute("Id"); vsAttribute.Value = "rps" + nota.Documento.TDFe.Tide.FIdentificacaoRps.FNumero; nodeRPS.Attributes.Append(vsAttribute); #region "IdentificacaoRps" var nodeIdentificacaoRps = Extensions.CriarNo(doc, nodeRPS, "IdentificacaoRps"); Extensions.CriarNoNotNull(doc, nodeIdentificacaoRps, "Numero", nota.Documento.TDFe.Tide.FIdentificacaoRps.FNumero); Extensions.CriarNoNotNull(doc, nodeIdentificacaoRps, "Serie", nota.Documento.TDFe.Tide.FIdentificacaoRps.FSerie); Extensions.CriarNoNotNull(doc, nodeIdentificacaoRps, "Tipo", nota.Documento.TDFe.Tide.FIdentificacaoRps.FTipo.ToString()); #endregion Extensions.CriarNoNotNull(doc, nodeRPS, "DataEmissao", nota.Documento.TDFe.Tide.DataEmissaoRps.ToString("yyyy-MM-dd")); Extensions.CriarNoNotNull(doc, nodeRPS, "Status", ((int)nota.Documento.TDFe.Tide.FStatus).ToString()); #endregion Extensions.CriarNoNotNull(doc, nodeInfDeclaracaoPrestacaoServico, "Competencia", nota.Documento.TDFe.Tide.DataEmissaoRps.ToString("yyyy-MM-dd")); #region Servico var nodeServico = Extensions.CriarNo(doc, nodeInfDeclaracaoPrestacaoServico, "Servico"); #region Valores var nodeServicoValores = Extensions.CriarNo(doc, nodeServico, "Valores"); Extensions.CriarNoNotNull(doc, nodeServicoValores, "ValorServicos", Generico.FormataValor(nota.Documento.TDFe.TServico.FValores.FValorServicos, 2)); Extensions.CriarNoNotNull(doc, nodeServicoValores, "ValorDeducoes", Generico.FormataValor(nota.Documento.TDFe.TServico.FValores.FValorDeducoes, 2)); Extensions.CriarNoNotNull(doc, nodeServicoValores, "ValorPis", Generico.FormataValor(nota.Documento.TDFe.TServico.FValores.FValorPis, 2)); Extensions.CriarNoNotNull(doc, nodeServicoValores, "ValorCofins", Generico.FormataValor(nota.Documento.TDFe.TServico.FValores.FValorCofins, 2)); Extensions.CriarNoNotNull(doc, nodeServicoValores, "ValorInss", Generico.FormataValor(nota.Documento.TDFe.TServico.FValores.FValorInss, 2)); Extensions.CriarNoNotNull(doc, nodeServicoValores, "ValorIr", Generico.FormataValor(nota.Documento.TDFe.TServico.FValores.FValorIr, 2)); Extensions.CriarNoNotNull(doc, nodeServicoValores, "ValorCsll", Generico.FormataValor(nota.Documento.TDFe.TServico.FValores.FValorCsll, 2)); Extensions.CriarNoNotNull(doc, nodeServicoValores, "OutrasRetencoes", Generico.FormataValor(nota.Documento.TDFe.TServico.FValores.FvalorOutrasRetencoes, 2)); Extensions.CriarNoNotNull(doc, nodeServicoValores, "ValorIss", Generico.FormataValor(nota.Documento.TDFe.TServico.FValores.FValorIss, 2)); Extensions.CriarNoNotNull(doc, nodeServicoValores, "Aliquota", nota.Documento.TDFe.TServico.FValores.FAliquota > 0 ? Generico.FormataValor(nota.Documento.TDFe.TServico.FValores.FAliquota, 2) : "0.00"); Extensions.CriarNoNotNull(doc, nodeServicoValores, "DescontoIncondicionado", Generico.FormataValor(nota.Documento.TDFe.TServico.FValores.FDescontoIncondicionado, 2)); Extensions.CriarNoNotNull(doc, nodeServicoValores, "DescontoCondicionado", Generico.FormataValor(nota.Documento.TDFe.TServico.FValores.FDescontoCondicionado, 2)); #endregion FIM - Valores Extensions.CriarNoNotNull(doc, nodeServico, "IssRetido", Generico.ImpostoRetido((EnumNFSeSituacaoTributaria)nota.Documento.TDFe.TServico.FValores.FIssRetido, 1)); if (Generico.ImpostoRetido((EnumNFSeSituacaoTributaria)nota.Documento.TDFe.TServico.FValores.FIssRetido, 1) == "1") { Extensions.CriarNoNotNull(doc, nodeServico, "ResponsavelRetencao", nota.Documento.TDFe.TServico.FResponsavelRetencao.ToString()); } Extensions.CriarNoNotNull(doc, nodeServico, "ItemListaServico", nota.Documento.TDFe.TServico.FItemListaServico); Extensions.CriarNoNotNull(doc, nodeServico, "CodigoCnae", Generico.RetornarApenasNumeros(nota.Documento.TDFe.TServico.FCodigoCnae)); Extensions.CriarNoNotNull(doc, nodeServico, "CodigoTributacaoMunicipio", Generico.RetornaApenasLetrasNumeros(nota.Documento.TDFe.TServico.FCodigoTributacaoMunicipio)); Extensions.CriarNoNotNull(doc, nodeServico, "Discriminacao", Generico.TratarString(nota.Documento.TDFe.TServico.FDiscriminacao)); Extensions.CriarNoNotNull(doc, nodeServico, "CodigoMunicipio", nota.Documento.TDFe.TServico.FMunicipioIncidencia); Extensions.CriarNoNotNull(doc, nodeServico, "ExigibilidadeISS", nota.Documento.TDFe.TServico.FExigibilidadeISS.ToString()); Extensions.CriarNoNotNull(doc, nodeServico, "MunicipioIncidencia", nota.Documento.TDFe.TServico.FMunicipioIncidencia); #endregion FIM - Servico #region PrestadorNota var nodePrestadorNota = Extensions.CriarNo(doc, nodeInfDeclaracaoPrestacaoServico, "Prestador"); var CPFCNPJPrestadorNode = Extensions.CriarNo(doc, nodePrestadorNota, "CpfCnpj"); Extensions.CriarNoNotNull(doc, CPFCNPJPrestadorNode, "Cnpj", nota.Documento.TDFe.TPrestador.FCnpj); Extensions.CriarNoNotNull(doc, nodePrestadorNota, "InscricaoMunicipal", nota.Documento.TDFe.TPrestador.FInscricaoMunicipal); #endregion FIM - Prestador #region TomadorServico var nodeTomadorServico = Extensions.CriarNo(doc, nodeInfDeclaracaoPrestacaoServico, "TomadorServico"); #region IdentificacaoTomador var nodeIdentificacaoTomador = Extensions.CriarNo(doc, nodeTomadorServico, "IdentificacaoTomador"); var CPFCNPJTomador = Extensions.CriarNo(doc, nodeIdentificacaoTomador, "CpfCnpj"); if (nota.Documento.TDFe.TTomador.TIdentificacaoTomador.FPessoa == "F") { Extensions.CriarNoNotNull(doc, CPFCNPJTomador, "Cpf", nota.Documento.TDFe.TTomador.TIdentificacaoTomador.FCpfCnpj); } else { Extensions.CriarNoNotNull(doc, CPFCNPJTomador, "Cnpj", nota.Documento.TDFe.TTomador.TIdentificacaoTomador.FCpfCnpj); } #endregion IdentificacaoTomador Extensions.CriarNoNotNull(doc, nodeTomadorServico, "RazaoSocial", Generico.TratarString(nota.Documento.TDFe.TTomador.FRazaoSocial)); #region Endereco var nodeTomadorEndereco = Extensions.CriarNo(doc, nodeTomadorServico, "Endereco"); Extensions.CriarNoNotNull(doc, nodeTomadorEndereco, "Endereco", Generico.TratarString(nota.Documento.TDFe.TTomador.TEndereco.FEndereco)); Extensions.CriarNoNotNull(doc, nodeTomadorEndereco, "Numero", nota.Documento.TDFe.TTomador.TEndereco.FNumero); //Extensions.CriarNoNotNull(doc, nodeTomadorEndereco, "Complemento", Generico.TratarString(nota.Documento.TDFe.TTomador.TEndereco.FComplemento)); Extensions.CriarNoNotNull(doc, nodeTomadorEndereco, "Bairro", Generico.TratarString(nota.Documento.TDFe.TTomador.TEndereco.FBairro)); Extensions.CriarNoNotNull(doc, nodeTomadorEndereco, "CodigoMunicipio", nota.Documento.TDFe.TTomador.TEndereco.FCodigoMunicipio); Extensions.CriarNoNotNull(doc, nodeTomadorEndereco, "Uf", nota.Documento.TDFe.TTomador.TEndereco.FUF); Extensions.CriarNoNotNull(doc, nodeTomadorEndereco, "Cep", Generico.RetornarApenasNumeros(nota.Documento.TDFe.TTomador.TEndereco.FCEP)); #endregion FIM - Endereco #region Contato var nodeTomadorContato = Extensions.CriarNo(doc, nodeTomadorServico, "Contato"); Extensions.CriarNoNotNull(doc, nodeTomadorContato, "Telefone", Generico.RetornarApenasNumeros(nota.Documento.TDFe.TTomador.TContato.FDDD + nota.Documento.TDFe.TTomador.TContato.FFone)); //Extensions.CriarNoNotNull(doc, nodeTomadorContato, "Email", nota.Documento.TDFe.TTomador.TContato.FEmail); #endregion FIM - Contato #endregion FIM - Tomador //Extensions.CriarNoNotNull(doc, nodeInfDeclaracaoPrestacaoServico, "RegimeEspecialTributacao", nota.Documento.TDFe.Tide.FRegimeEspecialTributacao.ToString()); Extensions.CriarNoNotNull(doc, nodeInfDeclaracaoPrestacaoServico, "OptanteSimplesNacional", nota.Documento.TDFe.Tide.FOptanteSimplesNacional.ToString()); Extensions.CriarNoNotNull(doc, nodeInfDeclaracaoPrestacaoServico, "IncentivoFiscal", nota.Documento.TDFe.Tide.FIncentivadorCultural.ToString()); #endregion FIM - nodeInfDeclaracaoPrestacaoServico #endregion FIM - Rps #endregion FIM - ListaRps #endregion LoteRps #endregion EnviarLoteRpsEnvio return(doc); }
protected void btnLogin_Click(object sender, EventArgs e) { divMsg.Visible = false; Int64 TestParseUserNum = 0; if (String.IsNullOrEmpty(txtUser.Text)) { txtUser.Focus(); lblMessage.Text = "*Capturar Usuario!"; divMsg.Visible = true; } else if (String.IsNullOrWhiteSpace(txtUser.Text)) { txtUser.Text = String.Empty; txtUser.Focus(); lblMessage.Text = "*Capturar Usuario!"; divMsg.Visible = true; } else if (Int64.TryParse(txtUser.Text, out TestParseUserNum)) { txtUser.Text = String.Empty; txtUser.Focus(); lblMessage.Text = "*El Usuario no puede ser solo numeros"; divMsg.Visible = true; } else if (txtUser.Text.Length > 15) { txtUser.Focus(); lblMessage.Text = "*Usuario debe ser Max 15 Caracteres!"; divMsg.Visible = true; } /****** END User *******/ else if (String.IsNullOrEmpty(txtPassword.Text)) { txtPassword.Focus(); lblMessage.Text = "*Capturar Password!"; divMsg.Visible = true; } else if (String.IsNullOrWhiteSpace(txtPassword.Text)) { txtPassword.Text = String.Empty; txtPassword.Focus(); lblMessage.Text = "*Capturar Password!"; divMsg.Visible = true; } else if (txtPassword.Text.Length < 8) { txtPassword.Text = String.Empty; txtPassword.Focus(); lblMessage.Text = "*Password Min 8 Caracteres!"; divMsg.Visible = true; } /****** END Password *******/ /****** ReCaptcha *******/ else if (String.IsNullOrEmpty(hiddenValue.Value)) { lblMessage.Text = "*Pasar Prueba Recaptcha!"; divMsg.Visible = true; } /****** END ReCaptcha *******/ else { Generico generico = DB_Login.validarUsuario(txtUser.Text, txtPassword.Text); UserPlayer Usuario = generico.obj as UserPlayer; if (generico.existeError) { txtUser.Text = String.Empty; txtUser.Focus(); lblMessage.Text = "*Usuario No Existe!"; divMsg.Visible = true; } else if (Usuario.UserPassword == txtPassword.Text) { txtPassword.Text = String.Empty; txtPassword.Focus(); lblMessage.Text = "*Password Incorrecto!"; divMsg.Visible = true; } else { Session.Add("Player", Usuario); btnLogin.Enabled = false; FormsAuthentication.RedirectFromLoginPage(String.Concat(txtUser.Text, ": ", Usuario.FirstName + " " + Usuario.LastName).ToUpper(), false); } } }