private void UpdateStudentTakenCourses(GameCoding gameCoding, String selectedCourse) { List <Student> listStudents = new List <Student>(); listStudents = GetStudentsIngroup(tb_GroupName.Text); int start = selectedCourse.IndexOf("(") + 1; int end = selectedCourse.IndexOf(")") - start; Module module = gameCodingManager.GetSelectedModule(int.Parse(selectedCourse.Substring(start, end)), gameCoding.Game); foreach (Student student in listStudents) { gameCodingManager.SaveStudentTakenCousres(student, gameCoding, module); } }
private void btn_ChooseMan_Click(object sender, EventArgs e) { String selectedCourse = null; var selectedModule = (lst_Modules.SelectedItem as SelectValue).Value; if ((selectedModule == null)) { lb_ChooseManError.Text = "Please Choose one Item"; lb_ChooseManError.Visible = true; lb_ChooseManError.BringToFront(); } else if (lst_Modules.Items.Count > 1) { lb_ChooseManError.Text = "Please Choose only one Item"; lb_ChooseManError.Visible = true; lb_ChooseManError.BringToFront(); lst_Modules.ClearSelected(); } else { selectedCourse = (lst_Modules.SelectedItem as SelectValue).Value; lb_ChooseManError.Visible = false; GameCoding gameCoding = null; if (String.IsNullOrEmpty(tb_GroupMan.Text)) { lb_ChooseError.Text = "Please choose group"; lb_ChooseError.Visible = true; } else { gameCoding = gameCodingManager.LoadGameCoding(selectedCourse, tb_GroupMan.Text); UpdateStudentTakenCourses(gameCoding, selectedCourse); } if (lst_MoneyList.SelectedItem == null) { lb_ChooseManError.Text = "Please select from money list"; lb_ChooseManError.Visible = true; lb_ChooseManError.BringToFront(); } else { UpdateMoney(lst_MoneyList.SelectedValue.ToString()); } if (gameCoding != null) { UpdateToyReservation(gameCoding.Game); lb_ChooseManError.Text = "Successfully Added"; lb_ChooseManError.Visible = true; lb_ChooseManError.BringToFront(); clearallLists(); tbStudentName.Text = String.Empty; tb_Age.Text = String.Empty; tb_FingSearch.Text = String.Empty; tb_GroupMan.Text = String.Empty; tb_GroupName.Text = String.Empty; tb_MobileSearch.Text = String.Empty; tb_ParentNameShow.Text = String.Empty; tb_StudentMobile.Text = String.Empty; if (cb_Branch.Items.Count != 0) { cb_Branch.Items.Clear(); } if (lst_KidsNames.Items.Count != 0) { lst_KidsNames.Items.Clear(); } if (lst_groupName.Items.Count != 0) { lst_groupName.Items.Clear(); } int i = 0; int gpIndexToRemove = -1; for (i = 0; i < runningGroups.Count; i++) { Group group = runningGroups[i]; if (group.ageRange.ID == gameCoding.AgeRange.ID) { gpIndexToRemove = i; } } if (gpIndexToRemove != -1) { runningGroups.RemoveAt(gpIndexToRemove); } } } }