protected void btnTime_Click(object sender, EventArgs e) { try { Session[CLASH_SESSION] = null; if (!cbxEngineering.Checked && !cbxGroenkloof.Checked && !cbxHatfield.Checked && !cbxMamelodi.Checked && !cbxTheology.Checked) { //throw error message. Have fun with it later. NotificationCenter.ShowNotification(this, "Please select at least one campus or faculty!", AlertTypes.info); SetActivePanel(1); return; } List <string> UserModules = new List <string>(); foreach (var module in lbxDestination.Items) { UserModules.Add(module.ToString()); } List <string> UserCampuses = new List <string>(); if (cbxEngineering.Checked == true) { UserCampuses.Add("Engineering"); } if (cbxGroenkloof.Checked == true) { UserCampuses.Add("Groenkloof"); } if (cbxHatfield.Checked == true) { UserCampuses.Add("Hatfield"); } if (cbxMamelodi.Checked == true) { UserCampuses.Add("Mamelodi"); } if (cbxTheology.Checked == true) { UserCampuses.Add("Theology"); } UserInputs inputs = new UserInputs(UserModules, UserCampuses, ddlPeriod.SelectedValue.ToString(), ddlLanguage.SelectedValue.ToString()); Session[INPUTS_SESSION] = inputs; Globals gb = new Globals(); List <Module> mods = new List <Module>(); paths = (List <String>)Session[PATH_SESSION]; if (paths.Count < 1) { //throw error message. Have fun with it later. NotificationCenter.ShowNotification(this, "Session Timeout. Please reselect at least one campus or faculty!", AlertTypes.error); SetActivePanel(1); return; } Module addMod; Module temp; Lecture inLect; GetStrings(paths, Constants.EMPTY_STRING);//first store everything into session once foreach (string modName in inputs.Modules) { addMod = new Module(); foreach (string fullstring in GetStrings(paths, modName)) { string[] tempString = fullstring.Split(','); string[] group = tempString[1].Split('/'); if (group.Count() > 1) { inLect = new Lecture(fullstring); addMod.Lectures.Add(inLect); } } temp = new Module(); temp = addMod; mods.Add(temp); addMod = null; } foreach (Module mod in mods) { gb.AddNewModule(Constants.EMPTY_STRING, mod); // add module method (adapted) adding each module's lectures } //gb.TimeTable.Clear(); //gb.FixedBoolTable(ref gb.bTable, gb.FixedModList); //gb.ModulesToBeUsed = gb.Get2UseModules(gb.UserModules, inputs.Time, inputs.Language); //gb.PossibleOutComes = new List<Globals.PossibleOutcome>(); //gb.outcomecounter = 0; //gb.OneOutcome = new int[0]; generate(ref gb); // gb.Generator(gb.ModulesToBeUsed); // generate from added modules? Session[Constants.GLOBALS_SESSION] = gb; //store GB as is if (gb.PossibleOutComes.Count > 0) { Response.Redirect("~/Results.aspx", false); Context.ApplicationInstance.CompleteRequest(); } else { //alert NotificationCenter.ShowNotification(this, "We couldn't find a match for you. Please confirm that all provided information is accurate.", AlertTypes.error); } } catch (Exception x) { NotificationCenter.ShowNotification(this, x.Message, AlertTypes.error); } }