public void loadListBox() { ListBoxOrganizers.Items.Clear(); try { Organizerlist = FileUtility.ReadFile(Server.MapPath("~/App_Data/organizers.ser")); Application["AllOrganizers"] = Organizerlist; if (Organizerlist.Count == 0) { LabelMessage.Text = "No Organizers in file"; } else { for (int i = 0; i < Organizerlist.Count; i++) { ListBoxOrganizers.Items.Add(Organizerlist[i].ToString() + "\n"); } } } catch (Exception ex) { LabelMessage.Text = ex.Message; } }
public void loadTextBox() { ListBoxHunters.Items.Clear(); try { PokehunterList = FileUtility.ReadFile(Server.MapPath("~/App_Data/pokehunters.ser")); Application["AllPokehunters"] = PokehunterList; if (PokehunterList.Count == 0) { LabelMessage.Text = "No Pokehunters in file"; } else { for (int i = 0; i < PokehunterList.Count; i++) { ListBoxHunters.Items.Add(PokehunterList[i].ToString() + "\n"); } } } catch (Exception ex) { LabelMessage.Text = ex.Message; } }
protected void ButtonRead_Click(object sender, EventArgs e) { ListBoxPokehunters.Items.Clear(); try { PokehunterList = FileUtility.ReadFile(Server.MapPath("~/App_Data/pokehunters.ser")); Application["AllPokehunters"] = PokehunterList; if (PokehunterList.Count == 0) { LabelMessage.Text = "No Pokehunters in file"; } else { LabelMessage.Text = "Pokehunters from file\n"; for (int i = 0; i < PokehunterList.Count; i++) { ListBoxPokehunters.Items.Add(PokehunterList[i].ToString() + "\n"); } } } catch (Exception ex) { LabelMessage.Text = ex.Message; } }
protected void ButtonRead_Click(object sender, EventArgs e) { ListBoxOrganizers.Items.Clear(); try { Organizerlist = FileUtility.ReadFile(Server.MapPath("~/App_Data/organizers.ser")); Application["AllOrganizers"] = Organizerlist; if (Organizerlist.Count == 0) { ListBoxOrganizers.Text = "No organizers in file"; } else { ListBoxOrganizers.Text = "Organizers from file\n"; for (int i = 0; i < Organizerlist.Count; i++) { ListBoxOrganizers.Items.Add(Organizerlist[i].ToString() + "\n"); } //foreach(Person p in PokehunterList) //{ //if (p == (Organizers)p) //{ // Person o = p as Organizers; // ListBoxOrganizers.Items.Add("" + o.ToString()); //} //else //{ // continue; //} //} } } catch (Exception ex) { LabelMessage.Text = ex.Message; } }
protected void ButtonLogin_Click(object sender, EventArgs e) { Organizerlist = FileUtility.ReadFile(Server.MapPath("~/App_Data/organizers.ser")); Application["AllOrganizers"] = Organizerlist; try { string username = TextBoxName.Text; string password = TextBoxPassword.Text; foreach (Organizers o in Organizerlist) { if (o.Alias == username && o.Password == password) { FormsAuthentication.SetAuthCookie(TextBoxName.Text.ToLower(), true); HttpCookie cookie = new HttpCookie("organizer"); cookie.Expires = DateTime.Now.AddDays(1); HttpContext.Current.Response.Cookies.Add(cookie); LabelLogin.Text = "You are now logged in"; ButtonDelete.Enabled = true; ButtonUpdate.Enabled = true; //ButtonRead.Enabled = true; ButtonLogout.Enabled = true; } else { continue; } } } catch (Exception ex) { //LabelMessage.Text = ex.Message; LabelMessage.Text = "No match"; } }