示例#1
0
        public IType BuscarHomePagina(IType iType, int idCliente)
        {
            Cn = DataBaseGeneric.CreateConnection(BaseType, iType.InstanceConectionString);
            Cn.Open();

            try
            {
                Cmd             = DataBaseGeneric.CreateCommand(BaseType);
                Cmd.Connection  = Cn;
                Cmd.CommandType = CommandType.StoredProcedure;
                Cmd.CommandText = "sp_SYS_BuscarHomePagina";

                DbParameter paran2 = Cmd.CreateParameter();
                paran2.ParameterName = "@idCliente";
                paran2.Value         = idCliente;
                Cmd.Parameters.Add(paran2);

                OpenConnection(iType);
                DbDataReader dr = Cmd.ExecuteReader();
                if (dr.Read())
                {
                    return(SetObject(dr, (IType)Activator.CreateInstance(iType.GetType())));
                }
                return(null);
            }
            catch (Exception ex) { throw ex; }
            finally
            {
                Cn.Close();
                Cn.Dispose();
            }
        }
示例#2
0
        /// <summary>
        /// Abre a conexão com o banco de dados
        /// </summary>
        protected internal void OpenConnection(IType iType)
        {
            string conectionString = ConnectionString;

            if (iType != null)
            {
                string iTypeConnection = getConectionStringFromIType(iType);
                if (iTypeConnection != null)
                {
                    conectionString = iTypeConnection;
                }
            }

            Cn = DataBaseGeneric.CreateConnection(BaseType, conectionString);
            Cn.Open();
            Cmd.Connection = Cn;
        }
示例#3
0
 /// <summary>
 /// Abre a conexão com o banco de dados
 /// </summary>
 protected internal void OpenConnection()
 {
     Cn = DataBaseGeneric.CreateConnection(BaseType, ConnectionString);
     Cn.Open();
     Cmd.Connection = Cn;
 }