public ActionResult Post(bool IsNew, Detalle_Aseguramiento_DocumentosModel varDetalle_Aseguramiento_Documentos) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Aseguramiento_DocumentosApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_Aseguramiento_DocumentosInfo = new Detalle_Aseguramiento_Documentos { Clave = varDetalle_Aseguramiento_Documentos.Clave , Motivo_de_Registro = varDetalle_Aseguramiento_Documentos.Motivo_de_Registro , Tipo = varDetalle_Aseguramiento_Documentos.Tipo , Cantidad = varDetalle_Aseguramiento_Documentos.Cantidad , Observaciones = varDetalle_Aseguramiento_Documentos.Observaciones , Descipcion_de_Documento = varDetalle_Aseguramiento_Documentos.Descipcion_de_Documento }; result = !IsNew? _IDetalle_Aseguramiento_DocumentosApiConsumer.Update(Detalle_Aseguramiento_DocumentosInfo, null, null).Resource.ToString() : _IDetalle_Aseguramiento_DocumentosApiConsumer.Insert(Detalle_Aseguramiento_DocumentosInfo, 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, 45538); ViewBag.Permission = permission; var varDetalle_Aseguramiento_Documentos = new Detalle_Aseguramiento_DocumentosModel(); ViewBag.ObjectId = "45538"; 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_Aseguramiento_DocumentosApiConsumer.SetAuthHeader(_tokenManager.Token); var Detalle_Aseguramiento_DocumentosData = _IDetalle_Aseguramiento_DocumentosApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Aseguramiento_Documentoss[0]; if (Detalle_Aseguramiento_DocumentosData == null) { return(HttpNotFound()); } varDetalle_Aseguramiento_Documentos = new Detalle_Aseguramiento_DocumentosModel { Clave = (int)Detalle_Aseguramiento_DocumentosData.Clave , Motivo_de_Registro = Detalle_Aseguramiento_DocumentosData.Motivo_de_Registro , Motivo_de_RegistroDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_DocumentosData.Motivo_de_Registro), "Motivo_de_Registro") ?? (string)Detalle_Aseguramiento_DocumentosData.Motivo_de_Registro_Motivo_de_Registro.Descripcion , Tipo = Detalle_Aseguramiento_DocumentosData.Tipo , TipoDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_DocumentosData.Tipo), "Tipo_de_Documentos") ?? (string)Detalle_Aseguramiento_DocumentosData.Tipo_Tipo_de_Documentos.Descripcion , Cantidad = Detalle_Aseguramiento_DocumentosData.Cantidad , Observaciones = Detalle_Aseguramiento_DocumentosData.Observaciones , Descipcion_de_Documento = Detalle_Aseguramiento_DocumentosData.Descipcion_de_Documento }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IMotivo_de_RegistroApiConsumer.SetAuthHeader(_tokenManager.Token); var Motivo_de_Registros_Motivo_de_Registro = _IMotivo_de_RegistroApiConsumer.SelAll(true); if (Motivo_de_Registros_Motivo_de_Registro != null && Motivo_de_Registros_Motivo_de_Registro.Resource != null) { ViewBag.Motivo_de_Registros_Motivo_de_Registro = Motivo_de_Registros_Motivo_de_Registro.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Motivo_de_Registro", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _ITipo_de_DocumentosApiConsumer.SetAuthHeader(_tokenManager.Token); var Tipo_de_Documentoss_Tipo = _ITipo_de_DocumentosApiConsumer.SelAll(true); if (Tipo_de_Documentoss_Tipo != null && Tipo_de_Documentoss_Tipo.Resource != null) { ViewBag.Tipo_de_Documentoss_Tipo = Tipo_de_Documentoss_Tipo.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tipo_de_Documentos", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varDetalle_Aseguramiento_Documentos)); }
public ActionResult AddDetalle_Aseguramiento_Documentos(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, 45538); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IDetalle_Aseguramiento_DocumentosApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_Aseguramiento_DocumentosModel varDetalle_Aseguramiento_Documentos = new Detalle_Aseguramiento_DocumentosModel(); if (id.ToString() != "0") { var Detalle_Aseguramiento_DocumentossData = _IDetalle_Aseguramiento_DocumentosApiConsumer.ListaSelAll(0, 1000, "Detalle_Aseguramiento_Documentos.Clave=" + id, "").Resource.Detalle_Aseguramiento_Documentoss; if (Detalle_Aseguramiento_DocumentossData != null && Detalle_Aseguramiento_DocumentossData.Count > 0) { var Detalle_Aseguramiento_DocumentosData = Detalle_Aseguramiento_DocumentossData.First(); varDetalle_Aseguramiento_Documentos = new Detalle_Aseguramiento_DocumentosModel { Clave = Detalle_Aseguramiento_DocumentosData.Clave , Motivo_de_Registro = Detalle_Aseguramiento_DocumentosData.Motivo_de_Registro , Motivo_de_RegistroDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_DocumentosData.Motivo_de_Registro), "Motivo_de_Registro") ?? (string)Detalle_Aseguramiento_DocumentosData.Motivo_de_Registro_Motivo_de_Registro.Descripcion , Tipo = Detalle_Aseguramiento_DocumentosData.Tipo , TipoDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_DocumentosData.Tipo), "Tipo_de_Documentos") ?? (string)Detalle_Aseguramiento_DocumentosData.Tipo_Tipo_de_Documentos.Descripcion , Cantidad = Detalle_Aseguramiento_DocumentosData.Cantidad , Observaciones = Detalle_Aseguramiento_DocumentosData.Observaciones , Descipcion_de_Documento = Detalle_Aseguramiento_DocumentosData.Descipcion_de_Documento }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IMotivo_de_RegistroApiConsumer.SetAuthHeader(_tokenManager.Token); var Motivo_de_Registros_Motivo_de_Registro = _IMotivo_de_RegistroApiConsumer.SelAll(true); if (Motivo_de_Registros_Motivo_de_Registro != null && Motivo_de_Registros_Motivo_de_Registro.Resource != null) { ViewBag.Motivo_de_Registros_Motivo_de_Registro = Motivo_de_Registros_Motivo_de_Registro.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Motivo_de_Registro", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _ITipo_de_DocumentosApiConsumer.SetAuthHeader(_tokenManager.Token); var Tipo_de_Documentoss_Tipo = _ITipo_de_DocumentosApiConsumer.SelAll(true); if (Tipo_de_Documentoss_Tipo != null && Tipo_de_Documentoss_Tipo.Resource != null) { ViewBag.Tipo_de_Documentoss_Tipo = Tipo_de_Documentoss_Tipo.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tipo_de_Documentos", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } return(PartialView("AddDetalle_Aseguramiento_Documentos", varDetalle_Aseguramiento_Documentos)); }