private void showGroupsToolStripMenuItem_Click(object sender, EventArgs e) { Manage_Student_Groups studentGroup = new Manage_Student_Groups(); this.Hide(); studentGroup.Show(); }
private void cmdCreateGroup_Click(object sender, EventArgs e) { var currentDateTime = DateTime.Now; if (!is_editMode()) { string queryGroup = string.Format("insert into [Group](Created_On) values('{0}')", currentDateTime.Date); DataBaseConnection.getInstance().executeQuery(queryGroup); foreach (Student st in newGroupStudents) //StudentGroupDL.getInstance().getStudentGroup() { string queryStudentGroup = string.Format("insert into GroupStudent(GroupId,StudentId,Status,AssignmentDate) values((select max(Id) from [Group]),'{0}','{1}','{2}')", st.Id, 4, currentDateTime); DataBaseConnection.getInstance().executeQuery(queryStudentGroup); } MessageBox.Show("Insert success"); } else { //group member status string statusQuery = "select Status from GroupStudent where GroupId=" + GeneralID.selectedObjectid + ""; var getStatus = DataBaseConnection.getInstance().readData(statusQuery); getStatus.Read(); int countStatusValue = (int)getStatus.GetValue(0); foreach (Student st in newGroupStudents) //StudentGroupDL.getInstance().getStudentGroup() { string countExistQuery = string.Format("select count(StudentId) from GroupStudent where StudentId='{0}'", st.Id); int countStudentInGroup = DataBaseConnection.getInstance().getRowsCount(countExistQuery); // MessageBox.Show(countStudentInGroup.ToString()); if (countStudentInGroup == 0) { MessageBox.Show("new added in prev"); string queryStudentGroup = string.Format("insert into GroupStudent(GroupId,StudentId,Status,AssignmentDate) values('{0}','{1}','{2}','{3}')", GeneralID.selectedObjectid, st.Id, countStatusValue, currentDateTime); DataBaseConnection.getInstance().executeQuery(queryStudentGroup); } } MessageBox.Show("update success"); GeneralID.selectedObjectid = 0; } // StudentGroupDL.getInstance().getStudentGroup().Clear(); Manage_Student_Groups msg = new Manage_Student_Groups(); this.Hide(); msg.Show(); }
/* public bool IsFormOpen(Type formType) * { * foreach (Form form in Application.OpenForms) * if (form.GetType().Name == form.Name) * return true; * return false; * } */ private void cmdCancel_Click(object sender, EventArgs e) { //foreach(Form form in Application.OpenForms) //{ // // MessageBox.Show(form.GetType().Name); // if (form.GetType().Name == "Make_Group") // { // // MessageBox.Show(form.Name); // form.Hide(); // } //} Manage_Student_Groups msg = new Manage_Student_Groups(); this.Hide(); msg.Show(); }