public ActionResult Records(int?page, int?sortColumnIndex, int?sortDirection, string searchText) { RecordListModel model = new RecordListModel(); SearchAttributes searchParam = new SearchAttributes(); searchParam.CurrentPageNumber = (page.HasValue && page.Value > 0) ? page.Value : 1; searchParam.RecordsPerPage = AppSettingsUtility.GetInt(AppSettingsKeys.RecordsPerPage); if (sortColumnIndex.HasValue) { searchParam.SortColumnIndex = sortColumnIndex.Value; } else { searchParam.SortColumnIndex = 1; } searchParam.SortDirection = (sortDirection.HasValue && sortDirection.Value == 1) ? Entity.SortDirection.Descending : Entity.SortDirection.Ascending; if (!string.IsNullOrEmpty(searchText)) { searchParam.SearchText = searchText; } model.SearchParam = searchParam; model.Populate(searchParam); //for Ajax Specific Request if (Request.IsAjaxRequest()) { return(View("~/Views/Shared/PartialViews/Admin/Record/_RecordList.cshtml", model)); } else { return(View("~/Views/Admin/Record/RecordList.cshtml", model)); } }
/// <summary> /// Register the current project /// </summary> /// <param name="projectGUID"></param> public static void SetProject(string projectGUID) { Task.Run(() => { RecordLists = new RecordListModel(); var projectId = projectGUID.ToString(); App.CurrentProjectId = projectId; Preferences.Set("currentProject", projectId); AppShell.ClearNavigationStacks(); MessagingCenter.Send(App.Current, "SetProject"); RecordLists.CreateRecordLists(); }); }
/// <summary> /// Initialisation with os dependent parameter inputs. Start listening for a login return /// </summary> /// <param name="databaseLocation"></param> /// <param name="tileLocation"></param> public App(string databaseLocation, string tileLocation) { InitializeComponent(); Device.SetFlags(new string[] { "RadioButton_Experimental", "Shapes_Experimental", "Expander_Experimental" }); RecordLists = new RecordListModel(); CurrentUser = User.RetrieveUser(); BioDivPrefs = new BioDivPreferences(); Preferences.Set("databaseLocation", databaseLocation); TileLocation = tileLocation; CurrentProjectId = Preferences.Get("currentProject", ""); RecordLists.CreateRecordLists(); Busy = false; CheckConnection(); VersionTracking.Track(); MessagingCenter.Subscribe <Xamarin.Forms.Application>(Xamarin.Forms.Application.Current, "LoginSuccessful", (sender) => { Device.BeginInvokeOnMainThread(() => { BioDivCollectorXamarin.Models.LoginModel.Login.GetUserDetails(); MainPage = new AppShell(); if (CurrentRoute != null && CurrentRoute != String.Empty) { try { AppShell.Current.GoToAsync(CurrentRoute); } catch (Exception e) { Console.WriteLine("Didn't manage to go to route, " + e); } } }); }); MessagingCenter.Subscribe <Xamarin.Forms.Application>(Xamarin.Forms.Application.Current, "LoginUnsuccessful", (sender) => { Device.BeginInvokeOnMainThread(() => { MainPage = Login.GetPageToView(); }); }); }