-
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
93265e0
commit e5a6f36
Showing
258 changed files
with
112,819 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file added
BIN
+40.9 KB
...ntario-API/.vs/Inventario-API/FileContentIndex/792e2b8f-6cbf-40a9-8304-b0b9080c8a80.vsidx
Binary file not shown.
1,026 changes: 1,026 additions & 0 deletions
1,026
Inventario-API/.vs/Inventario-API/config/applicationhost.config
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
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,54 @@ | ||
{ | ||
"Version": 1, | ||
"WorkspaceRootPath": "C:\\Users\\JuanE\\OneDrive\\Documentos\\Juan Pablo\\Programacion\\API-INVENTARIO\\Inventario-API\\", | ||
"Documents": [ | ||
{ | ||
"AbsoluteMoniker": "D:0:0:{C9C8F811-68CA-4467-8546-49CB2F086661}|Inventario-API\\Inventario-API.csproj|c:\\users\\juane\\onedrive\\documentos\\juan pablo\\programacion\\api-inventario\\inventario-api\\inventario-api\\appsettings.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}", | ||
"RelativeMoniker": "D:0:0:{C9C8F811-68CA-4467-8546-49CB2F086661}|Inventario-API\\Inventario-API.csproj|solutionrelative:inventario-api\\appsettings.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}" | ||
}, | ||
{ | ||
"AbsoluteMoniker": "D:0:0:{152A12C0-DDB6-480C-8AE7-3BDC2FEB5EA5}|DAL\\DAL.csproj|c:\\users\\juane\\onedrive\\documentos\\juan pablo\\programacion\\api-inventario\\inventario-api\\dal\\contexto.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", | ||
"RelativeMoniker": "D:0:0:{152A12C0-DDB6-480C-8AE7-3BDC2FEB5EA5}|DAL\\DAL.csproj|solutionrelative:dal\\contexto.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" | ||
} | ||
], | ||
"DocumentGroupContainers": [ | ||
{ | ||
"Orientation": 0, | ||
"VerticalTabListWidth": 256, | ||
"DocumentGroups": [ | ||
{ | ||
"DockedWidth": 200, | ||
"SelectedChildIndex": 0, | ||
"Children": [ | ||
{ | ||
"$type": "Document", | ||
"DocumentIndex": 0, | ||
"Title": "appsettings.json", | ||
"DocumentMoniker": "C:\\Users\\JuanE\\OneDrive\\Documentos\\Juan Pablo\\Programacion\\API-INVENTARIO\\Inventario-API\\Inventario-API\\appsettings.json", | ||
"RelativeDocumentMoniker": "Inventario-API\\appsettings.json", | ||
"ToolTip": "C:\\Users\\JuanE\\OneDrive\\Documentos\\Juan Pablo\\Programacion\\API-INVENTARIO\\Inventario-API\\Inventario-API\\appsettings.json", | ||
"RelativeToolTip": "Inventario-API\\appsettings.json", | ||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAIAAAAEAAAA", | ||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|", | ||
"WhenOpened": "2024-06-23T21:27:31.027Z", | ||
"EditorCaption": "" | ||
}, | ||
{ | ||
"$type": "Document", | ||
"DocumentIndex": 1, | ||
"Title": "Contexto.cs", | ||
"DocumentMoniker": "C:\\Users\\JuanE\\OneDrive\\Documentos\\Juan Pablo\\Programacion\\API-INVENTARIO\\Inventario-API\\DAL\\Contexto.cs", | ||
"RelativeDocumentMoniker": "DAL\\Contexto.cs", | ||
"ToolTip": "C:\\Users\\JuanE\\OneDrive\\Documentos\\Juan Pablo\\Programacion\\API-INVENTARIO\\Inventario-API\\DAL\\Contexto.cs", | ||
"RelativeToolTip": "DAL\\Contexto.cs", | ||
"ViewState": "AQIAAAAAAAAAAAAAAAAAABQAAAARAAAA", | ||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", | ||
"WhenOpened": "2024-06-23T04:34:09.699Z", | ||
"EditorCaption": "" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
Binary file not shown.
Binary file not shown.
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 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Twilio" Version="6.15.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\DAL\DAL.csproj" /> | ||
<ProjectReference Include="..\MODELS\MODELS.csproj" /> | ||
</ItemGroup> | ||
|
||
</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,35 @@ | ||
using DAL; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BLL | ||
{ | ||
public class BL_AUTENTICACION | ||
{ | ||
public static async Task<Boolean> ValidaUsuarioInterfaces(string PCadena, string PUsuario, string PContra, string PGuid) | ||
{ | ||
Boolean Validacion = false; | ||
|
||
var dpParametros = new | ||
{ | ||
P_Usuario = PUsuario, | ||
P_Contra = PContra, | ||
P_Guid = PGuid | ||
|
||
}; | ||
|
||
DataTable Dt = Contexto.Funcion_StoreDB(PCadena, "spValidaInterfaceTOKEN", dpParametros); | ||
|
||
if (Dt.Rows.Count > 0) | ||
{ | ||
Validacion = true; | ||
} | ||
|
||
return await Task.FromResult(Validacion); | ||
} | ||
} | ||
} |
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,220 @@ | ||
using System.Collections.Generic; | ||
using System.Data; | ||
using System.Data.SqlClient; | ||
using MODELS; | ||
using DAL; | ||
|
||
namespace BLL | ||
{ | ||
public class BL_Producto | ||
{ | ||
public static List<string> ValidaInfo(DtoProducto PProducto) | ||
{ | ||
List<string> lstValidaciones = new List<string>(); | ||
if (ValidacionTexto(PProducto.NombreProducto)) | ||
{ | ||
lstValidaciones.Add("Revisar el NombreProducto"); | ||
} | ||
if (PProducto.Stock < 0) | ||
{ | ||
lstValidaciones.Add("El stock no puede ser negativo"); | ||
} | ||
|
||
// Validación para el campo 'PrecioUnitario' | ||
if (PProducto.PrecioUnitario <= 0) | ||
{ | ||
lstValidaciones.Add("El precio unitario no puede ser negativo o igual a 0"); | ||
} | ||
|
||
return lstValidaciones; | ||
} | ||
|
||
public static Boolean ValidacionTexto(string Texto) | ||
{ | ||
Boolean Validacion = false; | ||
|
||
foreach(char Letra in Texto.Replace(" ", "")) | ||
{ | ||
if (!char.IsLetter(Letra)) | ||
{ | ||
Validacion = true; | ||
break; | ||
} | ||
} | ||
return Validacion; | ||
} | ||
|
||
public static List<string> GuardarInfo(string PCadena, DtoProducto PProducto) | ||
{ | ||
List<string> lstDatos = new List<string>(); | ||
|
||
try | ||
{ | ||
var dpParametro = new | ||
{ | ||
P_CodigoBarras = PProducto.CodigoBarras, | ||
P_NombreProducto = PProducto.NombreProducto, | ||
P_Stock = PProducto.Stock, | ||
P_PrecioUnitario = PProducto.PrecioUnitario, | ||
}; | ||
|
||
Contexto.Procedimiento_StoreDB(PCadena, "InsertarProducto", dpParametro); | ||
|
||
lstDatos.Add("00"); | ||
lstDatos.Add("El Producto fue registrado con exito"); | ||
} | ||
catch(Exception e) | ||
{ | ||
lstDatos.Add("14"); | ||
lstDatos.Add(e.Message); | ||
} | ||
|
||
return lstDatos; | ||
} | ||
|
||
public static List<DtoCatProducto> ConsultaProducto(string PCadena) | ||
{ | ||
List<DtoCatProducto> lstProducto = new List<DtoCatProducto>(); | ||
|
||
var dpParametros = new | ||
{ | ||
P_Accion = 1, | ||
}; | ||
|
||
//*Veriicar si existe spConsul | ||
DataTable Dt = Contexto.Funcion_StoreDB(PCadena, "spConsulProducto", dpParametros); | ||
|
||
if(Dt.Rows.Count > 0) | ||
{ | ||
lstProducto = (from item in Dt.AsEnumerable() | ||
select new DtoCatProducto | ||
{ | ||
id = item.Field<int>("id"), | ||
CodigoBarras = item.Field<string>("CodigoBarras"), | ||
NombreProducto = item.Field<string>("NombreProducto"), | ||
Stock = item.Field<int>("Stock"), | ||
PrecioUnitario = item.Field<decimal>("PrecioUnitario"), | ||
}).ToList(); | ||
} | ||
|
||
return lstProducto; | ||
|
||
} | ||
|
||
public static List<DtoCatProducto> ConsultaProducto(string PCadena, string PTexto) | ||
{ | ||
List<DtoCatProducto> lstProducto = new List<DtoCatProducto>(); | ||
|
||
var dpParametros = new | ||
{ | ||
P_Accion = 2, | ||
P_Texto = PTexto | ||
}; | ||
|
||
//*Veriicar si existe spConsul | ||
DataTable Dt = Contexto.Funcion_StoreDB(PCadena, "spConsulProducto", dpParametros); | ||
|
||
if (Dt.Rows.Count > 0) | ||
{ | ||
lstProducto = (from item in Dt.AsEnumerable() | ||
select new DtoCatProducto | ||
{ | ||
id = item.Field<int>("id"), | ||
CodigoBarras = item.Field<string>("CodigoBarras"), | ||
NombreProducto = item.Field<string>("NombreProducto"), | ||
Stock = item.Field<int>("Stock"), | ||
PrecioUnitario = item.Field<decimal>("PrecioUnitario"), | ||
}).ToList(); | ||
} | ||
|
||
return lstProducto; | ||
|
||
} | ||
|
||
public static List<DtoCatProducto> ConsultaProductoCodigo(string PCadena, string PTexto) | ||
{ | ||
List<DtoCatProducto> lstProducto = new List<DtoCatProducto>(); | ||
|
||
var dpParametros = new | ||
{ | ||
P_Accion = 3, | ||
P_Texto = PTexto | ||
}; | ||
|
||
//*Veriicar si existe spConsul | ||
DataTable Dt = Contexto.Funcion_StoreDB(PCadena, "spConsulProducto", dpParametros); | ||
|
||
if (Dt.Rows.Count > 0) | ||
{ | ||
lstProducto = (from item in Dt.AsEnumerable() | ||
select new DtoCatProducto | ||
{ | ||
id = item.Field<int>("id"), | ||
CodigoBarras = item.Field<string>("CodigoBarras"), | ||
NombreProducto = item.Field<string>("NombreProducto"), | ||
Stock = item.Field<int>("Stock"), | ||
PrecioUnitario = item.Field<decimal>("PrecioUnitario"), | ||
}).ToList(); | ||
} | ||
|
||
return lstProducto; | ||
|
||
} | ||
|
||
|
||
public static List<string> ModificarInfo(string PCadena, DtoProducto PProducto) | ||
{ | ||
List<string> lstDatos = new List<string>(); | ||
|
||
try | ||
{ | ||
var dpParametro = new | ||
{ | ||
P_CodigoBarras = PProducto.CodigoBarras, | ||
P_NombreProducto = PProducto.NombreProducto, | ||
P_Stock = PProducto.Stock, | ||
P_PrecioUnitario = PProducto.PrecioUnitario, | ||
}; | ||
|
||
Contexto.Procedimiento_StoreDB(PCadena, "spModifProducto", dpParametro); | ||
|
||
lstDatos.Add("00"); | ||
lstDatos.Add("El Producto fue modificado con exito"); | ||
} | ||
catch (Exception e) | ||
{ | ||
lstDatos.Add("14"); | ||
lstDatos.Add(e.Message); | ||
} | ||
|
||
return lstDatos; | ||
} | ||
|
||
public static List<string> BorrarInfo(string PCadena, int id) | ||
{ | ||
List<string> lstDatos = new List<string>(); | ||
|
||
try | ||
{ | ||
var dpParametro = new | ||
{ | ||
P_IdProducto = id | ||
}; | ||
|
||
Contexto.Procedimiento_StoreDB(PCadena, "spBorrarProducto", dpParametro); | ||
|
||
lstDatos.Add("00"); | ||
lstDatos.Add("El Producto fue borrado con exito"); | ||
|
||
} | ||
catch (Exception e) | ||
{ | ||
lstDatos.Add("14"); | ||
lstDatos.Add(e.Message); | ||
} | ||
|
||
return lstDatos; | ||
} | ||
} | ||
|
||
} |
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,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Twilio; | ||
using Twilio.Rest.Api.V2010.Account; | ||
using Twilio.Types; | ||
|
||
namespace BLL | ||
{ | ||
public class SMS | ||
{ | ||
private const string AccountSid = "ACbd7fa196baf26722498e0687c6896886"; | ||
private const string AuthToken = "99c7b08cd87d8151fb34468026ab31eb"; | ||
|
||
public static void EnviarMensaje() | ||
{ | ||
TwilioClient.Init(AccountSid, AuthToken); | ||
|
||
var toPhoneNumber = "+528136183555"; | ||
var fromPhoneNumber = "+19386661795"; | ||
var messageBody = "Un producto ha sido eliminado"; | ||
|
||
var messageOptions = new CreateMessageOptions(new PhoneNumber(toPhoneNumber)) | ||
{ | ||
From = new PhoneNumber(fromPhoneNumber), | ||
Body = messageBody | ||
}; | ||
|
||
var message = MessageResource.Create(messageOptions); | ||
Console.WriteLine(message.Body); | ||
} | ||
} | ||
} |
Oops, something went wrong.