コード例 #1
0
        public HttpResponseMessage Post(Detalle_Actividades_Evento varDetalle_Actividades_Evento)
        {
            if (ModelState.IsValid)
            {
                var data = "-1";
                try
                {
                    data = Convert.ToString(this.service.Insert(varDetalle_Actividades_Evento));
                    var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_InsDetalle_Actividades_Evento", new JavaScriptSerializer().Serialize(varDetalle_Actividades_Evento), true);
                    serviceBitacora.Insert(bitacora);
                }
                catch (ServiceException ex)
                {
                    var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsDetalle_Actividades_Evento", new JavaScriptSerializer().Serialize(varDetalle_Actividades_Evento), 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_Actividades_Evento", new JavaScriptSerializer().Serialize(varDetalle_Actividades_Evento), false, errors.ToString());
                serviceBitacora.Insert(bitacora);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, errors));
            }
        }
コード例 #2
0
        public HttpResponseMessage Delete(int id)
        {
            Detalle_Actividades_Evento varDetalle_Actividades_Evento = this.service.GetByKey(id, false);
            bool result = false;

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

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
コード例 #3
0
        public HttpResponseMessage Get_Datos_Generales(int id)
        {
            Detalle_Actividades_Evento entity = this.service.ListaSelAll(1, 1, "Detalle_Actividades_Evento.Folio='" + id.ToString() + "'", "").Detalle_Actividades_Eventos.First();
            Detalle_Actividades_Evento result = new Detalle_Actividades_Evento();

            result.Folio             = entity.Folio;
            result.Tipo_de_Actividad = entity.Tipo_de_Actividad;
            result.Tipo_de_Actividad_Tipos_de_Actividades = entity.Tipo_de_Actividad_Tipos_de_Actividades;
            result.Especialidad = entity.Especialidad;
            result.Especialidad_Especialidades = entity.Especialidad_Especialidades;
            result.Nombre_de_la_Actividad      = entity.Nombre_de_la_Actividad;
            result.Descripcion   = entity.Descripcion;
            result.Quien_imparte = entity.Quien_imparte;
            result.Quien_imparte_Spartan_User = entity.Quien_imparte_Spartan_User;
            result.Dia                = entity.Dia;
            result.Hora_inicio        = entity.Hora_inicio;
            result.Hora_fin           = entity.Hora_fin;
            result.Tiene_receso       = entity.Tiene_receso;
            result.Hora_inicio_receso = entity.Hora_inicio_receso;
            result.Hora_fin_receso    = entity.Hora_fin_receso;
            result.Duracion_maxima_por_paciente_mins = entity.Duracion_maxima_por_paciente_mins;
            result.Cupo_limitado = entity.Cupo_limitado;
            result.Cupo_maximo   = entity.Cupo_maximo;
            result.Ubicacion     = entity.Ubicacion;
            result.Ubicacion_Ubicaciones_Eventos_Empresa = entity.Ubicacion_Ubicaciones_Eventos_Empresa;
            result.Estatus_de_la_Actividad = entity.Estatus_de_la_Actividad;
            result.Estatus_de_la_Actividad_Estatus_Actividades_Evento = entity.Estatus_de_la_Actividad_Estatus_Actividades_Evento;

            return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter));
        }
コード例 #4
0
        public HttpResponseMessage PutTunnel(Detalle_Actividades_Evento 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));
        }
コード例 #5
0
        public HttpResponseMessage Put_Datos_Generales(Detalle_Actividades_Evento varDetalle_Actividades_Evento_Datos_Generales)
        {
            var data = "-1";

            try
            {
                data = Convert.ToString(this.service.Update_Datos_Generales(varDetalle_Actividades_Evento_Datos_Generales));
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varDetalle_Actividades_Evento_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdDetalle_Actividades_Evento", new JavaScriptSerializer().Serialize(varDetalle_Actividades_Evento_Datos_Generales), true);
                serviceBitacora.Insert(bitacora);
            }
            catch (ServiceException ex)
            {
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varDetalle_Actividades_Evento_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdDetalle_Actividades_Evento", new JavaScriptSerializer().Serialize(varDetalle_Actividades_Evento_Datos_Generales), false, ex.Message);
                serviceBitacora.Insert(bitacora);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter));
        }
コード例 #6
0
        public HttpResponseMessage Detalle_Actividades_EventoGenerateID()
        {
            Detalle_Actividades_Evento varDetalle_Actividades_Evento = new Detalle_Actividades_Evento();
            var data = "-1";

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

            return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter));
        }