public ActionResult Post(bool IsNew, Otras_Identificaciones_Requerido_MASCModel varOtras_Identificaciones_Requerido_MASC) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IOtras_Identificaciones_Requerido_MASCApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Otras_Identificaciones_Requerido_MASCInfo = new Otras_Identificaciones_Requerido_MASC { Clave = varOtras_Identificaciones_Requerido_MASC.Clave , Tipo_de_Identificacion = varOtras_Identificaciones_Requerido_MASC.Tipo_de_Identificacion , Descripcion = varOtras_Identificaciones_Requerido_MASC.Descripcion }; result = !IsNew? _IOtras_Identificaciones_Requerido_MASCApiConsumer.Update(Otras_Identificaciones_Requerido_MASCInfo, null, null).Resource.ToString() : _IOtras_Identificaciones_Requerido_MASCApiConsumer.Insert(Otras_Identificaciones_Requerido_MASCInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddOtras_Identificaciones_Requerido_MASC(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, 45335); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IOtras_Identificaciones_Requerido_MASCApiConsumer.SetAuthHeader(_tokenManager.Token); Otras_Identificaciones_Requerido_MASCModel varOtras_Identificaciones_Requerido_MASC = new Otras_Identificaciones_Requerido_MASCModel(); if (id.ToString() != "0") { var Otras_Identificaciones_Requerido_MASCsData = _IOtras_Identificaciones_Requerido_MASCApiConsumer.ListaSelAll(0, 1000, "Otras_Identificaciones_Requerido_MASC.Clave=" + id, "").Resource.Otras_Identificaciones_Requerido_MASCs; if (Otras_Identificaciones_Requerido_MASCsData != null && Otras_Identificaciones_Requerido_MASCsData.Count > 0) { var Otras_Identificaciones_Requerido_MASCData = Otras_Identificaciones_Requerido_MASCsData.First(); varOtras_Identificaciones_Requerido_MASC = new Otras_Identificaciones_Requerido_MASCModel { Clave = Otras_Identificaciones_Requerido_MASCData.Clave , Tipo_de_Identificacion = Otras_Identificaciones_Requerido_MASCData.Tipo_de_Identificacion , Tipo_de_IdentificacionNombre = CultureHelper.GetTraduction(Convert.ToString(Otras_Identificaciones_Requerido_MASCData.Tipo_de_Identificacion), "Tipo_de_Identificacion") ?? (string)Otras_Identificaciones_Requerido_MASCData.Tipo_de_Identificacion_Tipo_de_Identificacion.Nombre , Descripcion = Otras_Identificaciones_Requerido_MASCData.Descripcion }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ITipo_de_IdentificacionApiConsumer.SetAuthHeader(_tokenManager.Token); var Tipo_de_Identificacions_Tipo_de_Identificacion = _ITipo_de_IdentificacionApiConsumer.SelAll(true); if (Tipo_de_Identificacions_Tipo_de_Identificacion != null && Tipo_de_Identificacions_Tipo_de_Identificacion.Resource != null) { ViewBag.Tipo_de_Identificacions_Tipo_de_Identificacion = Tipo_de_Identificacions_Tipo_de_Identificacion.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tipo_de_Identificacion", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } return(PartialView("AddOtras_Identificaciones_Requerido_MASC", varOtras_Identificaciones_Requerido_MASC)); }
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, 45335); ViewBag.Permission = permission; var varOtras_Identificaciones_Requerido_MASC = new Otras_Identificaciones_Requerido_MASCModel(); ViewBag.ObjectId = "45335"; 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)); } _IOtras_Identificaciones_Requerido_MASCApiConsumer.SetAuthHeader(_tokenManager.Token); var Otras_Identificaciones_Requerido_MASCData = _IOtras_Identificaciones_Requerido_MASCApiConsumer.GetByKeyComplete(Id).Resource.Otras_Identificaciones_Requerido_MASCs[0]; if (Otras_Identificaciones_Requerido_MASCData == null) { return(HttpNotFound()); } varOtras_Identificaciones_Requerido_MASC = new Otras_Identificaciones_Requerido_MASCModel { Clave = (int)Otras_Identificaciones_Requerido_MASCData.Clave , Tipo_de_Identificacion = Otras_Identificaciones_Requerido_MASCData.Tipo_de_Identificacion , Tipo_de_IdentificacionNombre = CultureHelper.GetTraduction(Convert.ToString(Otras_Identificaciones_Requerido_MASCData.Tipo_de_Identificacion), "Tipo_de_Identificacion") ?? (string)Otras_Identificaciones_Requerido_MASCData.Tipo_de_Identificacion_Tipo_de_Identificacion.Nombre , Descripcion = Otras_Identificaciones_Requerido_MASCData.Descripcion }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ITipo_de_IdentificacionApiConsumer.SetAuthHeader(_tokenManager.Token); var Tipo_de_Identificacions_Tipo_de_Identificacion = _ITipo_de_IdentificacionApiConsumer.SelAll(true); if (Tipo_de_Identificacions_Tipo_de_Identificacion != null && Tipo_de_Identificacions_Tipo_de_Identificacion.Resource != null) { ViewBag.Tipo_de_Identificacions_Tipo_de_Identificacion = Tipo_de_Identificacions_Tipo_de_Identificacion.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tipo_de_Identificacion", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varOtras_Identificaciones_Requerido_MASC)); }