public HttpResponseMessage Post(Detalle_Examenes_Laboratorio varDetalle_Examenes_Laboratorio) { if (ModelState.IsValid) { var data = "-1"; try { data = Convert.ToString(this.service.Insert(varDetalle_Examenes_Laboratorio)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_InsDetalle_Examenes_Laboratorio", new JavaScriptSerializer().Serialize(varDetalle_Examenes_Laboratorio), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsDetalle_Examenes_Laboratorio", new JavaScriptSerializer().Serialize(varDetalle_Examenes_Laboratorio), true); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter)); } else { var errors = ModelState.SelectMany(m => m.Value.Errors.Select(err => err.ErrorMessage != string.Empty ? err.ErrorMessage : err.Exception.Message).ToList()).ToList(); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsDetalle_Examenes_Laboratorio", new JavaScriptSerializer().Serialize(varDetalle_Examenes_Laboratorio), false, errors.ToString()); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.BadRequest, errors)); } }
public HttpResponseMessage Delete(int id) { Detalle_Examenes_Laboratorio varDetalle_Examenes_Laboratorio = this.service.GetByKey(id, false); bool result = false; if (varDetalle_Examenes_Laboratorio == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } try { result = this.service.Delete(id);//, globalData, dataReference); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, id, BitacoraHelper.TypeSql.DELETE, "sp_DelDetalle_Examenes_Laboratorio", new JavaScriptSerializer().Serialize(varDetalle_Examenes_Laboratorio), result); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, id, BitacoraHelper.TypeSql.DELETE, "sp_DelDetalle_Examenes_Laboratorio", new JavaScriptSerializer().Serialize(varDetalle_Examenes_Laboratorio), result, ex.Message); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public HttpResponseMessage PutTunnel(Detalle_Examenes_Laboratorio emp, string user, string password) { var client = new System.Net.WebClient(); client.Headers = TokenManager.GetAuthenticationHeader(user, password); client.Headers["Content-Type"] = "application/json"; var dataString = new JavaScriptSerializer().Serialize(emp); var result = client.UploadString(new Uri(baseApi + ApiControllerUrl + "/Put?Id=" + emp.Folio), "PUT" , dataString); return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter)); }
public HttpResponseMessage Get_Datos_Generales(int id) { Detalle_Examenes_Laboratorio entity = this.service.ListaSelAll(1, 1, "Detalle_Examenes_Laboratorio.Folio='" + id.ToString() + "'", "").Detalle_Examenes_Laboratorios.First(); Detalle_Examenes_Laboratorio result = new Detalle_Examenes_Laboratorio(); result.Folio = entity.Folio; result.Indicador = entity.Indicador; result.Indicador_Indicadores_Laboratorio = entity.Indicador_Indicadores_Laboratorio; result.Resultado = entity.Resultado; result.Unidad = entity.Unidad; result.Intervalo_de_Referencia = entity.Intervalo_de_Referencia; result.Fecha_de_Resultado = entity.Fecha_de_Resultado; result.Estatus_Indicador = entity.Estatus_Indicador; return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter)); }
public HttpResponseMessage Put_Datos_Generales(Detalle_Examenes_Laboratorio varDetalle_Examenes_Laboratorio_Datos_Generales) { var data = "-1"; try { data = Convert.ToString(this.service.Update_Datos_Generales(varDetalle_Examenes_Laboratorio_Datos_Generales)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varDetalle_Examenes_Laboratorio_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdDetalle_Examenes_Laboratorio", new JavaScriptSerializer().Serialize(varDetalle_Examenes_Laboratorio_Datos_Generales), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varDetalle_Examenes_Laboratorio_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdDetalle_Examenes_Laboratorio", new JavaScriptSerializer().Serialize(varDetalle_Examenes_Laboratorio_Datos_Generales), false, ex.Message); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter)); }
public HttpResponseMessage Detalle_Examenes_LaboratorioGenerateID() { Detalle_Examenes_Laboratorio varDetalle_Examenes_Laboratorio = new Detalle_Examenes_Laboratorio(); var data = "-1"; try { data = Convert.ToString(this.service.Insert(varDetalle_Examenes_Laboratorio)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_Detalle_Examenes_LaboratorioGenerateID", new JavaScriptSerializer().Serialize(varDetalle_Examenes_Laboratorio), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_Detalle_Examenes_LaboratorioGenerateID", new JavaScriptSerializer().Serialize(varDetalle_Examenes_Laboratorio), true); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter)); }
public ActionResult Post(bool IsNew, Detalle_Examenes_LaboratorioModel varDetalle_Examenes_Laboratorio) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Examenes_LaboratorioApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_Examenes_LaboratorioInfo = new Detalle_Examenes_Laboratorio { Folio = varDetalle_Examenes_Laboratorio.Folio , Indicador = varDetalle_Examenes_Laboratorio.Indicador , Resultado = varDetalle_Examenes_Laboratorio.Resultado , Unidad = varDetalle_Examenes_Laboratorio.Unidad , Intervalo_de_Referencia = varDetalle_Examenes_Laboratorio.Intervalo_de_Referencia , Fecha_de_Resultado = (!String.IsNullOrEmpty(varDetalle_Examenes_Laboratorio.Fecha_de_Resultado)) ? DateTime.ParseExact(varDetalle_Examenes_Laboratorio.Fecha_de_Resultado, ConfigurationProperty.DateFormat, CultureInfo.InvariantCulture as IFormatProvider) : (DateTime?)null , Estatus_Indicador = varDetalle_Examenes_Laboratorio.Estatus_Indicador }; result = !IsNew? _IDetalle_Examenes_LaboratorioApiConsumer.Update(Detalle_Examenes_LaboratorioInfo, null, null).Resource.ToString() : _IDetalle_Examenes_LaboratorioApiConsumer.Insert(Detalle_Examenes_LaboratorioInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult Delete(int id) { try { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Examenes_LaboratorioApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_Examenes_Laboratorio varDetalle_Examenes_Laboratorio = null; if (id.ToString() != "0") { string where = ""; } var result = _IDetalle_Examenes_LaboratorioApiConsumer.Delete(id, null, null).Resource; return(Json(result, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }