Exemple #1
0
 /// <summary>
 /// Obtiene un listado de comisionistas
 /// </summary>
 /// <returns></returns>
 public List <Comisionista> GetList()
 {
     using (SqlConnection _SqlConnection = new SqlConnection(ConnectionString.DbMPYOpera))
     {
         List <Comisionista> lista       = new List <Comisionista>();
         SqlCommand          _SqlCommand = new SqlCommand("MDOSPS_OBTENER_COMISIONISTAS", _SqlConnection)
         {
             CommandType = CommandType.StoredProcedure
         };
         try
         {
             _SqlConnection.Open();
             SqlDataReader _SqlDataReader = _SqlCommand.ExecuteReader();
             if (_SqlDataReader.HasRows)
             {
                 while (_SqlDataReader.Read())
                 {
                     Comisionista item = new Comisionista()
                     {
                         iIdComisionista = int.Parse(_SqlDataReader["IdUsuario"].ToString()),
                         sComisionista   = _SqlDataReader["Nombre"].ToString(),
                         sNoCuenta       = _SqlDataReader["Cuenta"].ToString(),
                         sIdBancario     = _SqlDataReader["IdBancario"].ToString()
                     };
                     lista.Add(item);
                 }
             }
         }
         catch (Exception)
         {
             lista = null;
         }
         return(lista);
     }
 }
Exemple #2
0
        /// <summary>
        /// Obtiene la información basica de un comisionista
        /// </summary>
        /// <param name="iIdComisionista"></param>
        /// <returns></returns>
        public Comisionista GetInfoComisionista(int iIdComisionista)
        {
            using (SqlConnection _SqlConnection = new SqlConnection(ConnectionString.DbMPYOpera))
            {
                Comisionista _Com        = null;
                SqlCommand   _SqlCommand = new SqlCommand("MDOSPS_OBTENER_COMISIONISTA_BY_ID", _SqlConnection)
                {
                    CommandType = CommandType.StoredProcedure
                };
                _SqlCommand.Parameters.AddWithValue("@IdUsuario", iIdComisionista);

                try
                {
                    _SqlConnection.Open();
                    SqlDataReader _SqlDataReader = _SqlCommand.ExecuteReader();
                    if (_SqlDataReader.HasRows)
                    {
                        while (_SqlDataReader.Read())
                        {
                            _Com = new Comisionista()
                            {
                                iIdComisionista     = int.Parse(_SqlDataReader["IdUsuario"].ToString()),
                                sComisionista       = _SqlDataReader["Nombre"].ToString(),
                                sNoCuenta           = _SqlDataReader["Cuenta"].ToString(),
                                sIdBancario         = _SqlDataReader["IdBancario"].ToString(),
                                sClabeInterbancaria = _SqlDataReader["ClabeInterbancaria"].ToString(),
                                sBanco = _SqlDataReader["Banco"].ToString()
                            };
                        }
                    }
                }
                catch (Exception)
                {
                    _Com = null;
                }
                return(_Com);
            }
        }