Example #1
0
        public static void Main(string[] args)
        {
            string url = "http://localhost/autenticacion";

            using (JsonServiceClient client = new JsonServiceClient(url))
            {
                //var request = new LoginData { UserName="******", Password="******" };
                var request = new LoginData { UserName="******", Password="******" };
                var response = client.Send<LoginResponse>(request);
                Console.WriteLine(response.Success);

            }
        }
Example #2
0
		public Session CreateSession (LoginData userData, string ipAddress, string userAgent)
		{
			var response = Validate(userData);
			if( response==default(Usuario))
				throw new UnauthenticatedException("Usuario No Autenticado");
			
			if( !response.Activo )
				throw new UnauthenticatedException("Usuario se encuentra inactivo");
			
			return AuthUserSession.Add(
			 new UserBase(){
				Name=response.Nombre,
				UserId=response.Id.ToString()
			 },
			 ipAddress,userAgent);
		}
Example #3
0
        public static void Main(string[] args)
        {
            string tipo;

            DateTime desde;
            DateTime hasta;
            DateTime hoy = DateTime.Today;

            if(args.Length>0)
                tipo= args[0].ToUpper();
            else
                tipo= "SEMANAL";

            if(tipo=="SEMANAL"){
                desde= hoy.AddDays(-8);
                hasta= hoy.AddDays(-2);
            }

            else if( tipo=="MENSUAL" ){
                int mes = hoy.Month >1 ? hoy.Month-1: 12 ;
                int anio =  hoy.Month >1?  hoy.Year: hoy.Year-1;

                desde= new DateTime(anio, mes, 1);
                hasta= new DateTime(anio, mes, DateTime.DaysInMonth(anio, mes) );
            }
            else{
                Console.WriteLine("uso mono EstadoResultados.exe SEMANAL\nuso mono EstadoResultados.exe MENSUAL");
                return;
            }

            string url = "http://localhost/autenticacion";
            string urlServicio = "http://localhost/servicio";

            using (JsonServiceClient client = new JsonServiceClient(url))
            {
                //var request = new LoginData { UserName="******", Password="******" };
                var request = new LoginData { UserName="******", Password="******" };
                var response = client.Send<LoginResponse>(request);

                if(!response.Success){
                    Console.WriteLine(response.ResponseStatus.Message);
                    return ;
                }

                using (JsonServiceClient cl = new JsonServiceClient(urlServicio))
                {
                    CajaConsolidadoGet er = new CajaConsolidadoGet()
                    {
                        Desde= desde,
                        Hasta= hasta,
                        SessionId= response.Id,
                        SendMail=true,
                    };

                    CajaConsolidadoGetResponse r = cl.Send<CajaConsolidadoGetResponse>(er);
                    if( ! r.Success ){
                        Console.WriteLine(r.ResponseStatus.Message);
                    }

                    LogoutData lo = new LogoutData(){
                        SessionId= response.Id
                    };

                    client.Send<LogoutResponse>(lo);
                }

            }
            Console.WriteLine("This is The End my friend");
        }
Example #4
0
		private Usuario Validate(LoginData userData ){
			return DbFactory.Usuario(userData.UserName, userData.Password);
			
			
		}