Version OScar
This commit is contained in:
138
ADSUtileriasWF/Helpers/serviceconection.cs
Normal file
138
ADSUtileriasWF/Helpers/serviceconection.cs
Normal file
@@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ADSUtileriasWF.Helpers
|
||||
{
|
||||
public class Servicecon
|
||||
{
|
||||
public static void GuardaLog(string mensaje)
|
||||
{
|
||||
ModExtensiones.GuardaLog(mensaje);
|
||||
}
|
||||
|
||||
public static UtileriasServiceWCF.ResponseLogin Login(string usuario, string password,int CveEmpresa)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
return client.Login(new UtileriasServiceWCF.RequestLogin() { UserName = usuario, Password = password, CvePlataforma = 8, CveEmpresa = CveEmpresa });
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return null;
|
||||
//throw;
|
||||
}
|
||||
}
|
||||
public static UtileriasServiceWCF.UsuariosqliteModel CambiarEmpresa(int CveUsuario, int CveEmpresa, int cveSubProyecto)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
return client.CambiarEmpresa( CveUsuario, CveEmpresa, cveSubProyecto);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return null;
|
||||
//throw;
|
||||
}
|
||||
}
|
||||
public static bool SetPersonalHuella(UtileriasServiceWCF.RequestPersonalHuella perhuella)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
return client.SetEmpleadoHuella(perhuella);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static UtileriasServiceWCF.ResponseGetChecadoresModel[] GetChecadores(int CveUsuario, int cveSubProyecto, int CveEmpresa)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
return client.GetChecadores(CveUsuario, cveSubProyecto, CveEmpresa);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static List<UtileriasServiceWCF.PersonalsqliteModel> GETPersonal(int CveUsuario, int CveEmpresa, int cveSubProyecto)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
|
||||
return new List<UtileriasServiceWCF.PersonalsqliteModel>( client.GETPersonal(CveUsuario, CveEmpresa, cveSubProyecto));
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<UtileriasServiceWCF.PersonalChecadorsqliteModel> GETPersonalChecador(int CveUsuario, int CveEmpresa, int CvePersonal)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
return new List<UtileriasServiceWCF.PersonalChecadorsqliteModel>(client.GETPersonalChecador(CveUsuario, CveEmpresa, CvePersonal));
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool UpChecadorEmpleado(int CveUsuario, int CveEmpresa, int CvePersonal, List<UtileriasServiceWCF.PersonalChecadorUPsqliteModel> CveChecadores)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
return client.UpChecadorEmpleado(CveUsuario, CveEmpresa, CvePersonal, CveChecadores.ToArray());
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static UtileriasServiceWCF.ResponseSubProyectoUsuario[] GetSubProyectos(int CveUsuario, int CveEmpresa)
|
||||
{
|
||||
try
|
||||
{
|
||||
UtileriasServiceWCF.RequestSubProyectoUsuario parames=new UtileriasServiceWCF.RequestSubProyectoUsuario { CveUsuario=CveUsuario, CveProyecto =-1, CveSubProyecto=-1, CveEmpresa = CveEmpresa, CveEstatus =-1 };
|
||||
//public UtileriasServiceWCF.ResponseSubProyectoUsuario[] GetSubProyectos(int CveUsuario, int CveEmpresa, )
|
||||
UtileriasServiceWCF.SystemServiceClient client = new UtileriasServiceWCF.SystemServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
||||
return client.GetSubProyectos(CveUsuario, CveEmpresa, parames);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user