static void Main(string[] args) { Produto produto1 = new Produto(1, "Caneta", 2.50, 10); Produto produto2 = new Produto(1, "Lápis", 1.50, 10); Produto produto3 = new Produto(1, "Borracha", 1.50, 10); Cliente cliente = new Cliente(10, "João"); FormaPagamento fDinheiro = new FormaPagamento(01, "Dinheiro"); FormaPagamento fCartao = new FormaPagamento(02, "Cartão"); //criando um pedido pedidoJoao = new Pedido(1, new DateTime(2022, 03, 01), cliente, new List <Produto> () { produto1, produto2 } ); pedidoJoao.Produtos.Add(produto3); pedidoJoao.FormasPagamentos.Add(fDinheiro); pedidoJoao.FormasPagamentos.Add(fCartao); //imprimir pedido ImprimirPedido(); }
public void PreencheCampos(FormaPagamento formaPagamento) { this.formaPagamento = formaPagamento; tbCodigoFormaPagamento.Text = this.formaPagamento != null?formaPagamento.FormaPagamentoID.ToString() : ""; tbNomeFormaPagamento.Text = this.formaPagamento != null ? this.formaPagamento.Nome : ""; }
private Int64?VerificarFormaPagamento(string pValor) { try { if (pValor.EstaVazio()) { return(null); } var chaveFormaDePagamento = _context.FormaPagamentos.Where(pX => pX.Categoria.ToLower().Trim() == pValor.ToLower().Trim()).FirstOrDefault()?.ChaveFormaPagamento; if (chaveFormaDePagamento == null) { var incluirFormaPagamento = new FormaPagamento() { ChaveFormaPagamento = ++chaveFormaPagamento, Categoria = pValor, Tipo = "Cartão", Descricao = "Nubank", Ativo = true, }; _context.FormaPagamentos.Add(incluirFormaPagamento); _context.SaveChanges(); return(incluirFormaPagamento.ChaveFormaPagamento); } return(chaveFormaDePagamento); } catch (Exception error) { throw new Exception($"Erro ao cadastra File: {error}"); } }
public IHttpActionResult PutFormaPagamento(int id, FormaPagamento formaPagamento) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != formaPagamento.ID) { return(BadRequest()); } db.Entry(formaPagamento).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!FormaPagamentoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> Atualizar(FormaPagamento formaPagamento) { if (ModelState.IsValid) { using var client = new HttpClient(); var formaPagamentoJson = JsonConvert.SerializeObject(formaPagamento); var content = new StringContent(formaPagamentoJson, Encoding.UTF8, "application/json"); var result = await client.PutAsync(Program.formaPagamentoApi, content); TempData["Error"] = string.Empty; if (result.IsSuccessStatusCode) { return(RedirectToAction("FormaPagamento", "Financeiro")); } else { TempData["Error"] = result.Content.ReadAsStringAsync().Result; return(View("../Financeiro/EditarFormaPagamento")); } } else { return(View("../Financeiro/EditarFormaPagamento")); } }
private void Salvar(object objParam) { var focusedElement = Keyboard.FocusedElement as FrameworkElement; if (focusedElement is TextBox) { var expression = focusedElement.GetBindingExpression(TextBox.TextProperty); if (expression != null && expression.ParentBinding.UpdateSourceTrigger == System.Windows.Data.UpdateSourceTrigger.LostFocus) { expression.UpdateSource(); } } Validate(); if (!HasErrors) { Retorno objRetorno; using (var objBLL = new FormaPagamento()) { objRetorno = objBLL.SalvarFormaPagamento(objFormaPagamento, FrameworkUtil.objConfigStorage.objFuncionario.fun_codigo); } if (objRetorno.intCodigoErro == 0) { objFormaPagamento = null; ClearAllErrorsAsync(); base.enStatusTelaAtual = enStatusTela.Navegacao; Pesquisar(null); } else { MessageBox.Show(objRetorno.strMsgErro, "Atenção", MessageBoxButton.OK, Util.GetMessageImage(objRetorno.intCodigoErro)); } } }
private void Excluir(object objParam) { if (objParam != null) { if (MessageBox.Show("Tem Certeza que deseja excluir o registro selecionado?", "Atenção", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { Retorno objRetorno; using (var objBLL = new FormaPagamento()) { objRetorno = objBLL.ExcluirFormaPagamento((int)objParam); } if (objRetorno.intCodigoErro == 0) { objFormaPagamento = null; ClearAllErrorsAsync(); base.enStatusTelaAtual = enStatusTela.Navegacao; Pesquisar(null); } else { MessageBox.Show(objRetorno.strMsgErro, "Atenção", MessageBoxButton.OK, Util.GetMessageImage(objRetorno.intCodigoErro)); } } } }
public bool UpdateFormaPagamento(FormaPagamento formaPagamento) { try { Open(); string updateCargo = @"UPDATE FormaPagamento SET dsFormaPagamento = @dsFormaPagamento, flSituacao = @flSituacao, dtUltAlteracao = @dtUltAlteracao WHERE IdFormaPagamento = @IdFormaPagamento"; SqlCommand sql = new SqlCommand(updateCargo, sqlconnection); sql.CommandType = CommandType.Text; sql.Parameters.AddWithValue("@IdFormaPagamento", formaPagamento.IdFormaPagamento); sql.Parameters.AddWithValue("@dsFormaPagamento", formaPagamento.dsFormaPagamento.ToUpper()); sql.Parameters.AddWithValue("@flSituacao", formaPagamento.flSituacao); sql.Parameters.AddWithValue("@dtUltAlteracao", formaPagamento.dtUltAlteracao = DateTime.Now); int i = sql.ExecuteNonQuery(); if (i >= 1) { return(true); } else { return(false); } } catch (Exception e) { throw new Exception("Erro ao Atualizar Forma Pagamento: " + e.Message); } finally { Close(); } }
public CartaoCredito GetCartaoCredito(FormaPagamento _formaPagamento) { //Global.AccessToken = Global.Auth.access_token; //Global.Url = Global.Auth.instance_url; var _urlAccountApi = Global.Global.Auth.instance_url + "/services/data/v43.0/query/?q= SELECT Id, " + "nome_titular__c, val_cartao__C, cod_seguranca__c, Name FROM credit_card__c " + "WHERE Id = '" + _formaPagamento.idCartao + "'"; HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", Global.Global.Auth.access_token); var response = client.GetAsync(_urlAccountApi).Result; try { var conteudoResposta = response.Content.ReadAsStringAsync().Result; var formaApi = JsonConvert.DeserializeObject <CartaoCredito>(conteudoResposta); return(formaApi.records[0]); } catch (Exception e) { //(response.IsSuccessStatusCode) throw; } }
public IEnumerable <FormaPagamento> SelecionarFormaPagamento() { try { Open(); SQL = new SqlCommand(@"SELECT * FROM FormaPagamento", sqlconnection); SQL.CommandType = CommandType.Text; Dr = SQL.ExecuteReader(); // Criando uma lista vazia var lista = new List <FormaPagamento>(); while (Dr.Read()) { var servico = new FormaPagamento() { IdFormaPagamento = Convert.ToInt32(Dr["IdFormaPagamento"]), dsFormaPagamento = Convert.ToString(Dr["dsFormaPagamento"]), flSituacao = Convert.ToString(Dr["flSituacao"]), dtCadastro = Dr["dtCadastro"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(Dr["dtCadastro"]), dtUltAlteracao = Dr["dtUltAlteracao"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(Dr["dtUltAlteracao"]), }; lista.Add(servico); } return(lista); } catch (Exception e) { throw new Exception("Erro ao selecionar o Forma Pagamento: " + e.Message); } finally { Close(); } }
public bool InsertFormaPagamento(FormaPagamento formaPagamento) { try { Open(); string insertCargo = @"INSERT INTO FormaPagamento (dsFormaPagamento, flSituacao ,dtCadastro) VALUES(@dsFormaPagamento,@flSituacao, @dtCadastro)"; SQL = new SqlCommand(insertCargo, sqlconnection); SQL.CommandType = CommandType.Text; SQL.Parameters.AddWithValue("@dsFormaPagamento", formaPagamento.dsFormaPagamento.ToUpper()); SQL.Parameters.AddWithValue("@flSituacao", formaPagamento.flSituacao); SQL.Parameters.AddWithValue("@dtCadastro", formaPagamento.dtCadastro = DateTime.Now); int i = SQL.ExecuteNonQuery(); if (i >= 1) { return(true); } else { return(false); } } catch (Exception e) { throw new Exception("Erro ao Adicionar Novo Forma Pagamento: " + e.Message); } finally { Close(); } }
public List <FormaPagamento> ListarFormaPagamento() { List <FormaPagamento> lista = new List <FormaPagamento>(); try { this.abrirConexao(); string sql = "select id_formapag,tipo_formapag from formapag"; SqlCommand comando = new SqlCommand(sql, sqlConn); SqlDataReader dr = comando.ExecuteReader(); while (dr.Read()) { FormaPagamento fp = new FormaPagamento(); fp.Id_formapag = dr.GetInt32(dr.GetOrdinal("id_formapag")); fp.Tipo_formapag = dr.GetString(dr.GetOrdinal("tipo_formapag")); lista.Add(fp); } dr.Close(); comando.Dispose(); } catch (Exception ex) { throw new Exception("Erro ao Listar Formas de Pagamento\n " + ex.Message); } finally { this.fecharConexao(); } return(lista); }
public List<FormaPagamento> GetFormaPagamentos() { try { AbrirConexao(); SqlQuery = new SqlCommand("SELECT * FROM tbFormaPagamentos", con); reader = SqlQuery.ExecuteReader(); var lista = new List<FormaPagamento>(); while (reader.Read()) { var formaPagamento = new FormaPagamento { idFormaPagamento = Convert.ToInt32(reader["idformapagamento"]), nmFormaPagamento = Convert.ToString(reader["nmformapagamento"]), dtCadastro = Convert.ToDateTime(reader["dtCadastro"]), dtAtualizacao = Convert.ToDateTime(reader["dtAtualizacao"]) }; lista.Add(formaPagamento); } return lista; } catch (Exception error) { throw new Exception(error.Message); } finally { FecharConexao(); } }
public void VerificaDuplicidade(string nmFormaPagamento, int? idFormaPagamento) { try { AbrirConexao(); var _where = string.Empty; if (idFormaPagamento > 0) { _where = " WHERE tbFormaPagamentos.nmformapagamento = '" + nmFormaPagamento + "'" + "AND tbFormaPagamentos.idformapagamento <>" + idFormaPagamento; } else { _where = " WHERE tbFormaPagamentos.nmformapagamento = '" + nmFormaPagamento + "'"; } SqlQuery = new SqlCommand("SELECT * FROM tbFormaPagamentos" + _where, con); reader = SqlQuery.ExecuteReader(); var objPais = new FormaPagamento(); if (reader.Read()) { objPais = new FormaPagamento(); objPais.nmFormaPagamento = Convert.ToString(reader["nmformapagamento"]); throw new Exception("Já existe uma forma de pagamento cadastrada com esse nome, verifique!"); } } finally { FecharConexao(); } }
public bool Edit(FormaPagamento formaPagamento) { try { this.VerificaDuplicidade(formaPagamento.nmFormaPagamento, formaPagamento.idFormaPagamento); AbrirConexao(); SqlQuery = new SqlCommand("UPDATE tbFormaPagamentos SET nmformapagamento=@nmFormaPagamento, dtatualizacao=@dtAtualizacao WHERE idformapagamento=@idFormaPagamento", con); SqlQuery.Parameters.AddWithValue("@idformapagamento", formaPagamento.idFormaPagamento); SqlQuery.Parameters.AddWithValue("@nmFormaPagamento", formaPagamento.nmFormaPagamento); SqlQuery.Parameters.AddWithValue("@dtatualizacao", formaPagamento.dtAtualizacao); // Validação para saber se a linha foi alterada no BD int i = SqlQuery.ExecuteNonQuery(); if (i >= 1) { return true; } else { return false; } } catch (Exception error) { throw new Exception(error.Message); } finally { FecharConexao(); } }
public List <FormaPagamento> GetFormasPagamentos() { try { var sql = this.Search(null, null, null); OpenConnection(); SqlQuery = new SqlCommand(sql, con); reader = SqlQuery.ExecuteReader(); var list = new List <FormaPagamento>(); while (reader.Read()) { var formaPagamento = new FormaPagamento { codigo = Convert.ToInt32(reader["FormaPagamento_ID"]), nomeForma = Convert.ToString(reader["FormaPagamento_Nome"]), situacao = Sistema.Util.FormatFlag.Situacao(Convert.ToString(reader["FormaPagamento_Situacao"])), dtCadastro = Convert.ToDateTime(reader["FormaPagamento_DataCadastro"]), dtUltAlteracao = Convert.ToDateTime(reader["FormaPagamento_DataUltAlteracao"]), }; list.Add(formaPagamento); } return(list); } catch (Exception error) { throw new Exception(error.Message); } finally { CloseConnection(); } }
public void Seed() { if (_contexto.FormaPagamentos.Any()) { return; } FormaPagamento f1 = new FormaPagamento() { FormaPagamentoId = 1, Nome = "Boleto", Descricao = "Forma de pagamento Boleto" }; FormaPagamento f2 = new FormaPagamento() { FormaPagamentoId = 2, Nome = "Cartão de Credito", Descricao = "Forma de pagamento Cartão de Credito" }; FormaPagamento f3 = new FormaPagamento { FormaPagamentoId = 3, Nome = "Deposito", Descricao = "Forma de pagamento Deposito" }; _contexto.FormaPagamentos.AddRange(f1, f2, f3); _contexto.SaveChanges(); }
/// <summary> /// Obtem uma tabela a ser jogada num relatorio /// </summary> /// <returns></returns> public override DataTable Relatorio() { try{ DataTable tabela = new DataTable("RelatorioCanalFormaPagamento"); if (this.Primeiro()) { tabela.Columns.Add("Canal", typeof(string)); tabela.Columns.Add("FormaPagamento", typeof(string)); do { DataRow linha = tabela.NewRow(); Canal canal = new Canal(); canal.Ler(canalFormaPagamento.CanalID.Valor); linha["Canal"] = canal.Nome.Valor; FormaPagamento fp = new FormaPagamento(); fp.Ler(canalFormaPagamento.FormaPagamentoID.Valor); linha["FormaPagamento"] = fp.Nome.Valor; tabela.Rows.Add(linha); }while(this.Proximo()); } else //erro: nao carregou a lista { tabela = null; } return(tabela); }catch (Exception ex) { throw ex; } }
public int Inserir(FormaPagamento obj) { try { con = new Conexao(); con.Conectar(); String sql = "INSERT INTO forma_pagamento (descricao, taxa, ativo, idestabelecimento) VALUES("; sql += "'" + obj.Descricao.Replace("'", "''") + "', "; sql += "'" + obj.Taxa.ToString(new CultureInfo("en-US")) + "', "; sql += "'" + ((obj.Ativo) ? "1" : "0") + "', "; sql += "'" + obj.Idestabelecimento + "');"; sql += "SELECT LAST_INSERT_ID();"; sql = sql.Replace("''", "NULL"); int id = Convert.ToInt32(con.ExecutarComandoSQLRetorno(sql)); return(id); } catch (Exception ex) { MessageBox.Show("Erro ao cadastrar Forma de Pagamento !!! \n" + ex.Message, "ERRO !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); return(0); } finally { con = null; } }
public FormaPagamento GetById(int id) { FormaPagamento obj = new FormaPagamento(); try { con = new Conexao(); con.Conectar(); String sql = "SELECT idforma, descricao, taxa, ativo, idestabelecimento FROM forma_pagamento"; sql += " WHERE idforma = " + id; var dados = con.RetDataReader(sql); dados.Read(); obj.Idforma = Convert.ToInt32(dados["idforma"].ToString()); obj.Descricao = dados["descricao"].ToString(); obj.Taxa = Convert.ToDecimal(dados["taxa"].ToString(), new CultureInfo("en-US")); obj.Ativo = Convert.ToBoolean(dados["ativo"]); obj.Idestabelecimento = Convert.ToInt32(dados["idestabelecimento"].ToString()); } catch (FormatException e) { MessageBox.Show("Erro ao converter !!! \n" + e.Message, "ERRO !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show("Erro ao buscar os registros (BY ID) !!! \n" + ex.Message, "ERRO !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } con = null; return(obj); }
private void lerXML(String caminho) { xml1 = new LeituraXML(caminho); SIME.Class.NFe.nota_entrada nota; Boolean chaveCadastrada = false; //Processo de identificação e gravação da NFe try { nota = new Class.NFe.nota_entrada(xml1.getChave()); chaveCadastrada = true; } catch (Exception) { nota = new Class.NFe.nota_entrada(xml1.getProdutosNfe().Count()); nota.setChave(xml1.getChave()); nota.setLocal(caminho); nota.setDataEmissao(Convert.ToDateTime(xml1.getNota().getData())); nota.salvar(); } LabChave.Text = nota.getChave();//Armazena a chave da NF-e listaProdutosNFE = xml1.getProdutosNfe(); ListNfe.Items.Clear(); String CNPJ = xml1.getFornecedor().getCNPJ(); ataulizaLista(nota, chaveCadastrada, listaProdutosNFE);//Verifica se já há registros de vinculo com a Tabela de Notas de entrada ListBuscaR1.Items.Clear(); LabForncedor.Text = xml1.getFornecedor().getFantasia() + " - " + xml1.getFornecedor().getNome(); if (chaveCadastrada) { imgOk.ImageUrl = "~/imagens/ok_16x16.gif"; upbuscaFornecedor1.Visible = false; LabForncedor.Text += "</br> <font Color='RED'> NOTA JÁ CADASTRADA OU INICIADO O CADASTRO. </font>"; } else { imgOk.ImageUrl = "~/imagens/delete_16x16.gif"; upbuscaFornecedor1.Visible = true; new Fornecedores().MontaListaFornecedores(CombForncedores1); } FormaPagamento formas = xml1.getFormasPagamento(); List <String[]> lista = new List <String[]>(); for (int i = 0; i < formas.getNumeroParcelas(); i++) { lista.Add(new String[] { (i + 1) + "ª", formas.getDtVencimento(i).ToString(), " Valor: " + formas.getValorParcela(i).ToString("N") }); } UteisWeb util = new UteisWeb(); LabForncedor0.Text = util.montaTab(lista, "N° de parcelas: " + formas.getNumeroParcelas(), System.Drawing.Color.LightBlue); LabForncedor1.Text = "N° da NF: " + xml1.getNota().getNumeroNF().ToString() + " Data da NF: " + xml1.getNota().getData().ToString(); }
public async Task <IActionResult> Edit(int id, [Bind("Descricao,GeraFinanceiro,BaixaLancamento,CartaoCredito,CartaoDeCredito,CartaoCreditoVencimento,CartaoCreditoMelhorDia,EmpresaId,Id,Ativo,DataCadastro,UltimaAtualizacao,Deletado,DeletadoData,FormaPagamentoTipo")] FormaPagamento formaPagamento) { if (id != formaPagamento.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(formaPagamento); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FormaPagamentoExists(formaPagamento.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EmpresaId"] = new SelectList(_context.Empresa, "Id", "Fantasia", formaPagamento.EmpresaId); return(View(formaPagamento)); }
public bool RegistrarBaixa(List <int> listaContas, FormaPagamento formaPagamento) { string stringSQL = "insert into pagamentos " + "(pag_data, pag_valorpago, formp_pk, sta_pk, conpg_pk) " + "VALUES (@data, @valor, @formapg, @status, @conta)"; ContaAPagarDAO conDAO = new ContaAPagarDAO(); NpgsqlCommand cmdIncluir = new NpgsqlCommand(stringSQL, this.Conexao); this.Conexao.Open(); foreach (int conta_id in listaContas) { ContaAPagar con = conDAO.GetContaById(conta_id); cmdIncluir.Parameters.AddWithValue("@data", DateTime.Today.Date); cmdIncluir.Parameters.AddWithValue("@valor", con.Valor); cmdIncluir.Parameters.AddWithValue("@formapg", formaPagamento.Id); cmdIncluir.Parameters.AddWithValue("@status", 1); cmdIncluir.Parameters.AddWithValue("@conta", con.Id); cmdIncluir.ExecuteNonQuery(); cmdIncluir.Parameters.Clear(); } this.Conexao.Close(); return(true); }
public async Task <ActionResult <FormaPagamento> > Put( int id, [FromServices] DataContext context, [FromBody] FormaPagamento model) { if (id != model.Id) { return(NotFound(new { message = "Não encontrado" })); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { context.Entry <FormaPagamento>(model).State = EntityState.Modified; await context.SaveChangesAsync(); return(Ok(model)); } catch (DbUpdateConcurrencyException) { return(BadRequest(new { message = "Registro ja fpoi atualizado" })); } catch { return(BadRequest(new { message = "Não foi possivel atualizar o cadastro" })); } }
public FormaPagamentoColecao ConsultarPorFilial(int IDFilial) { try { conexao.LimparParametros(); conexao.AdicionarParametros("@IDFILIAL", IDFilial); DataTable dataTable = conexao.ExecutarConsulta(CommandType.StoredProcedure, "uspFormaPagamentoConsultarPorFilial"); FormaPagamentoColecao pagamentoColecao = new FormaPagamentoColecao(); foreach (DataRow dataRow in dataTable.Rows) { FormaPagamento pagamento = new FormaPagamento(); pagamento.Descricao = Convert.ToString(dataRow["Descricao"]); pagamento.IDFilial = Convert.ToInt32(dataRow["IDFilial"]); pagamento.IDPagamento = Convert.ToInt32(dataRow["IDPagamento"]); pagamento.IDStatus = Convert.ToInt32(dataRow["IDStatus"]); pagamentoColecao.Add(pagamento); } return(pagamentoColecao); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <IActionResult> Edit(int id, [Bind("id,tipoPagamento")] FormaPagamento formaPagamento) { if (id != formaPagamento.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(formaPagamento); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FormaPagamentoExists(formaPagamento.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(formaPagamento)); }
public static void IniciarDadosFinanceiro(ISession session) { var condPag = new CondicaoPagamento { Descricao = "PAGAMENTO A VISTA", Prazos = new List <PrazoPagamentoCondicaoPagamento> { new PrazoPagamentoCondicaoPagamento { Prazo = 0 } } }; session.Save(condPag); var formaPag = new FormaPagamento { AVista = true, Descricao = "DINHEIRO", ExigeIdentificacaoCliente = false, PrazoCompensacao = 0, TaxaAdministracao = 0, }; session.Save(formaPag); // Informações de lançamento obtidas do site http://contabilidade.wikidot.com/lancto:index dia 05/11/2013 IniciaTiposLancamentoReceitaOperacionalBruta(session); IniciaTiposLancamentoDeducoesReceitaBruta(session); }
public IEnumerable <FormaPagamento> Busca(string nome) { List <FormaPagamento> formapagamentos = new List <FormaPagamento>(); string conNome = nome.Length > 0 ? "AND f.nome LIKE @nome" : ""; using (MySQLConn sql = new MySQLConn(Configuracao.Conecta)) { sql.Query = @"SELECT * FROM formapagamento f WHERE 1=1 " + conNome + @" ORDER BY f.idformapagamento"; if (nome.Length > 0) { sql.addParam("@nome", "%" + nome + "%"); } var data = sql.selectQuery(); foreach (var d in data) { var formapagamento = new FormaPagamento(); formapagamento.FormaPagamentoID = Convert.ToInt32(d["idformapagamento"]); formapagamento.Nome = (string)d["nome"]; formapagamentos.Add(formapagamento); } } return(formapagamentos); }
public LayoutServicosGerais( Cabecalho cabecalho, int servicoId, BaseCalculo baseCalculo, ValorCarga valorCarga, Moeda moeda, string descricaoValor, decimal adicionalIMO, decimal exercito, int tipoDocumentoId, BaseCalculoExcesso baseExcesso, decimal valorExcesso, FormaPagamento formaPagamentoNVOCC) { Cabecalho = cabecalho; ServicoId = servicoId; BaseCalculo = baseCalculo; ValorCarga = valorCarga; Moeda = moeda; DescricaoValor = descricaoValor; AdicionalIMO = adicionalIMO; Exercito = exercito; TipoDocumentoId = tipoDocumentoId; BaseExcesso = baseExcesso; ValorExcesso = valorExcesso; FormaPagamentoNVOCC = formaPagamentoNVOCC; }
public static LayoutServicoHubPort NovoLayoutServicoHubPort( int modeloId, int linha, string descricao, int servicoId, BaseCalculo baseCalculo, decimal valor, int origem, int destino, Moeda moeda, FormaPagamento formaPagamentoNVOCC, string descricaoValor, bool ocultar) { var cabecalho = new Cabecalho(modeloId, linha, descricao, TipoRegistro.SERVICO_HUBPORT, ocultar); var layoutServicoHubPort = new LayoutServicoHubPort( cabecalho, servicoId, baseCalculo, valor, origem, destino, moeda, formaPagamentoNVOCC, descricaoValor); return(layoutServicoHubPort); }
public static IFormaPagamento GetFormaPagamento(FormaPagamento formaPagamento) { switch (formaPagamento) { case FormaPagamento.Dinheiro: return new FormaPagamentoDinheiro(); case FormaPagamento.Cartao: return new FormaPagamentoCartao(); case FormaPagamento.Cheque: return new FormaPagamentoCheque(); default: throw new NotImplementedException("Forma de pagamento não implementada!"); } }
public static void addFormaPagamento(string nome) { try { using (OikoDataContext db = new OikoDataContext()) { FormaPagamento formaPagamento = new FormaPagamento { nome = nome }; db.FormaPagamento.InsertOnSubmit(formaPagamento); db.SubmitChanges(); } } catch (Exception ex) { throw new Exception("Ocorreu um erro ao tentar criar a formaPagamento", ex); } }