public ActionResult Post(bool IsNew, estatus_mpiModel varestatus_mpi) { try { //if (ModelState.IsValid) //{ if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _Iestatus_mpiApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var estatus_mpiInfo = new estatus_mpi { clave = varestatus_mpi.clave , descripcion = varestatus_mpi.descripcion }; result = !IsNew? _Iestatus_mpiApiConsumer.Update(estatus_mpiInfo, null, null).Resource.ToString() : _Iestatus_mpiApiConsumer.Insert(estatus_mpiInfo, null, null).Resource.ToString(); Session["KeyValueInserted"] = result; return(Json(result, JsonRequestBehavior.AllowGet)); //} //return Json(false, JsonRequestBehavior.AllowGet); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult Addestatus_mpi(int rowIndex = 0, int functionMode = 0, string 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, 45466); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _Iestatus_mpiApiConsumer.SetAuthHeader(_tokenManager.Token); estatus_mpiModel varestatus_mpi = new estatus_mpiModel(); if (id.ToString() != "0") { var estatus_mpisData = _Iestatus_mpiApiConsumer.ListaSelAll(0, 1000, "estatus_mpi.clave=" + id, "").Resource.estatus_mpis; if (estatus_mpisData != null && estatus_mpisData.Count > 0) { var estatus_mpiData = estatus_mpisData.First(); varestatus_mpi = new estatus_mpiModel { clave = estatus_mpiData.clave , descripcion = estatus_mpiData.descripcion }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } return(PartialView("Addestatus_mpi", varestatus_mpi)); }
public ActionResult Create(short Id = 0, int consult = 0, int ModuleId = 0) { if (ModuleId == 0) { ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0; } else { Session["CurrentModuleId"] = ModuleId; } var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 45466, ModuleId); if ((!permission.New && Id.ToString() == "0") || (!permission.Edit && Id.ToString() != "0" && (!permission.Consult && consult == 1))) { Response.Redirect("~/"); } ViewBag.Permission = permission; var varestatus_mpi = new estatus_mpiModel(); varestatus_mpi.clave = Id; ViewBag.ObjectId = "45466"; 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"; _tokenManager.GenerateToken(); _ISpartane_FileApiConsumer.SetAuthHeader(_tokenManager.Token); _Iestatus_mpiApiConsumer.SetAuthHeader(_tokenManager.Token); var estatus_mpisData = _Iestatus_mpiApiConsumer.ListaSelAll(0, 1000, "estatus_mpi.clave=" + Id, "").Resource.estatus_mpis; if (estatus_mpisData != null && estatus_mpisData.Count > 0) { var estatus_mpiData = estatus_mpisData.First(); varestatus_mpi = new estatus_mpiModel { clave = estatus_mpiData.clave , descripcion = estatus_mpiData.descripcion }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } var viewInEframe = false; var isPartial = false; var isMR = false; var nameMR = string.Empty; var nameAttribute = string.Empty; if (Request.QueryString["isPartial"] != null) { isPartial = Convert.ToBoolean(Request.QueryString["isPartial"]); } if (Request.QueryString["isMR"] != null) { isMR = Convert.ToBoolean(Request.QueryString["isMR"]); } if (Request.QueryString["nameMR"] != null) { nameMR = Request.QueryString["nameMR"].ToString(); } if (Request.QueryString["nameAttribute"] != null) { nameAttribute = Request.QueryString["nameAttribute"].ToString(); } if (Request.QueryString["viewInEframe"] != null) { viewInEframe = Convert.ToBoolean(Request.QueryString["viewInEframe"]); } ViewBag.isPartial = isPartial; ViewBag.isMR = isMR; ViewBag.nameMR = nameMR; ViewBag.nameAttribute = nameAttribute; ViewBag.viewInEframe = viewInEframe; return(View(varestatus_mpi)); }