Example #1
0
        private void saveup_Click(object sender, EventArgs e)
        {
            Student p = new Student();

            Regexp(@"^[a-zA-Z]{1,100}", firstnameTxtBox, stufName, "First name");
            Regexp(@"^[a-zA-Z]{1,100}", stulastnametext, lastnamestu, "Last name");
            Regexp(@"^[0-9]{1,20}", stucontacttext, stucontact, "Contact");
            Regexp(@"^([\\w\\.\\-]+)@([\\w\\-]+)((\\.(\\w){2,3})+)$", stuemailtext, stuemail, "Email");
            Regexp(@"^[0-9]{4}-[A-Z]{2,3}-[0-9]{1,3}$", regtext, label2, "Registration Number");
            p.FirstName          = firstnameTxtBox.Text;
            p.LastName           = stulastnametext.Text;
            p.Contact            = stucontacttext.Text;
            p.Email              = stuemailtext.Text;
            p.DateOfBirth        = dobstu.Value;
            p.RegistrationNumber = regtext.Text;
            String     cmd = String.Format("Select Id from Lookup Where Value = '{0}'", stugendercombo.Text);
            SqlCommand a   = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
            int        Gender;

            Gender = (Int32)a.ExecuteScalar();

            cmd = String.Format("Update Person SET FirstName = '{0}', LastName = '{1}', Contact = '{2}', Email = '{3}', DateOfBirth = '{4}', Gender = '{5}' WHERE Id = '{6}'", p.FirstName, p.LastName, p.Contact, p.Email, p.DateOfBirth, Gender, ide);
            DatabaseConnection.getInstance().exectuteQuery(cmd);
            cmd = String.Format("UPDATE Student SET Id = '{0}', RegistrationNo = '{1}' WHERE Id = '{2}'", ide, p.RegistrationNumber, ide);
            DatabaseConnection.getInstance().exectuteQuery(cmd);

            students s = new students();

            this.Hide();
            s.Show();
        }
Example #2
0
        private void studlist_Click(object sender, EventArgs e)
        {
            students s = new students();

            this.Hide();
            s.Show();
        }
Example #3
0
 private void delstu_Click(object sender, EventArgs e)
 {
     if (dataGridstudent.SelectedCells.Count != 0)
     {
         int        rw    = dataGridstudent.SelectedCells[0].RowIndex;
         string     cmd   = string.Format("DELETE FROM Student where Id = '{0}'", dataGridstudent.Rows[rw].Cells["Id"].Value.ToString());
         SqlCommand del   = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
         int        count = del.ExecuteNonQuery();
         students   s     = new students();
         this.Hide();
         s.Show();
     }
 }
Example #4
0
 private void stulist_Click(object sender, EventArgs e)
 {
     s.Show();
     this.Hide();
 }