Beispiel #1
0
        public List<FormaPagoDTO> Listar()
        {
            List<FormaPagoDTO> Lista = new List<FormaPagoDTO>();
              Database db = DatabaseFactory.CreateDatabase("ApplicationConnectionString");
              DbCommand dbCommand = db.GetStoredProcCommand(C_LISTAR);
              using (IDataReader dr = db.ExecuteReader(dbCommand))
              {
              while (dr.Read())
              {
                  FormaPagoDTO obj = new FormaPagoDTO();

                  if (dr["id_forma_pago"] != System.DBNull.Value)
                      obj.IdFormaPago = (int)dr["id_forma_pago"];

                  if (dr["nombre_forma_pago"] != System.DBNull.Value)
                      obj.NombreFormaPago = (string)dr["nombre_forma_pago"];

                  if (dr["dias"] != System.DBNull.Value)
                      obj.Dias = (int)dr["dias"];

                  Lista.Add(obj);
              }
              }
              return Lista;
        }
Beispiel #2
0
 public void Actualizar(FormaPagoDTO obj)
 {
     Database db = DatabaseFactory.CreateDatabase("ApplicationConnectionString");
       DbCommand dbCommand = db.GetStoredProcCommand(C_ACTUALIZAR);
       db.AddInParameter(dbCommand, "@id_forma_pago", DbType.Int32, obj.IdFormaPago);
       db.AddInParameter(dbCommand, "@nombre_forma_pago", DbType.String, obj.NombreFormaPago);
       db.AddInParameter(dbCommand, "@dias", DbType.Int32, obj.Dias);
       db.ExecuteNonQuery(dbCommand);
 }
Beispiel #3
0
 public int Agregar(FormaPagoDTO obj)
 {
     Database db = DatabaseFactory.CreateDatabase("ApplicationConnectionString");
       DbCommand dbCommand = db.GetStoredProcCommand(C_AGREGAR);
       db.AddInParameter(dbCommand, "@id_forma_pago", DbType.Int32, obj.IdFormaPago);
       db.AddInParameter(dbCommand, "@nombre_forma_pago", DbType.String, obj.NombreFormaPago);
       db.AddInParameter(dbCommand, "@dias", DbType.Int32, obj.Dias);
       int id = Convert.ToInt32(db.ExecuteScalar(dbCommand));
       return id;
 }
Beispiel #4
0
        public FormaPagoDTO ListarPorClave(int IdFormaPago)
        {
            FormaPagoDTO obj = null;
              Database db = DatabaseFactory.CreateDatabase("ApplicationConnectionString");
              DbCommand dbCommand = db.GetStoredProcCommand(C_LISTAR_POR_CLAVE);
              db.AddInParameter(dbCommand, "@id_forma_pago", DbType.Int32, IdFormaPago);

              using (IDataReader dr = db.ExecuteReader(dbCommand))
              {
              if (dr.Read())
              {
                  obj = new FormaPagoDTO();
                  if (dr["id_forma_pago"] != System.DBNull.Value) obj.IdFormaPago = (int)dr["id_forma_pago"];
                  if (dr["nombre_forma_pago"] != System.DBNull.Value) obj.NombreFormaPago = (string)dr["nombre_forma_pago"];
                  if (dr["dias"] != System.DBNull.Value) obj.Dias = (int)dr["dias"];
              }
              }
              return obj;
        }