Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            grp g = new grp();

            this.Hide();
            g.Show();
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            String cmd = String.Format("INSERT INTO [ProjectA].[dbo].[Group] (Created_On) values(GetDate())");

            DatabaseConnection.getInstance().exectuteQuery(cmd);

            cmd = "Select MAX(Id) from [ProjectA].[dbo].[Group] ";
            SqlDataReader reader = DatabaseConnection.getInstance().getData(cmd);
            int?          id     = null;

            while (reader.Read())
            {
                id = (int)reader.GetValue(0);
            }
            cmd = String.Format("Select Project.Id from Project where title = '{0}'", procombo.Text);
            SqlCommand a = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
            int        ad;

            ad  = (Int32)a.ExecuteScalar();
            cmd = String.Format("INSERT INTO GroupProject(GroupId,ProjectId,AssignmentDate) values('{0}','{1}',GetDate() )", id, ad);
            DatabaseConnection.getInstance().exectuteQuery(cmd);
            grp p = new grp();

            this.Hide();
            p.Show();
        }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            String     cmd = String.Format("Select Id from Person  Where FirstName +' ' +LastName = '{0}'", stucombo.Text);
            SqlCommand a   = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
            int        stu;

            stu = (Int32)a.ExecuteScalar();
            cmd = String.Format("Select GroupProject.GroupId from Project Join GroupProject On PRoject.Id = GroupProject.ProjectId Where title = '{0}'", procombo.Text);
            a   = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
            int pro;

            pro = (Int32)a.ExecuteScalar();
            cmd = String.Format("Select Id from Lookup  Where Value = 'Active'");
            a   = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
            int st;

            st  = (Int32)a.ExecuteScalar();
            cmd = String.Format("INSERT INTO GroupStudent(GroupId,StudentId,Status,AssignmentDate) values('{0}','{1}','{2}',GetDate() )", pro, stu, st);
            DatabaseConnection.getInstance().exectuteQuery(cmd);
            grp g = new grp();

            this.Hide();
            g.Show();
        }