Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            String     cmd = String.Format("Select GroupProject.GroupId from Project JOIN GroupProject ON Project.Id = GroupProject.ProjectId where title = '{0}'", procombo.Text);
            SqlCommand a   = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
            int        ad;

            ad = (Int32)a.ExecuteScalar();
            groups g = new groups(ad);

            this.Hide();
            g.Show();
        }
Exemple #2
0
        private void deladd_Click(object sender, EventArgs e)
        {
            if (dataGridadd.SelectedCells.Count != 0)
            {
                int rw = dataGridadd.SelectedCells[0].RowIndex;

                String     cmd = String.Format("Select Id from Lookup  Where Value = 'Active'");
                SqlCommand a   = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
                int        st;
                st  = (Int32)a.ExecuteScalar();
                cmd = String.Format("Select Person.Id From Person where FirstName + ' ' +LastName ='{0}' ", dataGridadd.Rows[rw].Cells["Name"].Value.ToString());
                a   = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
                int id;
                id  = (Int32)a.ExecuteScalar();
                cmd = string.Format("UPDATE GroupStudent SET Status = '{1}'  where StudentId = '{0}'", id, st);
                SqlCommand del   = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
                int        count = del.ExecuteNonQuery();
                groups     p     = new groups();
                this.Hide();
                p.Show();
            }
        }