-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
780786c
commit a69aac7
Showing
146 changed files
with
15,588 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{E496BE58-6A90-4DD4-8EDF-FABF48E8FABE}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>CapaDatos</RootNamespace> | ||
<AssemblyName>CapaDatos</AssemblyName> | ||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Dapper, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Dapper.2.0.123\lib\net461\Dapper.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Configuration" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="ConexionSql.cs" /> | ||
<Compile Include="D_aulas.cs" /> | ||
<Compile Include="D_Carreras.cs" /> | ||
<Compile Include="D_estudiantes.cs" /> | ||
<Compile Include="D_Materias.cs" /> | ||
<Compile Include="D_matriculas.cs" /> | ||
<Compile Include="D_oferta.cs" /> | ||
<Compile Include="D_Programas.cs" /> | ||
<Compile Include="D_Reportes.cs" /> | ||
<Compile Include="D_Roles.cs" /> | ||
<Compile Include="D_Usuarios.cs" /> | ||
<Compile Include="D_profesores.cs" /> | ||
<Compile Include="Encriptacion.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\CapaEntidades\CapaEntidades.csproj"> | ||
<Project>{c94d3b75-2a8d-4ce4-b852-9ac8dc627338}</Project> | ||
<Name>CapaEntidades</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Data.SqlClient; | ||
using static Dapper.SqlMapper; | ||
|
||
namespace CapaDatos { | ||
public class ConexionSql { | ||
/// <summary> | ||
/// Clase para optener la conexion al servidor sql | ||
/// la cadena esta encriptada | ||
/// </summary> | ||
/// <returns>Retorna la conexion de una instancia SQL server</returns> | ||
/// <exception cref="InvalidOperationException">Caprurar errores de conexion</exception> | ||
/// | ||
static readonly string Servidor; //Nombre o ip del servidor | ||
static readonly string Instancia; //Nombre de la instancia sql | ||
static readonly string BaseDatos; //Nombre de la base de datos | ||
static readonly string User; //Usuario de acceso | ||
static readonly string Password; //Contraseña de usuario de acceso | ||
public ConexionSql() { | ||
|
||
|
||
} | ||
public static SqlConnection GetConnection() { | ||
//CREAMOS EL OBJETO DE CONEXION | ||
SqlConnection connection = new SqlConnection { | ||
ConnectionString = Encriptacion.Desencriptar(ConfigurationManager.AppSettings["StringConexion"]) | ||
}; | ||
//NOS CONECTAMOS | ||
try { | ||
//VALORAMOS EL ESTADO DELA CONEXION | ||
if (connection.State == ConnectionState.Open) { | ||
connection.Close(); | ||
} | ||
else { | ||
connection.Open(); | ||
} | ||
} | ||
catch (Exception ex) { | ||
//SI ALGO SALIO MAL DEVOLVEMOS EL ERROR | ||
throw new InvalidOperationException("ERROR DE CONEXION CON EL SERVIDOR " + ex.Message); | ||
} | ||
finally { | ||
connection.Close(); | ||
} | ||
return connection; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using CapaEntidades; | ||
using Dapper; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace CapaDatos { | ||
public class D_Carreras { | ||
public void Nueva(Carrera carrera) { | ||
using(var conn = ConexionSql.GetConnection()) { | ||
conn.Execute("SP_carrera_nueva", new { nombre = carrera.Nombre }, commandType: CommandType.StoredProcedure); | ||
} | ||
} | ||
public void Modificar(Carrera carrera) { | ||
using (var conn = ConexionSql.GetConnection()) { | ||
conn.Execute("SP_carrera_modificar", new { nombre = carrera.Nombre,idCarrera = carrera.IdCarrera }, commandType: CommandType.StoredProcedure); | ||
} | ||
} | ||
public List<Carrera> GetCarreras(string nombre) { | ||
using (var conn = ConexionSql.GetConnection()) { | ||
return conn.Query<Carrera>("SP_carrera_lista", new {nombre }, commandType: CommandType.StoredProcedure).ToList(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using CapaEntidades; | ||
using Dapper; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace CapaDatos { | ||
public class D_Materias { | ||
public void Nueva(Materias materias) { | ||
using (var conn = ConexionSql.GetConnection()) { | ||
conn.Execute("SP_materia_nueva", | ||
new { | ||
detalle = materias.Detalle, | ||
costo = materias.Costo, | ||
aula = materias.Aula, | ||
horario = materias.Horario | ||
}, commandType: CommandType.StoredProcedure); | ||
} | ||
} | ||
public void Modificar(Materias materias) { | ||
using (var conn = ConexionSql.GetConnection()) { | ||
conn.Execute("SP_materia_modificar", | ||
new { | ||
idMateria = materias.IdMateria, | ||
detalle = materias.Detalle, | ||
costo = materias.Costo, | ||
aula = materias.Aula, | ||
horario = materias.Horario | ||
}, | ||
commandType: CommandType.StoredProcedure); | ||
} | ||
} | ||
public List<Materias> GetMaterias(string detalle) { | ||
using (var conn = ConexionSql.GetConnection()) { | ||
return conn.Query<Materias>("SP_materia_lista", | ||
new { detalle }, | ||
commandType: CommandType.StoredProcedure).ToList(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using CapaEntidades; | ||
using Dapper; | ||
using System.Collections.Generic; | ||
using System.Data; | ||
using System.Linq; | ||
|
||
namespace CapaDatos { | ||
public class D_Programas { | ||
public List<Programa> Lista() { | ||
using (var conn = ConexionSql.GetConnection()) { | ||
return conn.Query<Programa>("SP_Programas_lista", commandType: CommandType.StoredProcedure).ToList(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using Dapper; | ||
using System.Data; | ||
|
||
namespace CapaDatos { | ||
public class D_Reportes { | ||
public DataTable Usarios(bool activo,string nombre) { | ||
DataTable data= new DataTable(); | ||
using (var conn = ConexionSql.GetConnection()) { | ||
var reader = conn.ExecuteReader("SP_Reporte_Usuarios", new { activo, nombre },commandType:CommandType.StoredProcedure); | ||
data.Load(reader); | ||
} | ||
return data; | ||
} | ||
public DataTable Ofertas(string idOferta) { | ||
DataTable data = new DataTable(); | ||
using (var conn = ConexionSql.GetConnection()) { | ||
var reader = conn.ExecuteReader("SP_reporte_ofertas", new { idOferta }, commandType: CommandType.StoredProcedure); | ||
data.Load(reader); | ||
} | ||
return data; | ||
} | ||
public DataTable NotasEstudiantes(string idAlumno) { | ||
DataTable data = new DataTable(); | ||
using (var conn = ConexionSql.GetConnection()) { | ||
var reader = conn.ExecuteReader("SP_reporte_notas_estudiante", | ||
new { idAlumno }, | ||
commandType: CommandType.StoredProcedure); | ||
data.Load(reader); | ||
} | ||
return data; | ||
} | ||
public DataTable Profesores(string nombre, bool Activo) { | ||
DataTable data = new DataTable(); | ||
using (var conn = ConexionSql.GetConnection()) { | ||
var reader = conn.ExecuteReader("SP_reporte_profesores", | ||
new { nombre, Activo }, | ||
commandType: CommandType.StoredProcedure); | ||
data.Load(reader); | ||
} | ||
return data; | ||
} | ||
public DataTable Aulas( string estado) { | ||
DataTable data = new DataTable(); | ||
using (var conn = ConexionSql.GetConnection()) { | ||
var reader = conn.ExecuteReader("SP_Reporte_aulas", | ||
new { estado }, | ||
commandType: CommandType.StoredProcedure); | ||
data.Load(reader); | ||
} | ||
return data; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using CapaEntidades; | ||
using Dapper; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace CapaDatos { | ||
public class D_Roles { | ||
public List<Roles> Lista() { | ||
using (var conn = ConexionSql.GetConnection()) { | ||
return conn.Query<Roles>("SP_roles_lista", commandType: CommandType.StoredProcedure).ToList(); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.