172 lines
8.0 KiB
C#
172 lines
8.0 KiB
C#
using ADSNetLibrary.SIGAPI.Models.RH.Request;
|
|
using ADSUtileriasWF.Views.RelojChecador.Gluyas;
|
|
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;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static WCF_Checador.PersonalChecadorIDResponse[] PersonalChecadorID(int CveChecador,int CvePersonal =-1,string ChecadorID = "-1")
|
|
{
|
|
try
|
|
{
|
|
WCF_Checador.ChecadorServiceClient client = new WCF_Checador.ChecadorServiceClient();
|
|
return client.PersonalChecadorID(new WCF_Checador.RequestPersonalChecadorID() { CvePersonal = CvePersonal, ChecadorID = ChecadorID, CveChecador = CveChecador });
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static bool AddUpPersonalChecadorVinculo(WCF_Checador.RequestPersonalChecadorVinculoAddUp request)
|
|
{
|
|
try
|
|
{
|
|
WCF_Checador.ChecadorServiceClient client = new WCF_Checador.ChecadorServiceClient();// new WCF_Service.ChecadorServiceClient(WCF_Service.ChecadorServiceClient.EndpointConfiguration.BasicHttpBinding_IChecadorService, ModVarsPV.Address);
|
|
return client.AddUpPersonalChecadorVinculo(request);
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
GuardaLog(string.Format("Ocurrió un error al iniciar el servicio\r\n{0}", e));
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|