diff --git a/LearningRegistry/obj/Debug/LearningRegistry.dll b/LearningRegistry/obj/Debug/LearningRegistry.dll index b2e479f7..bb837267 100644 Binary files a/LearningRegistry/obj/Debug/LearningRegistry.dll and b/LearningRegistry/obj/Debug/LearningRegistry.dll differ diff --git a/LearningRegistry/obj/Debug/LearningRegistry.pdb b/LearningRegistry/obj/Debug/LearningRegistry.pdb index 0b303b6b..daedc261 100644 Binary files a/LearningRegistry/obj/Debug/LearningRegistry.pdb and b/LearningRegistry/obj/Debug/LearningRegistry.pdb differ diff --git a/VwarWeb/App_Code/Security.cs b/VwarWeb/App_Code/Security.cs index 16902533..eee97110 100644 --- a/VwarWeb/App_Code/Security.cs +++ b/VwarWeb/App_Code/Security.cs @@ -41,7 +41,7 @@ public static bool IsAdministrator() /// public static void CreateRolesAndAdministrativeUser() { - if (Website.Config.GenerateDefaultAdministratorOnApplicationStartup) + if (Website.Config.GenerateDefaultAdministratorOnApplicationStartup) { try { diff --git a/VwarWeb/Bin/LearningRegistry.dll b/VwarWeb/Bin/LearningRegistry.dll index b2e479f7..bb837267 100644 Binary files a/VwarWeb/Bin/LearningRegistry.dll and b/VwarWeb/Bin/LearningRegistry.dll differ diff --git a/VwarWeb/Public/FederationResults.aspx b/VwarWeb/Public/FederationResults.aspx index 82a5f709..7bc9fa01 100644 --- a/VwarWeb/Public/FederationResults.aspx +++ b/VwarWeb/Public/FederationResults.aspx @@ -129,7 +129,7 @@ limitations under the License.
- Previous + Previous
@@ -139,7 +139,7 @@ limitations under the License.
- Next + Next
diff --git a/VwarWeb/Public/FederationResults.aspx.cs b/VwarWeb/Public/FederationResults.aspx.cs index a82321c2..5e71fb33 100644 --- a/VwarWeb/Public/FederationResults.aspx.cs +++ b/VwarWeb/Public/FederationResults.aspx.cs @@ -20,9 +20,11 @@ public partial class Public_Results : Website.Pages.PageBase { const int DEFAULT_RESULTS_PER_PAGE = 5; - private int _ResultsPerPage; + private int _ResultsPerPage = 6; private int _PageNumber = 1; - + private FederateRecordSet federates; + private List SearchResults; + [Serializable] class SearchResult { public string PID { get; set; } @@ -33,33 +35,50 @@ class SearchResult protected void Page_Load(object sender, EventArgs e) { SearchPanel.Visible = false; - _ResultsPerPage = 6; - if(!IsPostBack) - if (Request.QueryString["SearchTerms"] != "" && Request.QueryString["SearchTerms"] != null) + + + if (!IsPostBack) + { + if (Request.QueryString["SearchTerms"] != "" && Request.QueryString["SearchTerms"] != null) + { + ViewState["Federates"] = null; + ViewState["SearchResults"] = null; + SearchResults = null; + ApplySearchResults(GetSearchResults(Request.QueryString["SearchTerms"])); + SearchFederationTextBox.Text = Request.QueryString["SearchTerms"]; + SearchResultsUpdatePanel.Visible = true; + + } + + + } + else { - ApplySearchResults(GetSearchResults(Request.QueryString["SearchTerms"])); - SearchFederationTextBox.Text = Request.QueryString["SearchTerms"]; - SearchResultsUpdatePanel.Visible = true; + _ResultsPerPage = System.Convert.ToInt16(ResultsPerPageDropdown.SelectedValue); } - + } private IEnumerable GetSearchResults(string terms) { - List SearchResults = new List(); - + if (ViewState["SearchResults"] == null) + { + SearchResults = new List(); + System.Net.WebClient wc = new System.Net.WebClient(); wc.Credentials = new System.Net.NetworkCredential("AnonymousUser", ""); - string data = wc.DownloadString("http://3dr.adlnet.gov/Federation/3DR_Federation.svc/Search/"+terms+"/json?ID=00-00-00"); + string data = wc.DownloadString("http://3dr.adlnet.gov/Federation/3DR_Federation.svc/Search/" + terms + "/json?ID=00-00-00"); SearchResults.Clear(); SearchResult[] results = (new JavaScriptSerializer()).Deserialize(data); foreach (SearchResult s in results) { SearchResults.Add(s); } - return SearchResults; + ViewState["SearchResults"] = SearchResults; + } + return ViewState["SearchResults"] as List; } protected void RefreshSearch(object sender, EventArgs args) { @@ -82,10 +101,18 @@ protected void SearchFederatonButton_Click(object sender, EventArgs args) private void ApplySearchResults(IEnumerable co) { List results = new List(); - for (int i = (_PageNumber - 1) * System.Convert.ToInt16(ResultsPerPageDropdown.Text); i(federatedata); - ViewState["FederateRecordSet"] = federates; + federates = (new JavaScriptSerializer()).Deserialize(federatedata); + ViewState["Federates"] = federates; } - return ViewState["FederateRecordSet"] as FederateRecordSet; + return ViewState["Federates"] as FederateRecordSet; } public FederateRecord GetFederateInfo(string pid) { @@ -190,7 +217,12 @@ protected void PageNumberChanged(object sender, EventArgs e) LinkButton btn = (LinkButton)sender; if (btn.CommandArgument == "Next") _PageNumber += 1; - _PageNumber = System.Convert.ToInt32(btn.CommandArgument); + else if (btn.CommandArgument == "Prev") + _PageNumber -= 1; + else + _PageNumber = System.Convert.ToInt32(btn.CommandArgument); + + if (_PageNumber < 1) _PageNumber = 1; IEnumerable co = null; if (Request.QueryString["SearchTerms"] != "")