public ActionResult AddDetalle_Aseguramiento_Otros(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, 45531); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IDetalle_Aseguramiento_OtrosApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_Aseguramiento_OtrosModel varDetalle_Aseguramiento_Otros = new Detalle_Aseguramiento_OtrosModel(); if (id.ToString() != "0") { var Detalle_Aseguramiento_OtrossData = _IDetalle_Aseguramiento_OtrosApiConsumer.ListaSelAll(0, 1000, "Detalle_Aseguramiento_Otros.Clave=" + id, "").Resource.Detalle_Aseguramiento_Otross; if (Detalle_Aseguramiento_OtrossData != null && Detalle_Aseguramiento_OtrossData.Count > 0) { var Detalle_Aseguramiento_OtrosData = Detalle_Aseguramiento_OtrossData.First(); varDetalle_Aseguramiento_Otros = new Detalle_Aseguramiento_OtrosModel { Clave = Detalle_Aseguramiento_OtrosData.Clave , Motivo_de_Registro = Detalle_Aseguramiento_OtrosData.Motivo_de_Registro , Motivo_de_RegistroDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_OtrosData.Motivo_de_Registro), "Motivo_de_Registro") ?? (string)Detalle_Aseguramiento_OtrosData.Motivo_de_Registro_Motivo_de_Registro.Descripcion , Tipo = Detalle_Aseguramiento_OtrosData.Tipo , Unidad_de_medida = Detalle_Aseguramiento_OtrosData.Unidad_de_medida , Cantidad = Detalle_Aseguramiento_OtrosData.Cantidad , Descripcion = Detalle_Aseguramiento_OtrosData.Descripcion }; } } 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(); } return(PartialView("AddDetalle_Aseguramiento_Otros", varDetalle_Aseguramiento_Otros)); }
public ActionResult Post(bool IsNew, Detalle_Aseguramiento_OtrosModel varDetalle_Aseguramiento_Otros) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Aseguramiento_OtrosApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_Aseguramiento_OtrosInfo = new Detalle_Aseguramiento_Otros { Clave = varDetalle_Aseguramiento_Otros.Clave , Motivo_de_Registro = varDetalle_Aseguramiento_Otros.Motivo_de_Registro , Tipo = varDetalle_Aseguramiento_Otros.Tipo , Unidad_de_medida = varDetalle_Aseguramiento_Otros.Unidad_de_medida , Cantidad = varDetalle_Aseguramiento_Otros.Cantidad , Descripcion = varDetalle_Aseguramiento_Otros.Descripcion }; result = !IsNew? _IDetalle_Aseguramiento_OtrosApiConsumer.Update(Detalle_Aseguramiento_OtrosInfo, null, null).Resource.ToString() : _IDetalle_Aseguramiento_OtrosApiConsumer.Insert(Detalle_Aseguramiento_OtrosInfo, 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, 45531); ViewBag.Permission = permission; var varDetalle_Aseguramiento_Otros = new Detalle_Aseguramiento_OtrosModel(); ViewBag.ObjectId = "45531"; 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_OtrosApiConsumer.SetAuthHeader(_tokenManager.Token); var Detalle_Aseguramiento_OtrosData = _IDetalle_Aseguramiento_OtrosApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Aseguramiento_Otross[0]; if (Detalle_Aseguramiento_OtrosData == null) { return(HttpNotFound()); } varDetalle_Aseguramiento_Otros = new Detalle_Aseguramiento_OtrosModel { Clave = (int)Detalle_Aseguramiento_OtrosData.Clave , Motivo_de_Registro = Detalle_Aseguramiento_OtrosData.Motivo_de_Registro , Motivo_de_RegistroDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_OtrosData.Motivo_de_Registro), "Motivo_de_Registro") ?? (string)Detalle_Aseguramiento_OtrosData.Motivo_de_Registro_Motivo_de_Registro.Descripcion , Tipo = Detalle_Aseguramiento_OtrosData.Tipo , Unidad_de_medida = Detalle_Aseguramiento_OtrosData.Unidad_de_medida , Cantidad = Detalle_Aseguramiento_OtrosData.Cantidad , Descripcion = Detalle_Aseguramiento_OtrosData.Descripcion }; } 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(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varDetalle_Aseguramiento_Otros)); }