Exemplo n.º 1
0
        public HttpResponseMessage RegistroConsultas(JObject data)
        {
            try
            {
                Debug.Print("----- START ws RegistroConsultas ----");
                var startDate = data.GetValue("startDate").Value <string>();
                var endDate   = data.GetValue("endDate").Value <string>();

                Debug.Print(startDate);
                Debug.Print(endDate);

                var results = CRUDConsultaDbUtil.FindConsultaInRange(startDate, endDate);

                if (results != null)
                {
                    RestDataResponse response = new RestDataResponse(results, RestDataResponse.STATUS_OK, "");

                    Debug.Print("----- END ws RegistroConsultas ----");
                    return(this.Request.CreateResponse(HttpStatusCode.OK, response));
                }
                else
                {
                    return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorMessagesUtil.cannotGetInfo()));
                }
            }
            catch (Exception e)
            {
                Debug.Print(e.Message);
                Debug.Print(e.StackTrace.ToString());
                return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorMessagesUtil.error()));
            }
        }
Exemplo n.º 2
0
        public HttpResponseMessage ResumenConsultas(JObject data)
        {
            try
            {
                Debug.Print("----- START ws ResumenConsultas ----");
                var date = data.GetValue("date").Value <string>();

                Debug.Print(date);

                var fechaResumen = DateUtil.ParseDateFromString(date, DateUtil.FORMAT_DATETIME_1);
                var month        = fechaResumen.Month;
                var year         = fechaResumen.Year;

                var results = CRUDConsultaDbUtil.FindConsultaInMothYear(month, year);

                if (results != null)
                {
                    RestDataResponse response = new RestDataResponse(results, RestDataResponse.STATUS_OK, "");

                    Debug.Print("----- END ws ResumenConsultas ----");
                    return(this.Request.CreateResponse(HttpStatusCode.OK, response));
                }
                else
                {
                    return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorMessagesUtil.cannotGetInfo()));
                }
            }
            catch (Exception e)
            {
                Debug.Print(e.Message);
                Debug.Print(e.StackTrace.ToString());
                return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorMessagesUtil.error()));
            }
        }
Exemplo n.º 3
0
        public HttpResponseMessage ListarConsultas()
        {
            try
            {
                Debug.Print("----- START ws ListarConsultas ----");
                var results = CRUDConsultaDbUtil.ObtenerConsultas();

                if (results != null)
                {
                    RestDataResponse response = new RestDataResponse(results, RestDataResponse.STATUS_OK, "");

                    Debug.Print("----- END ws ListarConsultas ----");
                    return(this.Request.CreateResponse(HttpStatusCode.OK, response));
                }
                else
                {
                    return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorMessagesUtil.cannotGetInfo()));
                }
            }
            catch (Exception e)
            {
                Debug.Print(e.Message);
                Debug.Print(e.StackTrace.ToString());
                return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorMessagesUtil.error()));
            }
        }