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, 45529); ViewBag.Permission = permission; var varDetalle_Aseguramiento_Moneda = new Detalle_Aseguramiento_MonedaModel(); ViewBag.ObjectId = "45529"; 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_MonedaApiConsumer.SetAuthHeader(_tokenManager.Token); var Detalle_Aseguramiento_MonedaData = _IDetalle_Aseguramiento_MonedaApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Aseguramiento_Monedas[0]; if (Detalle_Aseguramiento_MonedaData == null) { return(HttpNotFound()); } varDetalle_Aseguramiento_Moneda = new Detalle_Aseguramiento_MonedaModel { Clave = (int)Detalle_Aseguramiento_MonedaData.Clave , Motivo_de_Registro = Detalle_Aseguramiento_MonedaData.Motivo_de_Registro , Motivo_de_RegistroDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_MonedaData.Motivo_de_Registro), "Motivo_de_Registro") ?? (string)Detalle_Aseguramiento_MonedaData.Motivo_de_Registro_Motivo_de_Registro.Descripcion , Tipo = Detalle_Aseguramiento_MonedaData.Tipo , TipoDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_MonedaData.Tipo), "Tipo_de_Moneda") ?? (string)Detalle_Aseguramiento_MonedaData.Tipo_Tipo_de_Moneda.Descripcion , Cantidad = Detalle_Aseguramiento_MonedaData.Cantidad , Observaciones = Detalle_Aseguramiento_MonedaData.Observaciones , Descripcion = Detalle_Aseguramiento_MonedaData.Descripcion , DescripcionDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_MonedaData.Descripcion), "Tipo_de_Dinero") ?? (string)Detalle_Aseguramiento_MonedaData.Descripcion_Tipo_de_Dinero.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(); } _ITipo_de_MonedaApiConsumer.SetAuthHeader(_tokenManager.Token); var Tipo_de_Monedas_Tipo = _ITipo_de_MonedaApiConsumer.SelAll(true); if (Tipo_de_Monedas_Tipo != null && Tipo_de_Monedas_Tipo.Resource != null) { ViewBag.Tipo_de_Monedas_Tipo = Tipo_de_Monedas_Tipo.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tipo_de_Moneda", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _ITipo_de_DineroApiConsumer.SetAuthHeader(_tokenManager.Token); var Tipo_de_Dineros_Descripcion = _ITipo_de_DineroApiConsumer.SelAll(true); if (Tipo_de_Dineros_Descripcion != null && Tipo_de_Dineros_Descripcion.Resource != null) { ViewBag.Tipo_de_Dineros_Descripcion = Tipo_de_Dineros_Descripcion.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tipo_de_Dinero", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varDetalle_Aseguramiento_Moneda)); }
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, 45518, ModuleId); if ((!permission.New && Id.ToString() == "0") || (!permission.Edit && Id.ToString() != "0" && (!permission.Consult && consult == 1))) { Response.Redirect("~/"); } ViewBag.Permission = permission; var varTipo_de_Dinero = new Tipo_de_DineroModel(); varTipo_de_Dinero.Clave = Id; ViewBag.ObjectId = "45518"; 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); _ITipo_de_DineroApiConsumer.SetAuthHeader(_tokenManager.Token); var Tipo_de_DinerosData = _ITipo_de_DineroApiConsumer.ListaSelAll(0, 1000, "Tipo_de_Dinero.Clave=" + Id, "").Resource.Tipo_de_Dineros; if (Tipo_de_DinerosData != null && Tipo_de_DinerosData.Count > 0) { var Tipo_de_DineroData = Tipo_de_DinerosData.First(); varTipo_de_Dinero = new Tipo_de_DineroModel { Clave = Tipo_de_DineroData.Clave , Descripcion = Tipo_de_DineroData.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(varTipo_de_Dinero)); }