public HttpResponseMessage Post(Registro_en_Evento varRegistro_en_Evento) { if (ModelState.IsValid) { var data = "-1"; try { data = Convert.ToString(this.service.Insert(varRegistro_en_Evento)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_InsRegistro_en_Evento", new JavaScriptSerializer().Serialize(varRegistro_en_Evento), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsRegistro_en_Evento", new JavaScriptSerializer().Serialize(varRegistro_en_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_InsRegistro_en_Evento", new JavaScriptSerializer().Serialize(varRegistro_en_Evento), false, errors.ToString()); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.BadRequest, errors)); } }
public HttpResponseMessage Delete(int id) { Registro_en_Evento varRegistro_en_Evento = this.service.GetByKey(id, false); bool result = false; if (varRegistro_en_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_DelRegistro_en_Evento", new JavaScriptSerializer().Serialize(varRegistro_en_Evento), result); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, id, BitacoraHelper.TypeSql.DELETE, "sp_DelRegistro_en_Evento", new JavaScriptSerializer().Serialize(varRegistro_en_Evento), result, ex.Message); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public HttpResponseMessage PutTunnel(Registro_en_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)); }
public HttpResponseMessage Get_Datos_Generales(int id) { Registro_en_Evento entity = this.service.ListaSelAll(1, 1, "Registro_en_Evento.Folio='" + id.ToString() + "'", "").Registro_en_Eventos.First(); Registro_en_Evento result = new Registro_en_Evento(); result.Folio = entity.Folio; result.Fecha_de_Registro = entity.Fecha_de_Registro; result.Hora_de_Registro = entity.Hora_de_Registro; result.Usuario_que_Registra = entity.Usuario_que_Registra; result.Usuario_que_Registra_Spartan_User = entity.Usuario_que_Registra_Spartan_User; result.Evento = entity.Evento; result.Evento_Eventos = entity.Evento_Eventos; result.Descripcion = entity.Descripcion; result.Fecha_inicio_del_Evento = entity.Fecha_inicio_del_Evento; result.Fecha_fin_del_Evento = entity.Fecha_fin_del_Evento; result.Lugar = entity.Lugar; return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter)); }
public HttpResponseMessage Put_Datos_Generales(Registro_en_Evento varRegistro_en_Evento_Datos_Generales) { var data = "-1"; try { data = Convert.ToString(this.service.Update_Datos_Generales(varRegistro_en_Evento_Datos_Generales)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varRegistro_en_Evento_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdRegistro_en_Evento", new JavaScriptSerializer().Serialize(varRegistro_en_Evento_Datos_Generales), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varRegistro_en_Evento_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdRegistro_en_Evento", new JavaScriptSerializer().Serialize(varRegistro_en_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)); }
public HttpResponseMessage Registro_en_EventoGenerateID() { Registro_en_Evento varRegistro_en_Evento = new Registro_en_Evento(); var data = "-1"; try { data = Convert.ToString(this.service.Insert(varRegistro_en_Evento)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_Registro_en_EventoGenerateID", new JavaScriptSerializer().Serialize(varRegistro_en_Evento), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_Registro_en_EventoGenerateID", new JavaScriptSerializer().Serialize(varRegistro_en_Evento), true); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter)); }