Example #1
0
        public ActionResult Post(bool IsNew, Detalle_Notificaciones_PacienteModel varDetalle_Notificaciones_Paciente)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (!_tokenManager.GenerateToken())
                    {
                        return(Json(null, JsonRequestBehavior.AllowGet));
                    }
                    _IDetalle_Notificaciones_PacienteApiConsumer.SetAuthHeader(_tokenManager.Token);



                    var result = "";
                    var Detalle_Notificaciones_PacienteInfo = new Detalle_Notificaciones_Paciente
                    {
                        Folio           = varDetalle_Notificaciones_Paciente.Folio
                        , Funcionalidad = varDetalle_Notificaciones_Paciente.Funcionalidad
                    };

                    result = !IsNew?
                             _IDetalle_Notificaciones_PacienteApiConsumer.Update(Detalle_Notificaciones_PacienteInfo, null, null).Resource.ToString() :
                                 _IDetalle_Notificaciones_PacienteApiConsumer.Insert(Detalle_Notificaciones_PacienteInfo, null, null).Resource.ToString();

                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Example #2
0
        public HttpResponseMessage Post(Detalle_Notificaciones_Paciente varDetalle_Notificaciones_Paciente)
        {
            if (ModelState.IsValid)
            {
                var data = "-1";
                try
                {
                    data = Convert.ToString(this.service.Insert(varDetalle_Notificaciones_Paciente));
                    var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_InsDetalle_Notificaciones_Paciente", new JavaScriptSerializer().Serialize(varDetalle_Notificaciones_Paciente), true);
                    serviceBitacora.Insert(bitacora);
                }
                catch (ServiceException ex)
                {
                    var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsDetalle_Notificaciones_Paciente", new JavaScriptSerializer().Serialize(varDetalle_Notificaciones_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_Notificaciones_Paciente", new JavaScriptSerializer().Serialize(varDetalle_Notificaciones_Paciente), false, errors.ToString());
                serviceBitacora.Insert(bitacora);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, errors));
            }
        }
Example #3
0
        public HttpResponseMessage Delete(int id)
        {
            Detalle_Notificaciones_Paciente varDetalle_Notificaciones_Paciente = this.service.GetByKey(id, false);
            bool result = false;

            if (varDetalle_Notificaciones_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_Notificaciones_Paciente", new JavaScriptSerializer().Serialize(varDetalle_Notificaciones_Paciente), result);
                serviceBitacora.Insert(bitacora);
            }
            catch (ServiceException ex)
            {
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, id, BitacoraHelper.TypeSql.DELETE, "sp_DelDetalle_Notificaciones_Paciente", new JavaScriptSerializer().Serialize(varDetalle_Notificaciones_Paciente), result, ex.Message);
                serviceBitacora.Insert(bitacora);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
Example #4
0
        public HttpResponseMessage Get_Datos_Generales(int id)
        {
            Detalle_Notificaciones_Paciente entity = this.service.ListaSelAll(1, 1, "Detalle_Notificaciones_Paciente.Folio='" + id.ToString() + "'", "").Detalle_Notificaciones_Pacientes.First();
            Detalle_Notificaciones_Paciente result = new Detalle_Notificaciones_Paciente();

            result.Folio         = entity.Folio;
            result.Funcionalidad = entity.Funcionalidad;
            result.Funcionalidad_Funcionalidades_para_Notificacion = entity.Funcionalidad_Funcionalidades_para_Notificacion;

            return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter));
        }
Example #5
0
        public HttpResponseMessage PutTunnel(Detalle_Notificaciones_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));
        }
Example #6
0
        public HttpResponseMessage Put_Datos_Generales(Detalle_Notificaciones_Paciente varDetalle_Notificaciones_Paciente_Datos_Generales)
        {
            var data = "-1";

            try
            {
                data = Convert.ToString(this.service.Update_Datos_Generales(varDetalle_Notificaciones_Paciente_Datos_Generales));
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varDetalle_Notificaciones_Paciente_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdDetalle_Notificaciones_Paciente", new JavaScriptSerializer().Serialize(varDetalle_Notificaciones_Paciente_Datos_Generales), true);
                serviceBitacora.Insert(bitacora);
            }
            catch (ServiceException ex)
            {
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varDetalle_Notificaciones_Paciente_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdDetalle_Notificaciones_Paciente", new JavaScriptSerializer().Serialize(varDetalle_Notificaciones_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));
        }
Example #7
0
        public HttpResponseMessage Detalle_Notificaciones_PacienteGenerateID()
        {
            Detalle_Notificaciones_Paciente varDetalle_Notificaciones_Paciente = new Detalle_Notificaciones_Paciente();
            var data = "-1";

            try
            {
                data = Convert.ToString(this.service.Insert(varDetalle_Notificaciones_Paciente));
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_Detalle_Notificaciones_PacienteGenerateID", new JavaScriptSerializer().Serialize(varDetalle_Notificaciones_Paciente), true);
                serviceBitacora.Insert(bitacora);
            }
            catch (ServiceException ex)
            {
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_Detalle_Notificaciones_PacienteGenerateID", new JavaScriptSerializer().Serialize(varDetalle_Notificaciones_Paciente), true);
                serviceBitacora.Insert(bitacora);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter));
        }
Example #8
0
        public ActionResult Delete(int id)
        {
            try
            {
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IDetalle_Notificaciones_PacienteApiConsumer.SetAuthHeader(_tokenManager.Token);

                Detalle_Notificaciones_Paciente varDetalle_Notificaciones_Paciente = null;
                if (id.ToString() != "0")
                {
                    string where = "";
                }
                var result = _IDetalle_Notificaciones_PacienteApiConsumer.Delete(id, null, null).Resource;
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }