public HttpResponseMessage Post(Detalle_Pagos_Paciente varDetalle_Pagos_Paciente) { if (ModelState.IsValid) { var data = "-1"; try { data = Convert.ToString(this.service.Insert(varDetalle_Pagos_Paciente)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_InsDetalle_Pagos_Paciente", new JavaScriptSerializer().Serialize(varDetalle_Pagos_Paciente), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsDetalle_Pagos_Paciente", new JavaScriptSerializer().Serialize(varDetalle_Pagos_Paciente), 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_Pagos_Paciente", new JavaScriptSerializer().Serialize(varDetalle_Pagos_Paciente), false, errors.ToString()); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.BadRequest, errors)); } }
public HttpResponseMessage Delete(int id) { Detalle_Pagos_Paciente varDetalle_Pagos_Paciente = this.service.GetByKey(id, false); bool result = false; if (varDetalle_Pagos_Paciente == 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_Pagos_Paciente", new JavaScriptSerializer().Serialize(varDetalle_Pagos_Paciente), result); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, id, BitacoraHelper.TypeSql.DELETE, "sp_DelDetalle_Pagos_Paciente", new JavaScriptSerializer().Serialize(varDetalle_Pagos_Paciente), result, ex.Message); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public HttpResponseMessage PutTunnel(Detalle_Pagos_Paciente 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_Pagos_Paciente varDetalle_Pagos_Paciente_Datos_Generales) { var data = "-1"; try { data = Convert.ToString(this.service.Update_Datos_Generales(varDetalle_Pagos_Paciente_Datos_Generales)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varDetalle_Pagos_Paciente_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdDetalle_Pagos_Paciente", new JavaScriptSerializer().Serialize(varDetalle_Pagos_Paciente_Datos_Generales), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varDetalle_Pagos_Paciente_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdDetalle_Pagos_Paciente", new JavaScriptSerializer().Serialize(varDetalle_Pagos_Paciente_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_Pagos_PacienteModel varDetalle_Pagos_Paciente) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Pagos_PacienteApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_Pagos_PacienteInfo = new Detalle_Pagos_Paciente { Folio = varDetalle_Pagos_Paciente.Folio , Suscripcion = varDetalle_Pagos_Paciente.Suscripcion , Concepto_de_Pago = varDetalle_Pagos_Paciente.Concepto_de_Pago , Fecha_de_Suscripcion = (!String.IsNullOrEmpty(varDetalle_Pagos_Paciente.Fecha_de_Suscripcion)) ? DateTime.ParseExact(varDetalle_Pagos_Paciente.Fecha_de_Suscripcion, ConfigurationProperty.DateFormat, CultureInfo.InvariantCulture as IFormatProvider) : (DateTime?)null , Numero_de_Pago = varDetalle_Pagos_Paciente.Numero_de_Pago , De_Total_de_Pagos = varDetalle_Pagos_Paciente.De_Total_de_Pagos , Fecha_Limite_de_Pago = (!String.IsNullOrEmpty(varDetalle_Pagos_Paciente.Fecha_Limite_de_Pago)) ? DateTime.ParseExact(varDetalle_Pagos_Paciente.Fecha_Limite_de_Pago, ConfigurationProperty.DateFormat, CultureInfo.InvariantCulture as IFormatProvider) : (DateTime?)null , Recordatorio_dias = varDetalle_Pagos_Paciente.Recordatorio_dias , Forma_de_Pago = varDetalle_Pagos_Paciente.Forma_de_Pago , Fecha_de_Pago = (!String.IsNullOrEmpty(varDetalle_Pagos_Paciente.Fecha_de_Pago)) ? DateTime.ParseExact(varDetalle_Pagos_Paciente.Fecha_de_Pago, ConfigurationProperty.DateFormat, CultureInfo.InvariantCulture as IFormatProvider) : (DateTime?)null , Estatus = varDetalle_Pagos_Paciente.Estatus }; result = !IsNew? _IDetalle_Pagos_PacienteApiConsumer.Update(Detalle_Pagos_PacienteInfo, null, null).Resource.ToString() : _IDetalle_Pagos_PacienteApiConsumer.Insert(Detalle_Pagos_PacienteInfo, 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_Pagos_PacienteGenerateID() { Detalle_Pagos_Paciente varDetalle_Pagos_Paciente = new Detalle_Pagos_Paciente(); var data = "-1"; try { data = Convert.ToString(this.service.Insert(varDetalle_Pagos_Paciente)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_Detalle_Pagos_PacienteGenerateID", new JavaScriptSerializer().Serialize(varDetalle_Pagos_Paciente), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_Detalle_Pagos_PacienteGenerateID", new JavaScriptSerializer().Serialize(varDetalle_Pagos_Paciente), 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_Pagos_Paciente entity = this.service.ListaSelAll(1, 1, "Detalle_Pagos_Paciente.Folio='" + id.ToString() + "'", "").Detalle_Pagos_Pacientes.First(); Detalle_Pagos_Paciente result = new Detalle_Pagos_Paciente(); result.Folio = entity.Folio; result.Suscripcion = entity.Suscripcion; result.Suscripcion_Planes_de_Suscripcion = entity.Suscripcion_Planes_de_Suscripcion; result.Concepto_de_Pago = entity.Concepto_de_Pago; result.Fecha_de_Suscripcion = entity.Fecha_de_Suscripcion; result.Numero_de_Pago = entity.Numero_de_Pago; result.De_Total_de_Pagos = entity.De_Total_de_Pagos; result.Fecha_Limite_de_Pago = entity.Fecha_Limite_de_Pago; result.Recordatorio_dias = entity.Recordatorio_dias; result.Forma_de_Pago = entity.Forma_de_Pago; result.Forma_de_Pago_Formas_de_Pago = entity.Forma_de_Pago_Formas_de_Pago; result.Fecha_de_Pago = entity.Fecha_de_Pago; result.Estatus = entity.Estatus; result.Estatus_Estatus_de_Pago = entity.Estatus_Estatus_de_Pago; return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter)); }
public ActionResult Delete(int id) { try { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Pagos_PacienteApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_Pagos_Paciente varDetalle_Pagos_Paciente = null; if (id.ToString() != "0") { string where = ""; } var result = _IDetalle_Pagos_PacienteApiConsumer.Delete(id, null, null).Resource; return(Json(result, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }