Example #1
0
        public void InsertarPromotor(Promotor entidad)
        {
			try
			{
				//Obtener DbCommand para ejcutar el Store Procedure
				using (DbCommand com = db.GetStoredProcCommand("NombreDelStrore"))
				{
					//Parametros
					//db.AddInParameter(com, "@Parametro", DbType.Tipo, entidad.Atributo);
				
					//Ejecucion de la Consulta
					db.ExecuteNonQuery(com);

					//Cierre de la conexion y liberacion de memoria
					com.Dispose();
				}
			}
			catch (Exception ex)
			{
				throw ex;
			}
        }
Example #2
0
        public Promotor ObtenerPromotor()
        {
			Promotor resultado = null;
			try
			{
				//Obtener DbCommand para ejcutar el Store Procedure
				using (DbCommand com = db.GetStoredProcCommand("NombreDelStrore"))
				{
					//Parametros
					//db.AddInParameter(com, "@Parametro", DbType.Tipo, entidad.Atributo);
				
					//Ejecucion de la Consulta
					using (IDataReader reader = db.ExecuteReader(com))
					{
						if (reader != null)
						{
							resultado = new Promotor();
							//Lectura de los datos del ResultSet
						}

						reader.Dispose();
					}

					//Cierre de la conexion y liberacion de memoria
					com.Dispose();
				}
			}
			catch (Exception ex)
			{
				throw ex;
			}
			return resultado;
        }
Example #3
0
 public static void InsertarPromotor(Promotor entidad)
 {
     dal.InsertarPromotor(entidad);			
 }
Example #4
0
        public List<Promotor> ObtenerPromotor(int Accion, int IdDesarrolladora, int idPromotor, int idUsuario)
        {
			List<Promotor> resultado = null;
			try
			{
				//Obtener DbCommand para ejcutar el Store Procedure
                using (DbCommand com = db.GetStoredProcCommand("AhorroVoluntario.SelPromotor"))
				{
					//Parametros
                    db.AddInParameter(com, "@Accion", DbType.Int32, Accion);
                    db.AddInParameter(com, "@IdDesarrolladora", DbType.Int32, IdDesarrolladora);
                    db.AddInParameter(com, "@IdPromotor", DbType.Int32, idPromotor);
                    db.AddInParameter(com, "@IdUsuario", DbType.Int32, idUsuario);
				
					//Ejecucion de la Consulta
					using (IDataReader reader = db.ExecuteReader(com))
					{
						if (reader != null)
						{
							resultado = new List<Promotor>();
							//Lectura de los datos del ResultSet
                            while (reader.Read())
                            {
                                Promotor promotor = new Promotor();
                                if (!reader.IsDBNull(0)) promotor.IdPromotor = Convert.ToInt32(reader[0]);
                                if (!reader.IsDBNull(1)) promotor.Nombre = reader[1].ToString();
                                if (!reader.IsDBNull(2)) promotor.IdDesarrolladora = Convert.ToInt32(reader[2]);
                                if (!reader.IsDBNull(3)) promotor.IdTipoPromotor = Convert.ToInt32(reader[3]);
                                if (!reader.IsDBNull(4)) promotor.IdEstatus = Convert.ToBoolean(reader[4]);
                                if (!reader.IsDBNull(5)) promotor.Idusuario = Convert.ToInt32(reader[5]);
                                resultado.Add(promotor);
                            }

						}

						reader.Dispose();
					}

					//Cierre de la conexion y liberacion de memoria
					com.Dispose();
				}
			}
			catch (Exception ex)
			{
				throw ex;
			}
			return resultado;
        }