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())); } }
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())); } }
public HttpResponseMessage GeTitularidad(JObject data) { String token = AccountController.GetTokenHeader(Request); string mensaje; int codigoError; try { Debug.Print("----- START ws geTitularidad ----"); var tipo = data.GetValue("tipo").Value <string>().ToUpper(); var nombre = data.GetValue("nombre").Value <string>().ToUpper(); var apPaterno = data.GetValue("apPaterno").Value <string>().ToUpper(); var apMaterno = data.GetValue("apMaterno").Value <string>().ToUpper(); var razonSocial = data.GetValue("razonSocial").Value <string>().ToUpper(); ConsultaService service = new ConsultaService(); var results = service.ConsultarTitularidad(tipo, nombre, apPaterno, apMaterno, razonSocial, out mensaje, out codigoError); RestDataResponse response = new RestDataResponse(results, RestDataResponse.STATUS_OK, mensaje); Debug.Print("----- END ws geTitularidad ----"); CRUDConsultaDbUtil.SaveConsulta(token, Constants.CONSULTA_TITULARIDAD_ID, data.ToString(), codigoError.ToString(), mensaje); return(this.Request.CreateResponse(HttpStatusCode.OK, response)); } catch (Exception e) { Debug.Print(e.Message); Debug.Print(e.StackTrace.ToString()); ErrorDataResponse error = new ErrorDataResponse(e.Message, e.StackTrace.ToString()); CRUDConsultaDbUtil.SaveConsulta(token, Constants.CONSULTA_TITULARIDAD_ID, data.ToString(), RestDataResponse.STATUS_ERROR.ToString(), "Error: " + error); return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorMessagesUtil.error())); } }
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())); } }
public HttpResponseMessage ActCred(JObject data) { String token = AccountController.GetTokenHeader(Request); string mensaje; int codigoError; try { Debug.Print("----- START ws ActCred ----"); var user = data.GetValue("user").Value <string>(); var credAnt = data.GetValue("cred_act").Value <string>(); var credNew = data.GetValue("cred_new").Value <string>(); ConsultaService service = new ConsultaService(); var results = service.ActualizarCredenciales(user, credAnt, credNew, out mensaje, out codigoError); RestDataResponse response = new RestDataResponse(results, RestDataResponse.STATUS_OK, mensaje); Debug.Print("----- END ws ActCred ----"); CRUDConsultaDbUtil.SaveConsulta(token, Constants.ACTUALIZAR_CRED, data.ToString(), codigoError.ToString(), mensaje); return(this.Request.CreateResponse(HttpStatusCode.OK, response)); } catch (Exception e) { Debug.Print(e.Message); Debug.Print(e.StackTrace.ToString()); CRUDConsultaDbUtil.SaveConsulta(token, Constants.ACTUALIZAR_CRED, data.ToString(), RestDataResponse.STATUS_ERROR.ToString(), "Error: " + e.Message); return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorMessagesUtil.error())); } }
public HttpResponseMessage GetByRuc(JObject data) { String token = AccountController.GetTokenHeader(Request); string mensaje; int codigoError; try { Debug.Print("----- START ws getByRuc ----"); var ruc = data.GetValue("ruc").Value <string>(); ConsultaService service = new ConsultaService(); var results = service.ConsultarPorRuc(ruc, out mensaje, out codigoError); RestDataResponse response = new RestDataResponse(results, RestDataResponse.STATUS_OK, mensaje); Debug.Print("----- END ws getByRuc ----"); CRUDConsultaDbUtil.SaveConsulta(token, Constants.CONSULTA_RUC_ID, data.ToString(), codigoError.ToString(), mensaje); return(this.Request.CreateResponse(HttpStatusCode.OK, response)); } catch (Exception e) { Debug.Print(e.Message); Debug.Print(e.StackTrace.ToString()); ErrorDataResponse error = new ErrorDataResponse(e.Message, e.StackTrace.ToString()); CRUDConsultaDbUtil.SaveConsulta(token, Constants.CONSULTA_RUC_ID, data.ToString(), RestDataResponse.STATUS_ERROR.ToString(), "Error: " + error); return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorMessagesUtil.error())); } }
public HttpResponseMessage GetVigencia(JObject data) { String token = AccountController.GetTokenHeader(Request); string mensaje; int codigoError; try { Debug.Print("----- START ws getVigencia ----"); var transaccion = data.GetValue("transaccion").Value <string>(); var idImg = data.GetValue("id_img").Value <string>(); var tipo = data.GetValue("tipo").Value <string>(); var totalPag = data.GetValue("total_pag").Value <string>(); var pagRef = data.GetValue("pag_ref").Value <string>(); var pag = data.GetValue("nro_pag").Value <string>(); ConsultaService service = new ConsultaService(); var results = service.ConsultarImagenVigenciaPoder(transaccion, idImg, tipo, totalPag, pagRef, pag, out mensaje, out codigoError); RestDataResponse response = new RestDataResponse(results, RestDataResponse.STATUS_OK, mensaje); Debug.Print("----- END ws getVigencia ----"); CRUDConsultaDbUtil.SaveConsulta(token, Constants.CONSULTA_VIGENCIA_ID, data.ToString(), codigoError.ToString(), mensaje); return(this.Request.CreateResponse(HttpStatusCode.OK, response)); } catch (Exception e) { Debug.Print(e.Message); Debug.Print(e.StackTrace.ToString()); ErrorDataResponse error = new ErrorDataResponse(e.Message, e.StackTrace.ToString()); CRUDConsultaDbUtil.SaveConsulta(token, Constants.CONSULTA_VIGENCIA_ID, data.ToString(), RestDataResponse.STATUS_ERROR.ToString(), "Error: " + error); return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorMessagesUtil.error())); } }
public HttpResponseMessage GetOficinas() { String token = AccountController.GetTokenHeader(Request); try { ConsultaService service = new ConsultaService(); var results = service.ConsultarOficina(); RestDataResponse response = new RestDataResponse(results, RestDataResponse.STATUS_OK, ""); return(this.Request.CreateResponse(HttpStatusCode.OK, response)); } catch (Exception e) { Debug.Print(e.Message); Debug.Print(e.StackTrace.ToString()); return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorMessagesUtil.error())); } }
public HttpResponseMessage GetAsientosTitularidad(JObject data) { String token = AccountController.GetTokenHeader(Request); string mensaje; int codigoError; try { Debug.Print("----- START ws getAsientosTitularidad ----"); var zona = data.GetValue("zona").Value <string>(); var oficina = data.GetValue("oficina").Value <string>(); var partida = data.GetValue("partida").Value <string>(); var registro = data.GetValue("registro").Value <string>(); ConsultaService service = new ConsultaService(); var results = service.ConsultarDetalleTitularidad(zona, oficina, partida, registro, out mensaje, out codigoError); RestDataResponse response = new RestDataResponse(results, RestDataResponse.STATUS_OK, mensaje); Debug.Print("----- END ws getAsientosTitularidad ----"); CRUDConsultaDbUtil.SaveConsulta(token, Constants.CONSULTA_ASIENTOS_ID, data.ToString(), codigoError.ToString(), mensaje); return(this.Request.CreateResponse(HttpStatusCode.OK, response)); } catch (Exception e) { Debug.Print(e.Message); Debug.Print(e.StackTrace.ToString()); ErrorDataResponse error = new ErrorDataResponse(e.Message, e.StackTrace.ToString()); CRUDConsultaDbUtil.SaveConsulta(token, Constants.CONSULTA_ASIENTOS_ID, data.ToString(), RestDataResponse.STATUS_ERROR.ToString(), "Error: " + error); return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorMessagesUtil.error())); } }
public HttpResponseMessage RecoveryPass(JObject data) { try { if (data == null) { return(this.Request.CreateResponse(HttpStatusCode.BadRequest, ErrorMessagesUtil.formatoIncorrecto())); } var email = data.GetValue("email"); // Cambiar contraseña por medio de cerbero IList <String> acc = new List <String>(); if (acc.Count == 0) { return(this.Request.CreateResponse(HttpStatusCode.Unauthorized, ErrorMessagesUtil.userNoExits())); } else { RestDataResponse response = new RestDataResponse(null, RestDataResponse.STATUS_OK, "Contraseña recuperada"); return(this.Request.CreateResponse(HttpStatusCode.OK, response)); } } catch (Exception e) { Debug.Print(e.Message); Debug.Print(e.StackTrace.ToString()); return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorMessagesUtil.error())); } }
public HttpResponseMessage Login(JObject data) { try { Debug.Print("----- START ws login ----"); var user = data.GetValue("user").Value <string>(); var pass = data.GetValue("pass").Value <string>(); Debug.Print("user: "******"pass: "******"{0}{1}{2}", user, DateTime.Now.Millisecond, DateTime.Now.ToShortTimeString()))); CRUDConsultaDbUtil.GuardarToken(user, tokenString); var opciones = resultAuntenticar.opciones.Split('|').ToList(); var usuario = new Usuario(user, tokenString, opciones); RestDataResponse response = new RestDataResponse(usuario, RestDataResponse.STATUS_OK, "Usuario logueado correctamente"); new LogUtil(user + " se logueo el " + DateTime.Now.ToLongTimeString() + " " + DateTime.Now.ToLongDateString()); Debug.Print("----- END ws login ----"); return(this.Request.CreateResponse(HttpStatusCode.OK, response)); } else { Debug.Print("----- END ws login (No se pudo loguear en cerbero) ----"); return(this.Request.CreateResponse(HttpStatusCode.Unauthorized, ErrorMessagesUtil.cannotLoginCerbero())); } } else { Debug.Print("----- END ws login (No se pudo conectar a cerbero) ----"); return(this.Request.CreateResponse(HttpStatusCode.Unauthorized, ErrorMessagesUtil.cannotConnectCerbero())); } } catch (Exception ex) { Debug.Print(ex.Message); Debug.Print(ex.StackTrace.ToString()); new LogUtil(ex); return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorMessagesUtil.error())); } }