public ActionResult Post(bool IsNew, Detalle_Planes_AlimenticiosModel varDetalle_Planes_Alimenticios) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Planes_AlimenticiosApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_Planes_AlimenticiosInfo = new Detalle_Planes_Alimenticios { Folio = varDetalle_Planes_Alimenticios.Folio , Tiempo_de_Comida = varDetalle_Planes_Alimenticios.Tiempo_de_Comida , Numero_de_Dia = varDetalle_Planes_Alimenticios.Numero_de_Dia , Fecha = (!String.IsNullOrEmpty(varDetalle_Planes_Alimenticios.Fecha)) ? DateTime.ParseExact(varDetalle_Planes_Alimenticios.Fecha, ConfigurationProperty.DateFormat, CultureInfo.InvariantCulture as IFormatProvider) : (DateTime?)null , Platillo = varDetalle_Planes_Alimenticios.Platillo , Modificado = varDetalle_Planes_Alimenticios.Modificado }; result = !IsNew? _IDetalle_Planes_AlimenticiosApiConsumer.Update(Detalle_Planes_AlimenticiosInfo, null, null).Resource.ToString() : _IDetalle_Planes_AlimenticiosApiConsumer.Insert(Detalle_Planes_AlimenticiosInfo, 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, 44569); ViewBag.Permission = permission; var varDetalle_Planes_Alimenticios = new Detalle_Planes_AlimenticiosModel(); ViewBag.ObjectId = "44569"; 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)); } _IDetalle_Planes_AlimenticiosApiConsumer.SetAuthHeader(_tokenManager.Token); var Detalle_Planes_AlimenticiosData = _IDetalle_Planes_AlimenticiosApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Planes_Alimenticioss[0]; if (Detalle_Planes_AlimenticiosData == null) { return(HttpNotFound()); } varDetalle_Planes_Alimenticios = new Detalle_Planes_AlimenticiosModel { Folio = (int)Detalle_Planes_AlimenticiosData.Folio , Tiempo_de_Comida = Detalle_Planes_AlimenticiosData.Tiempo_de_Comida , Tiempo_de_ComidaComida = CultureHelper.GetTraduction(Convert.ToString(Detalle_Planes_AlimenticiosData.Tiempo_de_Comida), "Tiempos_de_Comida") ?? (string)Detalle_Planes_AlimenticiosData.Tiempo_de_Comida_Tiempos_de_Comida.Comida , Numero_de_Dia = Detalle_Planes_AlimenticiosData.Numero_de_Dia , Numero_de_DiaDia = CultureHelper.GetTraduction(Convert.ToString(Detalle_Planes_AlimenticiosData.Numero_de_Dia), "Dias_de_la_semana") ?? (string)Detalle_Planes_AlimenticiosData.Numero_de_Dia_Dias_de_la_semana.Dia , Fecha = (Detalle_Planes_AlimenticiosData.Fecha == null ? string.Empty : Convert.ToDateTime(Detalle_Planes_AlimenticiosData.Fecha).ToString(ConfigurationProperty.DateFormat)) , Platillo = Detalle_Planes_AlimenticiosData.Platillo , PlatilloNombre_de_Platillo = CultureHelper.GetTraduction(Convert.ToString(Detalle_Planes_AlimenticiosData.Platillo), "Platillos") ?? (string)Detalle_Planes_AlimenticiosData.Platillo_Platillos.Nombre_de_Platillo , Modificado = Detalle_Planes_AlimenticiosData.Modificado.GetValueOrDefault() }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ITiempos_de_ComidaApiConsumer.SetAuthHeader(_tokenManager.Token); var Tiempos_de_Comidas_Tiempo_de_Comida = _ITiempos_de_ComidaApiConsumer.SelAll(true); if (Tiempos_de_Comidas_Tiempo_de_Comida != null && Tiempos_de_Comidas_Tiempo_de_Comida.Resource != null) { ViewBag.Tiempos_de_Comidas_Tiempo_de_Comida = Tiempos_de_Comidas_Tiempo_de_Comida.Resource.Where(m => m.Comida != null).OrderBy(m => m.Comida).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tiempos_de_Comida", "Comida") ?? m.Comida.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _IDias_de_la_semanaApiConsumer.SetAuthHeader(_tokenManager.Token); var Dias_de_la_semanas_Numero_de_Dia = _IDias_de_la_semanaApiConsumer.SelAll(true); if (Dias_de_la_semanas_Numero_de_Dia != null && Dias_de_la_semanas_Numero_de_Dia.Resource != null) { ViewBag.Dias_de_la_semanas_Numero_de_Dia = Dias_de_la_semanas_Numero_de_Dia.Resource.Where(m => m.Dia != null).OrderBy(m => m.Dia).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Dias_de_la_semana", "Dia") ?? m.Dia.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _IPlatillosApiConsumer.SetAuthHeader(_tokenManager.Token); var Platilloss_Platillo = _IPlatillosApiConsumer.SelAll(true); if (Platilloss_Platillo != null && Platilloss_Platillo.Resource != null) { ViewBag.Platilloss_Platillo = Platilloss_Platillo.Resource.Where(m => m.Nombre_de_Platillo != null).OrderBy(m => m.Nombre_de_Platillo).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Platillos", "Nombre_de_Platillo") ?? m.Nombre_de_Platillo.ToString(), Value = Convert.ToString(m.Folio) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varDetalle_Planes_Alimenticios)); }
public ActionResult AddDetalle_Planes_Alimenticios(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, 44569); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IDetalle_Planes_AlimenticiosApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_Planes_AlimenticiosModel varDetalle_Planes_Alimenticios = new Detalle_Planes_AlimenticiosModel(); if (id.ToString() != "0") { var Detalle_Planes_AlimenticiossData = _IDetalle_Planes_AlimenticiosApiConsumer.ListaSelAll(0, 1000, "Detalle_Planes_Alimenticios.Folio=" + id, "").Resource.Detalle_Planes_Alimenticioss; if (Detalle_Planes_AlimenticiossData != null && Detalle_Planes_AlimenticiossData.Count > 0) { var Detalle_Planes_AlimenticiosData = Detalle_Planes_AlimenticiossData.First(); varDetalle_Planes_Alimenticios = new Detalle_Planes_AlimenticiosModel { Folio = Detalle_Planes_AlimenticiosData.Folio , Tiempo_de_Comida = Detalle_Planes_AlimenticiosData.Tiempo_de_Comida , Tiempo_de_ComidaComida = CultureHelper.GetTraduction(Convert.ToString(Detalle_Planes_AlimenticiosData.Tiempo_de_Comida), "Tiempos_de_Comida") ?? (string)Detalle_Planes_AlimenticiosData.Tiempo_de_Comida_Tiempos_de_Comida.Comida , Numero_de_Dia = Detalle_Planes_AlimenticiosData.Numero_de_Dia , Numero_de_DiaDia = CultureHelper.GetTraduction(Convert.ToString(Detalle_Planes_AlimenticiosData.Numero_de_Dia), "Dias_de_la_semana") ?? (string)Detalle_Planes_AlimenticiosData.Numero_de_Dia_Dias_de_la_semana.Dia , Fecha = (Detalle_Planes_AlimenticiosData.Fecha == null ? string.Empty : Convert.ToDateTime(Detalle_Planes_AlimenticiosData.Fecha).ToString(ConfigurationProperty.DateFormat)) , Platillo = Detalle_Planes_AlimenticiosData.Platillo , PlatilloNombre_de_Platillo = CultureHelper.GetTraduction(Convert.ToString(Detalle_Planes_AlimenticiosData.Platillo), "Platillos") ?? (string)Detalle_Planes_AlimenticiosData.Platillo_Platillos.Nombre_de_Platillo , Modificado = Detalle_Planes_AlimenticiosData.Modificado.GetValueOrDefault() }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ITiempos_de_ComidaApiConsumer.SetAuthHeader(_tokenManager.Token); var Tiempos_de_Comidas_Tiempo_de_Comida = _ITiempos_de_ComidaApiConsumer.SelAll(true); if (Tiempos_de_Comidas_Tiempo_de_Comida != null && Tiempos_de_Comidas_Tiempo_de_Comida.Resource != null) { ViewBag.Tiempos_de_Comidas_Tiempo_de_Comida = Tiempos_de_Comidas_Tiempo_de_Comida.Resource.Where(m => m.Comida != null).OrderBy(m => m.Comida).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tiempos_de_Comida", "Comida") ?? m.Comida.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _IDias_de_la_semanaApiConsumer.SetAuthHeader(_tokenManager.Token); var Dias_de_la_semanas_Numero_de_Dia = _IDias_de_la_semanaApiConsumer.SelAll(true); if (Dias_de_la_semanas_Numero_de_Dia != null && Dias_de_la_semanas_Numero_de_Dia.Resource != null) { ViewBag.Dias_de_la_semanas_Numero_de_Dia = Dias_de_la_semanas_Numero_de_Dia.Resource.Where(m => m.Dia != null).OrderBy(m => m.Dia).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Dias_de_la_semana", "Dia") ?? m.Dia.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _IPlatillosApiConsumer.SetAuthHeader(_tokenManager.Token); var Platilloss_Platillo = _IPlatillosApiConsumer.SelAll(true); if (Platilloss_Platillo != null && Platilloss_Platillo.Resource != null) { ViewBag.Platilloss_Platillo = Platilloss_Platillo.Resource.Where(m => m.Nombre_de_Platillo != null).OrderBy(m => m.Nombre_de_Platillo).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Platillos", "Nombre_de_Platillo") ?? m.Nombre_de_Platillo.ToString(), Value = Convert.ToString(m.Folio) }).ToList(); } return(PartialView("AddDetalle_Planes_Alimenticios", varDetalle_Planes_Alimenticios)); }