public IEnumerable<Conta> Get() { _connection.ExecuteProcedure(Procedures.SelConta); using (var reader = _connection.ExecuteReader()) { var lista = new List<Conta>(); while (reader.Read()) { var c = new Conta(); c.NumSeql_Cont = (int)reader["NumSeql_Cont"]; c.DataRealiza_Cont = Convert.ToDateTime(reader["DataRealiza_Cont"]); c.DataPgto_Cont = (reader["DataPgto_Cont"] == DBNull.Value) ? default(DateTime) : Convert.ToDateTime(reader["DataPgto_Cont"]); c.VlrPgto_Cont = (decimal)reader["VlrPgto_Cont"]; c.FuncRealiza_Cont = (int)reader["FuncRealiza_Cont"]; c.TipoPgto_Cont = (int)reader["TipoPgto_Cont"]; c.TipoCobranca_Cont = (int)reader["TipoCobranca_Cont"]; c.IndPaga_Cont = (string)reader["IndPaga_Cont"]; c.FuncPago_Cont = (reader["FuncPago_Cont"] == DBNull.Value) ? default(int) : (int)reader["FuncPago_Cont"]; c.DataVenci_Cont = (reader["DataVenci_Cont"] == DBNull.Value) ? default(DateTime) : Convert.ToDateTime(reader["DataVenci_Cont"]); c.NomTipo_Pgto = (string)reader["Desc_Pgto"]; c.Nom_TipoCobr = (string)reader["Nom_TipoCobr"]; c.Nome_FuncPago = (string)reader["Nome_FuncPago"]; c.Nome_FuncRealiza = (string)reader["Nome_FuncRealiza"]; lista.Add(c); } return lista; } }
public ActionResult Create(Conta conta) { conta.FuncRealiza_Cont = CodUsuarioLogado; if (conta.DataPgto_Cont.ToString() == "01/01/0001 00:00:00") conta.DataPgto_Cont = null; if (conta.FuncPago_Cont == 0 ) conta.FuncPago_Cont = null; conta.TipoPgto_Cont = 7; conta.TipoCobranca_Cont = 8; _contaRepository.Post(conta); return RedirectToAction("Filtro"); }
public void Put(Conta conta) { _connection.ExecuteProcedure(Procedures.UpdConta); _connection.AddParameter("NumSeql_Cont", conta.NumSeql_Cont); _connection.AddParameter("DataRealiza_Cont", conta.DataRealiza_Cont); _connection.AddParameter("VlrPgto_Cont", conta.VlrPgto_Cont); _connection.AddParameter("FuncRealiza_Cont", conta.FuncRealiza_Cont); _connection.AddParameter("TipoPgto_Cont", conta.TipoPgto_Cont); _connection.AddParameter("TipoCobranca_Cont", conta.TipoCobranca_Cont); _connection.AddParameter("IndPaga_Cont", conta.IndPaga_Cont); _connection.AddParameter("DataPgto_Cont", conta.DataPgto_Cont); _connection.AddParameter("FuncPago_Cont", conta.FuncPago_Cont); _connection.AddParameter("DataVenci_Cont", conta.DataVenci_Cont); _connection.ExecuteNonQuery(); }
public ActionResult Edit(Conta conta) { _contaRepository.Put(conta); return View("FiltroConta"); }