Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            name     = txtName.Text.Trim();
            address  = txtAddress.Text.Trim();
            province = (Province)comboxBoxProvince.SelectedItem;
            district = (District)comboBoxDistrict.SelectedItem;
            commune  = (Commune)comboBoxCommune.SelectedItem;
            mobie    = txtMobile.Text.Trim();
            int.TryParse(txtYear.Text.Trim(), out year);
            Student newStudent = new Student(name, year, address, province, district, commune, mobie);

            if (name == "")
            {
                MessageBox.Show("Please enter student name ");
            }
            else if (Home.indexStudent >= 0)
            {
                Home.listStudent[Home.indexStudent] = newStudent;
                MessageBox.Show("Updated success");
                this.Close();
            }
            else
            {
                Home.listStudent.Add(newStudent);
                this.Close();
            }
        }
Esempio n. 2
0
 public Student(string name, int year, string address,
                Province province, District district, Commune commune, string mobie)
 {
     Id       = count++;
     Name     = name;
     Year     = year;
     Address  = address;
     Province = province;
     District = district;
     Commune  = commune;
     Mobile   = mobie;
 }