public ActionResult Post(bool IsNew, MR_Detalle_PlatilloModel varMR_Detalle_Platillo) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IMR_Detalle_PlatilloApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var MR_Detalle_PlatilloInfo = new MR_Detalle_Platillo { Folio = varMR_Detalle_Platillo.Folio , Ingrediente = varMR_Detalle_Platillo.Ingrediente , Cantidad = varMR_Detalle_Platillo.Cantidad , Cantidad_en_Fraccion = varMR_Detalle_Platillo.Cantidad_en_Fraccion , Unidad = varMR_Detalle_Platillo.Unidad , Cantidad_a_mostrar = varMR_Detalle_Platillo.Cantidad_a_mostrar , Ingrediente_a_mostrar = varMR_Detalle_Platillo.Ingrediente_a_mostrar }; result = !IsNew? _IMR_Detalle_PlatilloApiConsumer.Update(MR_Detalle_PlatilloInfo, null, null).Resource.ToString() : _IMR_Detalle_PlatilloApiConsumer.Insert(MR_Detalle_PlatilloInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult Create(int Id = 0, int consult = 0) { int ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0; var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 44723); ViewBag.Permission = permission; var varMR_Detalle_Platillo = new MR_Detalle_PlatilloModel(); ViewBag.ObjectId = "44723"; ViewBag.Operation = "New"; ViewBag.IsNew = true; if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0")) { ViewBag.IsNew = false; ViewBag.Operation = "Update"; if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IMR_Detalle_PlatilloApiConsumer.SetAuthHeader(_tokenManager.Token); var MR_Detalle_PlatilloData = _IMR_Detalle_PlatilloApiConsumer.GetByKeyComplete(Id).Resource.MR_Detalle_Platillos[0]; if (MR_Detalle_PlatilloData == null) { return(HttpNotFound()); } varMR_Detalle_Platillo = new MR_Detalle_PlatilloModel { Folio = (int)MR_Detalle_PlatilloData.Folio , Ingrediente = MR_Detalle_PlatilloData.Ingrediente , IngredienteNombre_Ingrediente = CultureHelper.GetTraduction(Convert.ToString(MR_Detalle_PlatilloData.Ingrediente), "Ingredientes") ?? (string)MR_Detalle_PlatilloData.Ingrediente_Ingredientes.Nombre_Ingrediente , Cantidad = MR_Detalle_PlatilloData.Cantidad , Cantidad_en_Fraccion = MR_Detalle_PlatilloData.Cantidad_en_Fraccion , Unidad = MR_Detalle_PlatilloData.Unidad , UnidadUnidad = CultureHelper.GetTraduction(Convert.ToString(MR_Detalle_PlatilloData.Unidad), "Unidades_de_Medida") ?? (string)MR_Detalle_PlatilloData.Unidad_Unidades_de_Medida.Unidad , Cantidad_a_mostrar = MR_Detalle_PlatilloData.Cantidad_a_mostrar , Ingrediente_a_mostrar = MR_Detalle_PlatilloData.Ingrediente_a_mostrar }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IIngredientesApiConsumer.SetAuthHeader(_tokenManager.Token); var Ingredientess_Ingrediente = _IIngredientesApiConsumer.SelAll(true); if (Ingredientess_Ingrediente != null && Ingredientess_Ingrediente.Resource != null) { ViewBag.Ingredientess_Ingrediente = Ingredientess_Ingrediente.Resource.Where(m => m.Nombre_Ingrediente != null).OrderBy(m => m.Nombre_Ingrediente).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Ingredientes", "Nombre_Ingrediente") ?? m.Nombre_Ingrediente.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _IUnidades_de_MedidaApiConsumer.SetAuthHeader(_tokenManager.Token); var Unidades_de_Medidas_Unidad = _IUnidades_de_MedidaApiConsumer.SelAll(true); if (Unidades_de_Medidas_Unidad != null && Unidades_de_Medidas_Unidad.Resource != null) { ViewBag.Unidades_de_Medidas_Unidad = Unidades_de_Medidas_Unidad.Resource.Where(m => m.Unidad != null).OrderBy(m => m.Unidad).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Unidades_de_Medida", "Unidad") ?? m.Unidad.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varMR_Detalle_Platillo)); }
public ActionResult AddMR_Detalle_Platillo(int rowIndex = 0, int functionMode = 0, int id = 0) { int ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0; ViewBag.currentRowIndex = rowIndex; ViewBag.functionMode = functionMode; ViewBag.Consult = false; var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 44723); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IMR_Detalle_PlatilloApiConsumer.SetAuthHeader(_tokenManager.Token); MR_Detalle_PlatilloModel varMR_Detalle_Platillo = new MR_Detalle_PlatilloModel(); if (id.ToString() != "0") { var MR_Detalle_PlatillosData = _IMR_Detalle_PlatilloApiConsumer.ListaSelAll(0, 1000, "MR_Detalle_Platillo.Folio=" + id, "").Resource.MR_Detalle_Platillos; if (MR_Detalle_PlatillosData != null && MR_Detalle_PlatillosData.Count > 0) { var MR_Detalle_PlatilloData = MR_Detalle_PlatillosData.First(); varMR_Detalle_Platillo = new MR_Detalle_PlatilloModel { Folio = MR_Detalle_PlatilloData.Folio , Ingrediente = MR_Detalle_PlatilloData.Ingrediente , IngredienteNombre_Ingrediente = CultureHelper.GetTraduction(Convert.ToString(MR_Detalle_PlatilloData.Ingrediente), "Ingredientes") ?? (string)MR_Detalle_PlatilloData.Ingrediente_Ingredientes.Nombre_Ingrediente , Cantidad = MR_Detalle_PlatilloData.Cantidad , Cantidad_en_Fraccion = MR_Detalle_PlatilloData.Cantidad_en_Fraccion , Unidad = MR_Detalle_PlatilloData.Unidad , UnidadUnidad = CultureHelper.GetTraduction(Convert.ToString(MR_Detalle_PlatilloData.Unidad), "Unidades_de_Medida") ?? (string)MR_Detalle_PlatilloData.Unidad_Unidades_de_Medida.Unidad , Cantidad_a_mostrar = MR_Detalle_PlatilloData.Cantidad_a_mostrar , Ingrediente_a_mostrar = MR_Detalle_PlatilloData.Ingrediente_a_mostrar }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IIngredientesApiConsumer.SetAuthHeader(_tokenManager.Token); var Ingredientess_Ingrediente = _IIngredientesApiConsumer.SelAll(true); if (Ingredientess_Ingrediente != null && Ingredientess_Ingrediente.Resource != null) { ViewBag.Ingredientess_Ingrediente = Ingredientess_Ingrediente.Resource.Where(m => m.Nombre_Ingrediente != null).OrderBy(m => m.Nombre_Ingrediente).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Ingredientes", "Nombre_Ingrediente") ?? m.Nombre_Ingrediente.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _IUnidades_de_MedidaApiConsumer.SetAuthHeader(_tokenManager.Token); var Unidades_de_Medidas_Unidad = _IUnidades_de_MedidaApiConsumer.SelAll(true); if (Unidades_de_Medidas_Unidad != null && Unidades_de_Medidas_Unidad.Resource != null) { ViewBag.Unidades_de_Medidas_Unidad = Unidades_de_Medidas_Unidad.Resource.Where(m => m.Unidad != null).OrderBy(m => m.Unidad).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Unidades_de_Medida", "Unidad") ?? m.Unidad.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } return(PartialView("AddMR_Detalle_Platillo", varMR_Detalle_Platillo)); }