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(); } }
/// <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; }
/// <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; }