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, 45218); ViewBag.Permission = permission; var varDetalle_de_Retroalimentacion = new Detalle_de_RetroalimentacionModel(); ViewBag.ObjectId = "45218"; 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_de_RetroalimentacionApiConsumer.SetAuthHeader(_tokenManager.Token); var Detalle_de_RetroalimentacionData = _IDetalle_de_RetroalimentacionApiConsumer.GetByKeyComplete(Id).Resource.Detalle_de_Retroalimentacions[0]; if (Detalle_de_RetroalimentacionData == null) { return(HttpNotFound()); } varDetalle_de_Retroalimentacion = new Detalle_de_RetroalimentacionModel { Clave = (int)Detalle_de_RetroalimentacionData.Clave , Usuario_que_Registra = Detalle_de_RetroalimentacionData.Usuario_que_Registra , Fecha_de_Registro = (Detalle_de_RetroalimentacionData.Fecha_de_Registro == null ? string.Empty : Convert.ToDateTime(Detalle_de_RetroalimentacionData.Fecha_de_Registro).ToString(ConfigurationProperty.DateFormat)) , Hora_de_Registro = Detalle_de_RetroalimentacionData.Hora_de_Registro , Retroalimentacion = Detalle_de_RetroalimentacionData.Retroalimentacion }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varDetalle_de_Retroalimentacion)); }
public ActionResult AddDetalle_de_Retroalimentacion(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, 45218); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IDetalle_de_RetroalimentacionApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_de_RetroalimentacionModel varDetalle_de_Retroalimentacion = new Detalle_de_RetroalimentacionModel(); if (id.ToString() != "0") { var Detalle_de_RetroalimentacionsData = _IDetalle_de_RetroalimentacionApiConsumer.ListaSelAll(0, 1000, "Detalle_de_Retroalimentacion.Clave=" + id, "").Resource.Detalle_de_Retroalimentacions; if (Detalle_de_RetroalimentacionsData != null && Detalle_de_RetroalimentacionsData.Count > 0) { var Detalle_de_RetroalimentacionData = Detalle_de_RetroalimentacionsData.First(); varDetalle_de_Retroalimentacion = new Detalle_de_RetroalimentacionModel { Clave = Detalle_de_RetroalimentacionData.Clave , Usuario_que_Registra = Detalle_de_RetroalimentacionData.Usuario_que_Registra , Fecha_de_Registro = (Detalle_de_RetroalimentacionData.Fecha_de_Registro == null ? string.Empty : Convert.ToDateTime(Detalle_de_RetroalimentacionData.Fecha_de_Registro).ToString(ConfigurationProperty.DateFormat)) , Hora_de_Registro = Detalle_de_RetroalimentacionData.Hora_de_Registro , Retroalimentacion = Detalle_de_RetroalimentacionData.Retroalimentacion }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } return(PartialView("AddDetalle_de_Retroalimentacion", varDetalle_de_Retroalimentacion)); }
public ActionResult Post(bool IsNew, Detalle_de_RetroalimentacionModel varDetalle_de_Retroalimentacion) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_de_RetroalimentacionApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_de_RetroalimentacionInfo = new Detalle_de_Retroalimentacion { Clave = varDetalle_de_Retroalimentacion.Clave , Usuario_que_Registra = varDetalle_de_Retroalimentacion.Usuario_que_Registra , Fecha_de_Registro = (!String.IsNullOrEmpty(varDetalle_de_Retroalimentacion.Fecha_de_Registro)) ? DateTime.ParseExact(varDetalle_de_Retroalimentacion.Fecha_de_Registro, ConfigurationProperty.DateFormat, CultureInfo.InvariantCulture as IFormatProvider) : (DateTime?)null , Hora_de_Registro = varDetalle_de_Retroalimentacion.Hora_de_Registro , Retroalimentacion = varDetalle_de_Retroalimentacion.Retroalimentacion }; result = !IsNew? _IDetalle_de_RetroalimentacionApiConsumer.Update(Detalle_de_RetroalimentacionInfo, null, null).Resource.ToString() : _IDetalle_de_RetroalimentacionApiConsumer.Insert(Detalle_de_RetroalimentacionInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }