Example #1
0
        protected void Button_createPerson_Click(object sender, EventArgs e)
        {
            if (TextBox_id.Text == "" || TextBox_name.Text == "" || TextBox_age.Text == "" || TextBox_email.Text == "" || TextBox_keycard.Text == "")
            {
                Label_createError.Text = "Complete the typing!!";
            }
            else
            {
                ListBox_show.Items.Clear();
                Label_createError.Text = "";
                int             id     = Convert.ToInt32(TextBox_id.Text);
                string          name   = TextBox_name.Text;
                int             age    = Convert.ToInt32(TextBox_age.Text);
                string          email  = TextBox_email.Text;
                int             mykey  = Convert.ToInt32(TextBox_keycard.Text);
                Keycard.Keycard key    = new Keycard.Keycard(mykey);
                Person          person = new Person(id, name, age, email, key);
                arrPerson.Add(person);
                Session["myPerson"] = arrPerson;

                for (int i = 0; i < arrPerson.Count; i++)
                {
                    ListBox_show.Items.Add(arrPerson[i].ToString());
                }
            }
        }
Example #2
0
 public Person(int id, string name, int age, string email, Keycard.Keycard mykey)
 {
     this.ID    = id;
     this.Name  = name;
     this.Age   = age;
     this.Email = email;
     this.Mykey = mykey;
 }