public ActionResult AddDetalle_Planes_de_Rutinas(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, 44571); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IDetalle_Planes_de_RutinasApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_Planes_de_RutinasModel varDetalle_Planes_de_Rutinas = new Detalle_Planes_de_RutinasModel(); if (id.ToString() != "0") { var Detalle_Planes_de_RutinassData = _IDetalle_Planes_de_RutinasApiConsumer.ListaSelAll(0, 1000, "Detalle_Planes_de_Rutinas.Folio=" + id, "").Resource.Detalle_Planes_de_Rutinass; if (Detalle_Planes_de_RutinassData != null && Detalle_Planes_de_RutinassData.Count > 0) { var Detalle_Planes_de_RutinasData = Detalle_Planes_de_RutinassData.First(); varDetalle_Planes_de_Rutinas = new Detalle_Planes_de_RutinasModel { Folio = Detalle_Planes_de_RutinasData.Folio , Numero_de_Dia = Detalle_Planes_de_RutinasData.Numero_de_Dia , Numero_de_DiaDia = CultureHelper.GetTraduction(Convert.ToString(Detalle_Planes_de_RutinasData.Numero_de_Dia), "Dias_de_la_semana") ?? (string)Detalle_Planes_de_RutinasData.Numero_de_Dia_Dias_de_la_semana.Dia , Fecha = (Detalle_Planes_de_RutinasData.Fecha == null ? string.Empty : Convert.ToDateTime(Detalle_Planes_de_RutinasData.Fecha).ToString(ConfigurationProperty.DateFormat)) , Realizado = Detalle_Planes_de_RutinasData.Realizado.GetValueOrDefault() }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _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(); } return(PartialView("AddDetalle_Planes_de_Rutinas", varDetalle_Planes_de_Rutinas)); }
public ActionResult Post(bool IsNew, Detalle_Planes_de_RutinasModel varDetalle_Planes_de_Rutinas) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Planes_de_RutinasApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_Planes_de_RutinasInfo = new Detalle_Planes_de_Rutinas { Folio = varDetalle_Planes_de_Rutinas.Folio , Numero_de_Dia = varDetalle_Planes_de_Rutinas.Numero_de_Dia , Fecha = (!String.IsNullOrEmpty(varDetalle_Planes_de_Rutinas.Fecha)) ? DateTime.ParseExact(varDetalle_Planes_de_Rutinas.Fecha, ConfigurationProperty.DateFormat, CultureInfo.InvariantCulture as IFormatProvider) : (DateTime?)null , Orden_de_Realizacion = varDetalle_Planes_de_Rutinas.Orden_de_Realizacion , Secuencia_del_Ejercicio = varDetalle_Planes_de_Rutinas.Secuencia_del_Ejercicio , Enfoque_del_Ejercicio = varDetalle_Planes_de_Rutinas.Enfoque_del_Ejercicio , Ejercicio = varDetalle_Planes_de_Rutinas.Ejercicio , Realizado = varDetalle_Planes_de_Rutinas.Realizado }; result = !IsNew? _IDetalle_Planes_de_RutinasApiConsumer.Update(Detalle_Planes_de_RutinasInfo, null, null).Resource.ToString() : _IDetalle_Planes_de_RutinasApiConsumer.Insert(Detalle_Planes_de_RutinasInfo, 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, 44571); ViewBag.Permission = permission; var varDetalle_Planes_de_Rutinas = new Detalle_Planes_de_RutinasModel(); ViewBag.ObjectId = "44571"; 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_de_RutinasApiConsumer.SetAuthHeader(_tokenManager.Token); var Detalle_Planes_de_RutinasData = _IDetalle_Planes_de_RutinasApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Planes_de_Rutinass[0]; if (Detalle_Planes_de_RutinasData == null) { return(HttpNotFound()); } varDetalle_Planes_de_Rutinas = new Detalle_Planes_de_RutinasModel { Folio = (int)Detalle_Planes_de_RutinasData.Folio , Numero_de_Dia = Detalle_Planes_de_RutinasData.Numero_de_Dia , Numero_de_DiaDia = CultureHelper.GetTraduction(Convert.ToString(Detalle_Planes_de_RutinasData.Numero_de_Dia), "Dias_de_la_semana") ?? (string)Detalle_Planes_de_RutinasData.Numero_de_Dia_Dias_de_la_semana.Dia , Fecha = (Detalle_Planes_de_RutinasData.Fecha == null ? string.Empty : Convert.ToDateTime(Detalle_Planes_de_RutinasData.Fecha).ToString(ConfigurationProperty.DateFormat)) , Orden_de_Realizacion = Detalle_Planes_de_RutinasData.Orden_de_Realizacion , Secuencia_del_Ejercicio = Detalle_Planes_de_RutinasData.Secuencia_del_Ejercicio , Enfoque_del_Ejercicio = Detalle_Planes_de_RutinasData.Enfoque_del_Ejercicio , Enfoque_del_EjercicioDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Planes_de_RutinasData.Enfoque_del_Ejercicio), "Tipo_de_Enfoque_del_Ejercicio") ?? (string)Detalle_Planes_de_RutinasData.Enfoque_del_Ejercicio_Tipo_de_Enfoque_del_Ejercicio.Descripcion , Ejercicio = Detalle_Planes_de_RutinasData.Ejercicio , EjercicioNombre_del_Ejercicio = CultureHelper.GetTraduction(Convert.ToString(Detalle_Planes_de_RutinasData.Ejercicio), "Ejercicios") ?? (string)Detalle_Planes_de_RutinasData.Ejercicio_Ejercicios.Nombre_del_Ejercicio , Realizado = Detalle_Planes_de_RutinasData.Realizado.GetValueOrDefault() }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _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(); } _ITipo_de_Enfoque_del_EjercicioApiConsumer.SetAuthHeader(_tokenManager.Token); var Tipo_de_Enfoque_del_Ejercicios_Enfoque_del_Ejercicio = _ITipo_de_Enfoque_del_EjercicioApiConsumer.SelAll(true); if (Tipo_de_Enfoque_del_Ejercicios_Enfoque_del_Ejercicio != null && Tipo_de_Enfoque_del_Ejercicios_Enfoque_del_Ejercicio.Resource != null) { ViewBag.Tipo_de_Enfoque_del_Ejercicios_Enfoque_del_Ejercicio = Tipo_de_Enfoque_del_Ejercicios_Enfoque_del_Ejercicio.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Tipo_de_Enfoque_del_Ejercicio", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Folio) }).ToList(); } _IEjerciciosApiConsumer.SetAuthHeader(_tokenManager.Token); var Ejercicioss_Ejercicio = _IEjerciciosApiConsumer.SelAll(true); if (Ejercicioss_Ejercicio != null && Ejercicioss_Ejercicio.Resource != null) { ViewBag.Ejercicioss_Ejercicio = Ejercicioss_Ejercicio.Resource.Where(m => m.Nombre_del_Ejercicio != null).OrderBy(m => m.Nombre_del_Ejercicio).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Ejercicios", "Nombre_del_Ejercicio") ?? m.Nombre_del_Ejercicio.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varDetalle_Planes_de_Rutinas)); }