protected override void OnActionExecuting(ActionExecutingContext filterContext) { RequireJsOptions.Add( "homeUrl", Url.Action("Index", "Home", new { area = "" }), RequireJsOptionsScope.Global); RequireJsOptions.Add( "saveThemeUrl", Url.Action("SaveTheme", "Home", new { area = "" }), RequireJsOptionsScope.Global); RequireJsOptions.Add( "startTheme", Enum.GetName(typeof(BsTheme), GetTheme.Theme), RequireJsOptionsScope.Global); RequireJsOptions.Add( "themeEnum", RequireJsHtmlHelpers.ToJsonDictionary <BsTheme>(), RequireJsOptionsScope.Global); //RequireJsOptions.Add("loggerUrl", Url.Action("LogException", "Error", new { area = string.Empty }), RequireJsOptionsScope.Global); //RequireJsOptions.Add("loadLoggerUrl", Url.Action("LogLoadTimes", "Log", new { area = string.Empty }), RequireJsOptionsScope.Global); //RequireJsOptions.Add("requestKey", "request-guid", RequireJsOptionsScope.Global); }
public ActionResult Publications() { var bsGridSettings = new BsGridRepositorySettings <PublicationsSearchVm>() { PageSize = 10, Page = 1 }; bsGridSettings.Search = new PublicationsSearchVm(); var gridModel = _fakeArticlePubRepository.ToBsGridViewModel(bsGridSettings); var model = new PublicationsVm() { Grid = gridModel, Toolbar = new BsToolbarModel <PublicationsSearchVm> { Search = bsGridSettings.Search } }; var options = new Dictionary <string, string> { { "pagerUrl", Url.Action("PublicationPager") }, { "editUrl", Url.Action("Draft") } }; RequireJsOptions.Add("index", options); return(View(model)); }
public ActionResult Index() { //pass values to js RequireJsOptions.Add("ids", new[] { 1, 2, 3 }, RequireJsOptionsScope.Page); return(View()); }
public ActionResult ZItem(int id = -1) { ZDev model; if (id < 0) { model = new ZDev(); } else { model = _zDevService.GetById(id); } ZDevVm vm = Mapper.Map <ZDev, ZDevVm>(model); var options = new Dictionary <string, string> { { "saveZItemUrl", Url.Action("SaveZItem") }, { "successUrl", Url.Action("Index") } }; RequireJsOptions.Add("index", options); ViewBag.SuccessText = "Сохранено!"; return(View(vm)); }
protected virtual TSimpleViewModel TailorViewModel(TSimpleViewModel simpleViewModel, bool forDelete, bool forAlter, bool forOpen) { if (!forOpen) { if (!forDelete)//Be caution: the value of simpleViewModel.Editable should be SET EVERY TIME THE simpleViewModel LOADED! This means: if it HAVEN'T SET YET, the default value of simpleViewModel.Editable is FALSE (THE CONDITIONAL CLAUSE: if (!forDelete) MEAN: WHEN SHOW VIEW FOR DELETE, NO NEED TO CHECK Editable => Editable SHOULD BE FALSE) { simpleViewModel.Editable = this.GenericService.Editable(simpleViewModel); } if (forDelete) // || simpleViewModel is ServiceContractViewModel //WHEN forDelete, IT SHOULD BE CHECK FOR Deletable ATTRIBUTE, SURELY. BUT, WHEN OPEN VIEW FOR EDIT, NOW: ONLY VIEW ServiceContract NEED TO USE Deletable ATTRIBUTE ONLY. SO, THIS CODE IS CORRECT FOR NOW, BUT LATER, IF THERE IS MORE VIEWS NEED THIS Deletable ATTRIBUTE, THIS CODE SHOULD MODIFY MORE GENERIC!!! { simpleViewModel.Deletable = this.GenericService.Deletable(simpleViewModel); } if (forAlter)//NOW THIS GlobalLocked attribute ONLY be considered WHEN ALTER ACTION to USE IN ALTER VIEW: to ALLOW or NOT ALTER. { simpleViewModel.GlobalLocked = this.GenericService.GlobalLocked(simpleViewModel); } } simpleViewModel.ShowDiscount = this.GetShowDiscount(simpleViewModel); simpleViewModel.ShowListedPrice = this.GetShowListedPrice(simpleViewModel); simpleViewModel.ShowListedGrossPrice = this.GetShowListedGrossPrice(simpleViewModel); RequireJsOptions.Add("Editable", simpleViewModel.Editable, RequireJsOptionsScope.Page); RequireJsOptions.Add("Deletable", simpleViewModel.Deletable, RequireJsOptionsScope.Page); simpleViewModel.UserID = this.GenericService.UserID; //CAU LENH NAY TAM THOI DUOC SU DUNG DE SORT USER DROPDWONLIST. SAU NAY NEN LAM CACH KHAC, CACH NAY KHONG HAY simpleViewModel.LocationID = this.GenericService.LocationID; //CAU LENH NAY TAM THOI DUOC SU DUNG DE SORT USER DROPDWONLIST. SAU NAY NEN LAM CACH KHAC, CACH NAY KHONG HAY this.viewModelSelectListBuilder.BuildSelectLists(simpleViewModel); //Buil select list for dropdown box using IEnumerable<SelectListItem> (using for short data list only). For the long list, it should use Kendo automplete instead. return(simpleViewModel); }
//FOR SIMPLICITY, AT NOW (JUST FOR HIGHTLIGHT MENUONLY): JUST CALL THIS. BUT LATER, WE CAN INHERIT FROM BaseController public virtual void AddRequireJsOptions(int nmvnTaskID) { MenuSession.SetModuleID(this.HttpContext, (this.binLocationService.LocationID == 1? 6 : 3)); RequireJsOptions.Add("ModuleID", (this.binLocationService.LocationID == 1 ? 6 : 3), RequireJsOptionsScope.Page); RequireJsOptions.Add("ModuleDetailID", (nmvnTaskID == 6668805 ? (this.binLocationService.LocationID == 1 ? 666880501 : 6668805) : (this.binLocationService.LocationID == 1 ? 666880901 : 6668809)), RequireJsOptionsScope.Page); RequireJsOptions.Add("NmvnTaskID", nmvnTaskID, RequireJsOptionsScope.Page); }
public ActionResult Index() { RequireJsOptions.Add("ids", new List <int> { 1, 2, 3 }); RequireJsOptions.Add("successMsg", "All the modules have been loaded"); return(View()); }
public virtual void AddRequireJsOptions() { int nmvnModuleID = this.baseService.NmvnModuleID; MenuSession.SetModuleID(this.HttpContext, nmvnModuleID); RequireJsOptions.Add("LocationID", this.baseService.LocationID, RequireJsOptionsScope.Page); RequireJsOptions.Add("NmvnModuleID", nmvnModuleID, RequireJsOptionsScope.Page); RequireJsOptions.Add("NmvnTaskID", this.baseService.NmvnTaskID, RequireJsOptionsScope.Page); }
public override void AddRequireJsOptions() { base.AddRequireJsOptions(); StringBuilder commodityTypeIDList = new StringBuilder(); commodityTypeIDList.Append((int)GlobalEnums.CommodityTypeID.Vehicles); RequireJsOptions.Add("commodityTypeIDList", commodityTypeIDList.ToString(), RequireJsOptionsScope.Page); }
public ActionResult Index() { MenuSession.SetModuleID(this.HttpContext, 9); //RequireJsOptions.Add("LocationID", this.baseService.LocationID, RequireJsOptionsScope.Page); RequireJsOptions.Add("NmvnModuleID", 9, RequireJsOptionsScope.Page); RequireJsOptions.Add("NmvnTaskID", 0, RequireJsOptionsScope.Page); return(View()); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { var url = new UrlHelper(filterContext.RequestContext); RequireJsOptions.Add("rndQuantity", GlobalEnums.rndQuantity, RequireJsOptionsScope.Global); RequireJsOptions.Add("rndAmount", GlobalEnums.rndAmount, RequireJsOptionsScope.Global); RequireJsOptions.Add("rndDiscountPercent", GlobalEnums.rndDiscountPercent, RequireJsOptionsScope.Global); RequireJsOptions.Add("settingsManager.dateFormat", SettingsManager.DateFormat, RequireJsOptionsScope.Global); }
// // GET: /Demo/UserProfile/ public ActionResult Index() { var model = GetUserProfileModel(); RequireJsOptions.Add("uploadUrl", Url.Action("UploadAvatar")); RequireJsOptions.Add("avatarUrl", Url.Action("GetAvatar")); RequireJsOptions.Add("deleteAvatarUrl", Url.Action("DeleteAvatar")); return(View(model)); }
public ActionResult Index() { MenuSession.SetModuleID(this.HttpContext, 9); //RequireJsOptions.Add("LocationID", this.baseService.LocationID, RequireJsOptionsScope.Page); RequireJsOptions.Add("NmvnModuleID", 9, RequireJsOptionsScope.Page); RequireJsOptions.Add("NmvnTaskID", 0, RequireJsOptionsScope.Page); return(View(this.reportRepository.GetEntityIndexes <Report>(User.Identity.GetUserId(), HomeSession.GetGlobalFromDate(this.HttpContext), HomeSession.GetGlobalToDate(this.HttpContext)))); }
public ActionResult Index() { ApplicationUser user = UserManager.FindById(User.Identity.GetUserId()); ProfileVm vm = Mapper.Map <ApplicationUser, ProfileVm>(user); RequireJsOptions.Add("uploadUrl", Url.Action("UploadAvatar")); RequireJsOptions.Add("avatarUrl", Url.Action("GetAvatar")); RequireJsOptions.Add("deleteAvatarUrl", Url.Action("DeleteAvatar")); return(View(vm)); }
public virtual void AddRequireJsOptions() { GlobalEnums.NmvnTaskID moduleDetailID = this.ModuleDetailID; int moduleID = this.baseService.GetModuleID(moduleDetailID); MenuSession.SetModuleID(this.HttpContext, moduleID); RequireJsOptions.Add("LocationID", this.baseService.LocationID, RequireJsOptionsScope.Page); RequireJsOptions.Add("ModuleID", moduleID, RequireJsOptionsScope.Page); RequireJsOptions.Add("ModuleDetailID", (int)moduleDetailID, RequireJsOptionsScope.Page); RequireJsOptions.Add("NmvnTaskID", this.baseService.NmvnTaskID, RequireJsOptionsScope.Page); }
public ActionResult Index(int?stateId) { BsGridRepositorySettings <ContributorSearchModel> bsGridSettings = null; if (stateId.HasValue) { var state = _componentState.Get(stateId.Value); if (state != null) { bsGridSettings = state.ToBsGridRepositorySettings <ContributorSearchModel>(); } } if (bsGridSettings == null) { bsGridSettings = new BsGridRepositorySettings <ContributorSearchModel>() { PageSize = 5, Page = 1 }; } bsGridSettings.Search = _gridRepository.GetSearchForm(bsGridSettings.Search); var gridModel = _gridRepository.ToBsGridViewModel(bsGridSettings); var model = new ContributorsViewModel { Grid = gridModel, Toolbar = new BsToolbarModel <ContributorSearchModel, ContributorNewModel, List <ContributorOrderModel> > { Search = bsGridSettings.Search, New = _gridRepository.GetNewForm(), Order = _gridRepository.GetOrderForm(true) } }; var options = new Dictionary <string, object> { { "pagerUrl", Url.Action("Pager") }, { "getRowsUrl", Url.Action("GetRows") }, { "enableDisableUrl", Url.Action("EnableDisable") }, { "exportExcelUrl", Url.Action("ExportExcel") }, { "updateUrl", Url.Action("Update") }, { "deleteUrl", Url.Action("Delete") }, { "editComponents", RequireJsHtmlHelpers.ToJsonDictionary <EditComponents>() } }; RequireJsOptions.Add("index", options); return(View(model)); }
public override void AddRequireJsOptions() { base.AddRequireJsOptions(); TSimpleViewModel simpleViewModel = new TSimpleViewModel(); StringBuilder commodityTypeIDList = new StringBuilder(); commodityTypeIDList.Append((int)(simpleViewModel.IsItem ? GlobalEnums.CommodityTypeID.Materials : GlobalEnums.CommodityTypeID.Unknown)); RequireJsOptions.Add("masterCommodityTypeIDs", commodityTypeIDList.ToString(), RequireJsOptionsScope.Page); }
public override void RegisterGlobalOptions() { RequireJsOptions.Add( "homeUrl", Url.Action("Index", "Home", new { area = "" }), RequireJsOptionsScope.Global); RequireJsOptions.Add( "toggleSidebarUrl", Url.Action("ToggleSidebar", "Ajax", new { area = "" }), RequireJsOptionsScope.Global); }
public override void AddRequireJsOptions() { base.AddRequireJsOptions(); StringBuilder commodityTypeIDList = new StringBuilder(); commodityTypeIDList.Append((int)GlobalEnums.CommodityTypeID.Materials); RequireJsOptions.Add("commodityTypeIDList", commodityTypeIDList.ToString(), RequireJsOptionsScope.Page); RequireJsOptions.Add("masterCommodityTypeIDs", ((int)GlobalEnums.CommodityTypeID.Items).ToString(), RequireJsOptionsScope.Page); }
public override void AddRequireJsOptions() { base.AddRequireJsOptions(); TViewDetailViewModel viewDetailViewModel = new TViewDetailViewModel(); StringBuilder commodityTypeIDList = new StringBuilder(); commodityTypeIDList.Append((int)(viewDetailViewModel.IsItem ? GlobalEnums.CommodityTypeID.Items : (viewDetailViewModel.IsMaterial ? GlobalEnums.CommodityTypeID.Materials : (viewDetailViewModel.IsProduct ? GlobalEnums.CommodityTypeID.Products : GlobalEnums.CommodityTypeID.Unknown)))); RequireJsOptions.Add("commodityTypeIDList", commodityTypeIDList.ToString(), RequireJsOptionsScope.Page); }
public override void RegisterGlobalOptions() { RequireJsOptions.Add( "homeUrl", Url.Action("Index", "Home", new { area = "" }), RequireJsOptionsScope.Global); RequireJsOptions.Add( "adminUrl", Url.Action("Index", "Dashboard", new { area = "Admin" }), RequireJsOptionsScope.Global); RequireJsOptions.Add( "statusEnum", RequireJsHtmlHelpers.ToJsonDictionary <AjaxRequestStatus>(), RequireJsOptionsScope.Global); }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { RequireJsOptions.Add( "homeUrl", Url.Action("Index", "Home", new { area = "" }), RequireJsOptionsScope.Global); RequireJsOptions.Add( "adminUrl", Url.Action("Index", "Dashboard", new { area = "Admin" }), RequireJsOptionsScope.Global); RequireJsOptions.Add( "statusEnum", RequireJsHtmlHelpers.ToJsonDictionary <AjaxRequestStatus>(), RequireJsOptionsScope.Global); }
public override void AddRequireJsOptions() { base.AddRequireJsOptions(); StringBuilder commodityTypeIDList = new StringBuilder(); commodityTypeIDList.Append((int)GlobalEnums.CommodityTypeID.Items); commodityTypeIDList.Append(","); commodityTypeIDList.Append((int)GlobalEnums.CommodityTypeID.Consumables); RequireJsOptions.Add("commodityTypeIDList", commodityTypeIDList.ToString(), RequireJsOptionsScope.Page); StringBuilder warehouseTaskIDList = new StringBuilder(); warehouseTaskIDList.Append((int)GlobalEnums.WarehouseTaskID.DeliveryAdvice); ViewBag.WarehouseTaskID = (int)GlobalEnums.WarehouseTaskID.DeliveryAdvice; ViewBag.WarehouseTaskIDList = warehouseTaskIDList.ToString(); }
public ActionResult Index() { var options = new Dictionary <string, object> { { "drugsBuilderPager", Url.Action("DrugsBuilderPager") }, { "newPrescriptionUrl", Url.Action("Create") } }; RequireJsOptions.Add("Index", options); var userData = Session["UserData"] as UserData; var model = new PrescriptionsPageModel { NewPrescriptionModel = _prescriptionsRepository.GetNewForm(userData) }; return(View(model)); }
public ActionResult Index() { var userData = Session["UserData"] as UserData; var options = new Dictionary <string, object> { { "getEvents", Url.Action("GetEvents") }, { "currentCulture", Thread.CurrentThread.CurrentCulture.Name.Split('-')[0] }, }; RequireJsOptions.Add("Index", options); var model = new AppointmentsPageModel { AppointmentsListModel = new AppointmentsListModel(), NewAppoitmentModel = _appointmentsRepository.GetNewAppoitmentModel() }; return(View(model)); }
protected virtual TSimpleViewModel TailorViewModel(TSimpleViewModel simpleViewModel, bool forDelete) { if (forDelete)//Be caution: the value of simpleViewModel.Editable should be SET EVERY TIME THE simpleViewModel LOADED! This means: if it HAVEN'T SET YET, the default value of simpleViewModel.Editable is FALSE { simpleViewModel.Deletable = this.genericService.Deletable(simpleViewModel); } else { simpleViewModel.Editable = this.genericService.Editable(simpleViewModel); } RequireJsOptions.Add("Editable", simpleViewModel.Editable, RequireJsOptionsScope.Page); RequireJsOptions.Add("Deletable", simpleViewModel.Deletable, RequireJsOptionsScope.Page); simpleViewModel.UserID = this.genericService.UserID; //CAU LENH NAY TAM THOI DUOC SU DUNG DE SORT USER DROPDWONLIST. SAU NAY NEN LAM CACH KHAC, CACH NAY KHONG HAY this.viewModelSelectListBuilder.BuildSelectLists(simpleViewModel); //Buil select list for dropdown box using IEnumerable<SelectListItem> (using for short data list only). For the long list, it should use Kendo automplete instead. return(simpleViewModel); }
public ActionResult Draft(int id) { Article model = _articleService.GetById((int)id); if (model.AuthorId != User.Identity.GetUserId()) { throw new SecurityException("User is not authorized to open this record"); } DraftVm vm = Mapper.Map <Article, DraftVm>(model); InitViewModel(vm); var options = new Dictionary <string, string> { { "saveDraftUrl", Url.Action("SaveDraft") }, { "postUrl", Url.Action("PostDraft") }, { "successUrl", Url.Action("PostSuccess") }, { "returnUrl", Url.Action("ReturnDraft") }, { "submitUrl", Url.Action("PublishDraft") }, { "changesUrl", Url.Action("ProposeChanges") } }; RequireJsOptions.Add("index", options); if (_articleService.IsDraft(model) || model.ArticleState == ArticleState.New) { ViewBag.SuccessText = "Черновик был успешно сохранен"; } else if (_articleService.IsPublished(model)) { ViewBag.SuccessText = "Публикация успешно изменена"; } else if (_articleService.IsPosted(model)) { ViewBag.SuccessText = "Успешно!"; } return(View(vm)); }
public ActionResult Index() { var gridModel = _fakeOldMediaRepository.ToBsGridViewModel(new BsGridBaseRepositorySettings() { Page = 1, PageSize = 20 }); var model = new OldMediaListVm() { Grid = gridModel }; var options = new Dictionary <string, string> { { "pagerUrl", Url.Action("Pager") } }; RequireJsOptions.Add("index", options); return(View(model)); }
public ActionResult Index() { var userData = Session["UserData"] as UserData; var gridSettings = new UsersSettings { PageSize = 5, Page = 1, UserData = userData }; var gridModel = _usersRepository.ToBsGridViewModel(gridSettings); var model = new UsersPageModel { Grid = gridModel, Toolbar = new BsToolbarModel <UserSearchModel, UserNewModel> { Search = _usersRepository.GetSearchForm(gridSettings), New = _usersRepository.GetNewForm(gridSettings), } }; var options = new Dictionary <string, object> { { "pagerUrl", Url.Action("Pager") }, { "getRowsUrl", Url.Action("GetRows") }, { "enableDisableUrl", Url.Action("EnableDisable") }, { "deleteUrl", Url.Action("Delete") }, { "updateComponentListUrl", Url.Action("UpdateComponentList") }, { "currentCulture", Thread.CurrentThread.CurrentCulture.Name.Split('-')[0] }, { "autocompleteComponents", RequireJsHtmlHelpers.ToJsonDictionary <UserAutocompleteComponents>() }, { "userRoles", RequireJsHtmlHelpers.ToJsonDictionary <UserRoles>() } }; RequireJsOptions.Add("Index", options); return(View(model)); }
public override void AddRequireJsOptions() { base.AddRequireJsOptions(); RequireJsOptions.Add("ApplyToSalesVersusReturns", (int)GlobalEnums.ApplyToSalesVersusReturns.ApplyToReturns, RequireJsOptionsScope.Page); StringBuilder commodityTypeIDList = new StringBuilder(); commodityTypeIDList.Append((int)GlobalEnums.CommodityTypeID.Parts); commodityTypeIDList.Append(","); commodityTypeIDList.Append((int)GlobalEnums.CommodityTypeID.Consumables); RequireJsOptions.Add("commodityTypeIDList", commodityTypeIDList.ToString(), RequireJsOptionsScope.Page); //USING THE SAME WarehouseTaskID WITH DeliveryAdvice. LATER, IF NEED NEW WarehouseTaskID FOR SalesReturn: JUST MODIFY HERE ONLY StringBuilder warehouseTaskIDList = new StringBuilder(); warehouseTaskIDList.Append((int)GlobalEnums.WarehouseTaskID.DeliveryAdvice); ViewBag.WarehouseTaskID = (int)GlobalEnums.WarehouseTaskID.DeliveryAdvice; ViewBag.WarehouseTaskIDList = warehouseTaskIDList.ToString(); }