public HttpResponseMessage Delete(int id) { Detalle_Platillos varDetalle_Platillos = this.service.GetByKey(id, false); bool result = false; if (varDetalle_Platillos == 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_Platillos", new JavaScriptSerializer().Serialize(varDetalle_Platillos), result); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, id, BitacoraHelper.TypeSql.DELETE, "sp_DelDetalle_Platillos", new JavaScriptSerializer().Serialize(varDetalle_Platillos), result, ex.Message); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public HttpResponseMessage Post(Detalle_Platillos varDetalle_Platillos) { if (ModelState.IsValid) { var data = "-1"; try { data = Convert.ToString(this.service.Insert(varDetalle_Platillos)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_InsDetalle_Platillos", new JavaScriptSerializer().Serialize(varDetalle_Platillos), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsDetalle_Platillos", new JavaScriptSerializer().Serialize(varDetalle_Platillos), 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_Platillos", new JavaScriptSerializer().Serialize(varDetalle_Platillos), false, errors.ToString()); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.BadRequest, errors)); } }
public HttpResponseMessage PutTunnel(Detalle_Platillos 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) { Detalle_Platillos entity = this.service.ListaSelAll(1, 1, "Detalle_Platillos.Folio='" + id.ToString() + "'", "").Detalle_Platilloss.First(); Detalle_Platillos result = new Detalle_Platillos(); result.Folio = entity.Folio; result.Cantidad = entity.Cantidad; result.Unidad = entity.Unidad; result.Ingrediente = entity.Ingrediente; result.Ingrediente_Ingredientes = entity.Ingrediente_Ingredientes; result.Unidad_SMAE = entity.Unidad_SMAE; result.Porciones = entity.Porciones; result.Texto_para_mostrar = entity.Texto_para_mostrar; return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter)); }
public ActionResult Post(bool IsNew, Detalle_PlatillosModel varDetalle_Platillos) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_PlatillosApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_PlatillosInfo = new Detalle_Platillos { Folio = varDetalle_Platillos.Folio , Lleva_fracciones = varDetalle_Platillos.Lleva_fracciones , Cantidad = varDetalle_Platillos.Cantidad , Cantidad_fraccion = varDetalle_Platillos.Cantidad_fraccion , Unidad = varDetalle_Platillos.Unidad , Ingrediente = varDetalle_Platillos.Ingrediente , Caracteristica = varDetalle_Platillos.Caracteristica , Unidad_SMAE = varDetalle_Platillos.Unidad_SMAE , Equivalente_Unidad_SMAE = varDetalle_Platillos.Equivalente_Unidad_SMAE , Porciones = varDetalle_Platillos.Porciones , Detalle = varDetalle_Platillos.Detalle , Detalle_Super = varDetalle_Platillos.Detalle_Super }; result = !IsNew? _IDetalle_PlatillosApiConsumer.Update(Detalle_PlatillosInfo, null, null).Resource.ToString() : _IDetalle_PlatillosApiConsumer.Insert(Detalle_PlatillosInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public HttpResponseMessage Put_Datos_Generales(Detalle_Platillos varDetalle_Platillos_Datos_Generales) { var data = "-1"; try { data = Convert.ToString(this.service.Update_Datos_Generales(varDetalle_Platillos_Datos_Generales)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varDetalle_Platillos_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdDetalle_Platillos", new JavaScriptSerializer().Serialize(varDetalle_Platillos_Datos_Generales), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varDetalle_Platillos_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdDetalle_Platillos", new JavaScriptSerializer().Serialize(varDetalle_Platillos_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 Detalle_PlatillosGenerateID() { Detalle_Platillos varDetalle_Platillos = new Detalle_Platillos(); var data = "-1"; try { data = Convert.ToString(this.service.Insert(varDetalle_Platillos)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_Detalle_PlatillosGenerateID", new JavaScriptSerializer().Serialize(varDetalle_Platillos), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_Detalle_PlatillosGenerateID", new JavaScriptSerializer().Serialize(varDetalle_Platillos), 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_Platillos entity = this.service.ListaSelAll(1, 1, "Detalle_Platillos.Folio='" + id.ToString() + "'", "").Detalle_Platilloss.First(); Detalle_Platillos result = new Detalle_Platillos(); result.Folio = entity.Folio; result.Lleva_fracciones = entity.Lleva_fracciones; result.Cantidad = entity.Cantidad; result.Cantidad_fraccion = entity.Cantidad_fraccion; result.Cantidad_fraccion_Cantidad_fraccion_platillos = entity.Cantidad_fraccion_Cantidad_fraccion_platillos; result.Unidad = entity.Unidad; result.Ingrediente = entity.Ingrediente; result.Ingrediente_Ingredientes = entity.Ingrediente_Ingredientes; result.Caracteristica = entity.Caracteristica; result.Unidad_SMAE = entity.Unidad_SMAE; result.Equivalente_Unidad_SMAE = entity.Equivalente_Unidad_SMAE; result.Porciones = entity.Porciones; result.Detalle = entity.Detalle; result.Detalle_Super = entity.Detalle_Super; return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter)); }
public ActionResult Delete(int id) { try { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_PlatillosApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_Platillos varDetalle_Platillos = null; if (id.ToString() != "0") { string where = ""; } var result = _IDetalle_PlatillosApiConsumer.Delete(id, null, null).Resource; return(Json(result, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }