public HttpResponseMessage Post(Detalle_Laboratorios_Clinicos varDetalle_Laboratorios_Clinicos) { if (ModelState.IsValid) { var data = "-1"; try { data = Convert.ToString(this.service.Insert(varDetalle_Laboratorios_Clinicos)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_InsDetalle_Laboratorios_Clinicos", new JavaScriptSerializer().Serialize(varDetalle_Laboratorios_Clinicos), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsDetalle_Laboratorios_Clinicos", new JavaScriptSerializer().Serialize(varDetalle_Laboratorios_Clinicos), 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_Laboratorios_Clinicos", new JavaScriptSerializer().Serialize(varDetalle_Laboratorios_Clinicos), false, errors.ToString()); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.BadRequest, errors)); } }
public HttpResponseMessage Delete(int id) { Detalle_Laboratorios_Clinicos varDetalle_Laboratorios_Clinicos = this.service.GetByKey(id, false); bool result = false; if (varDetalle_Laboratorios_Clinicos == 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_Laboratorios_Clinicos", new JavaScriptSerializer().Serialize(varDetalle_Laboratorios_Clinicos), result); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, id, BitacoraHelper.TypeSql.DELETE, "sp_DelDetalle_Laboratorios_Clinicos", new JavaScriptSerializer().Serialize(varDetalle_Laboratorios_Clinicos), result, ex.Message); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public HttpResponseMessage PutTunnel(Detalle_Laboratorios_Clinicos 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 Put_Datos_Generales(Detalle_Laboratorios_Clinicos varDetalle_Laboratorios_Clinicos_Datos_Generales) { var data = "-1"; try { data = Convert.ToString(this.service.Update_Datos_Generales(varDetalle_Laboratorios_Clinicos_Datos_Generales)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varDetalle_Laboratorios_Clinicos_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdDetalle_Laboratorios_Clinicos", new JavaScriptSerializer().Serialize(varDetalle_Laboratorios_Clinicos_Datos_Generales), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varDetalle_Laboratorios_Clinicos_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdDetalle_Laboratorios_Clinicos", new JavaScriptSerializer().Serialize(varDetalle_Laboratorios_Clinicos_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 ActionResult Post(bool IsNew, Detalle_Laboratorios_ClinicosModel varDetalle_Laboratorios_Clinicos) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Laboratorios_ClinicosApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_Laboratorios_ClinicosInfo = new Detalle_Laboratorios_Clinicos { Folio = varDetalle_Laboratorios_Clinicos.Folio , Numero_de_Empleado_Titular = varDetalle_Laboratorios_Clinicos.Numero_de_Empleado_Titular , Nombre_Completo = varDetalle_Laboratorios_Clinicos.Nombre_Completo , Familiar_del_Empleado = varDetalle_Laboratorios_Clinicos.Familiar_del_Empleado , Numero_de_Empleado_Beneficiario = varDetalle_Laboratorios_Clinicos.Numero_de_Empleado_Beneficiario , Indicador = varDetalle_Laboratorios_Clinicos.Indicador , Resultado = varDetalle_Laboratorios_Clinicos.Resultado , Unidad = varDetalle_Laboratorios_Clinicos.Unidad , Intervalo_de_referencia = varDetalle_Laboratorios_Clinicos.Intervalo_de_referencia , Fecha_de_Resultado = (!String.IsNullOrEmpty(varDetalle_Laboratorios_Clinicos.Fecha_de_Resultado)) ? DateTime.ParseExact(varDetalle_Laboratorios_Clinicos.Fecha_de_Resultado, ConfigurationProperty.DateFormat, CultureInfo.InvariantCulture as IFormatProvider) : (DateTime?)null , Estatus_Indicador = varDetalle_Laboratorios_Clinicos.Estatus_Indicador }; result = !IsNew? _IDetalle_Laboratorios_ClinicosApiConsumer.Update(Detalle_Laboratorios_ClinicosInfo, null, null).Resource.ToString() : _IDetalle_Laboratorios_ClinicosApiConsumer.Insert(Detalle_Laboratorios_ClinicosInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public HttpResponseMessage Detalle_Laboratorios_ClinicosGenerateID() { Detalle_Laboratorios_Clinicos varDetalle_Laboratorios_Clinicos = new Detalle_Laboratorios_Clinicos(); var data = "-1"; try { data = Convert.ToString(this.service.Insert(varDetalle_Laboratorios_Clinicos)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_Detalle_Laboratorios_ClinicosGenerateID", new JavaScriptSerializer().Serialize(varDetalle_Laboratorios_Clinicos), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_Detalle_Laboratorios_ClinicosGenerateID", new JavaScriptSerializer().Serialize(varDetalle_Laboratorios_Clinicos), true); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter)); }
public HttpResponseMessage Get_Datos_Generales(int id) { Detalle_Laboratorios_Clinicos entity = this.service.ListaSelAll(1, 1, "Detalle_Laboratorios_Clinicos.Folio='" + id.ToString() + "'", "").Detalle_Laboratorios_Clinicoss.First(); Detalle_Laboratorios_Clinicos result = new Detalle_Laboratorios_Clinicos(); result.Folio = entity.Folio; result.Numero_de_Empleado_Titular = entity.Numero_de_Empleado_Titular; result.Nombre_Completo = entity.Nombre_Completo; result.Familiar_del_Empleado = entity.Familiar_del_Empleado; result.Numero_de_Empleado_Beneficiario = entity.Numero_de_Empleado_Beneficiario; 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 ActionResult Delete(int id) { try { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Laboratorios_ClinicosApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_Laboratorios_Clinicos varDetalle_Laboratorios_Clinicos = null; if (id.ToString() != "0") { string where = ""; } var result = _IDetalle_Laboratorios_ClinicosApiConsumer.Delete(id, null, null).Resource; return(Json(result, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }