public ActionResult Post(bool IsNew, Spartan_BR_Type_HistoryModel varSpartan_BR_Type_History) { try { //if (ModelState.IsValid) //{ if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_BR_Type_HistoryApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Spartan_BR_Type_HistoryInfo = new Spartan_BR_Type_History { Key_Type_History = varSpartan_BR_Type_History.Key_Type_History , Description = varSpartan_BR_Type_History.Description }; result = !IsNew? _ISpartan_BR_Type_HistoryApiConsumer.Update(Spartan_BR_Type_HistoryInfo, null, null).Resource.ToString() : _ISpartan_BR_Type_HistoryApiConsumer.Insert(Spartan_BR_Type_HistoryInfo, 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 AddSpartan_BR_Type_History(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, 35399); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _ISpartan_BR_Type_HistoryApiConsumer.SetAuthHeader(_tokenManager.Token); Spartan_BR_Type_HistoryModel varSpartan_BR_Type_History = new Spartan_BR_Type_HistoryModel(); if (id.ToString() != "0") { var Spartan_BR_Type_HistorysData = _ISpartan_BR_Type_HistoryApiConsumer.ListaSelAll(0, 1000, "Key_Type_History=" + id, "").Resource.Spartan_BR_Type_Historys; if (Spartan_BR_Type_HistorysData != null && Spartan_BR_Type_HistorysData.Count > 0) { var Spartan_BR_Type_HistoryData = Spartan_BR_Type_HistorysData.First(); varSpartan_BR_Type_History = new Spartan_BR_Type_HistoryModel { Key_Type_History = Spartan_BR_Type_HistoryData.Key_Type_History , Description = Spartan_BR_Type_HistoryData.Description }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } return(PartialView("AddSpartan_BR_Type_History", varSpartan_BR_Type_History)); }
public ActionResult Create(int 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, 35399, ModuleId); if ((!permission.New && Id.ToString() == "0") || (!permission.Edit && Id.ToString() != "0" && (!permission.Consult && consult == 1))) { Response.Redirect("~/"); } ViewBag.Permission = permission; var varSpartan_BR_Type_History = new Spartan_BR_Type_HistoryModel(); ViewBag.ObjectId = "35399"; 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)); } _ISpartan_BR_Type_HistoryApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_BR_Type_HistoryData = _ISpartan_BR_Type_HistoryApiConsumer.GetByKeyComplete(Id).Resource.Spartan_BR_Type_Historys[0]; if (Spartan_BR_Type_HistoryData == null) { return(HttpNotFound()); } varSpartan_BR_Type_History = new Spartan_BR_Type_HistoryModel { Key_Type_History = (int)Spartan_BR_Type_HistoryData.Key_Type_History , Description = Spartan_BR_Type_HistoryData.Description }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varSpartan_BR_Type_History)); }