private void deleteWorkedPlacesBtn_Click(object sender, EventArgs e) { int selectedrowindex = workedPlacesGridView.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = workedPlacesGridView.Rows[selectedrowindex]; WorkedPlace wp; try { wp = new WorkedPlace(Convert.ToString(selectedRow.Cells[0].Value), Convert.ToString(selectedRow.Cells[1].Value), Convert.ToString(selectedRow.Cells[2].Value), Convert.ToString(selectedRow.Cells[3].Value)); } catch { return; } try { CoacherController.DeleteWorkedPlace(wp); workedPlacesGridView.DataSource = CoacherController.GetWorkedPlaces(member.AthleticId); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void LoadData() { coursesTable.DataSource = CoacherController.GetCourses(member.AthleticId, CoacherCourseType.All); workedPlacesGridView.DataSource = CoacherController.GetWorkedPlaces(member.AthleticId); internationalStudentDataGridView.DataSource = CoacherController.GetForignStudents(member.AthleticId, StudentSelectType.Under_Coacher); nationalStudentGridView.DataSource = CoacherController.GetLocalStudents(member.AthleticId, StudentSelectType.Under_Coacher); }
private void addPlacesBtn_Click(object sender, EventArgs e) { String sDate = startedDatePicker.Text; String eDate = endDatePicker.Text; try { if (workedPlaceText.Text != "") { string[] dateformat = sDate.Split('/'); sDate = dateformat[2] + "-" + dateformat[0] + "-" + dateformat[1]; dateformat = eDate.Split('/'); eDate = dateformat[2] + "-" + dateformat[0] + "-" + dateformat[1]; CoacherController.AddWorkedPlaces(new WorkedPlace(workedPlaceText.Text, sDate, eDate, IdText.Text)); MessageBox.Show("Data added success!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); c.LoadData(); workedPlaceText.Clear(); } else { MessageBox.Show("Complete required fields! ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CoacherManageForm_Load(object sender, EventArgs e) { try { instructorLevelText.Text = CoacherController.SearchCoacher(member.AthleticId); LoadData(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
private void deleteNationalStudentBtn_Click(object sender, EventArgs e) { int selectedrowindex = nationalStudentGridView.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = nationalStudentGridView.Rows[selectedrowindex]; try { CoacherController.DeleteLocalStudent(Convert.ToString(selectedRow.Cells[0].Value), member.AthleticId); nationalStudentGridView.DataSource = CoacherController.GetLocalStudents(member.AthleticId, StudentSelectType.Under_Coacher); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void deleteCourseBtn_Click(object sender, EventArgs e) { int selectedrowindex = coursesTable.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = coursesTable.Rows[selectedrowindex]; try { CoacherController.DeleteCourses(Convert.ToString(selectedRow.Cells[0].Value), Convert.ToString(selectedRow.Cells[1].Value), Convert.ToString(selectedRow.Cells[3].Value), member.AthleticId); coursesTable.DataSource = CoacherController.GetCourses(member.AthleticId, CoacherCourseType.All); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void addStudentBtn_Click(object sender, EventArgs e) { try { ForignStudent fs = new ForignStudent(nameText.Text, countryCombo.SelectedItem.ToString(), beltText.Text, id); CoacherController.AddForignStudent(fs); MessageBox.Show("Data added success!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); c.LoadData(); nameText.Clear(); beltText.Clear(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void addBtn_Click(object sender, EventArgs e) { try { String date = dateTimePicker.Text; string[] dateformat = date.Split('/'); date = dateformat[2]; CoacherController.AddCourses(new Course(countryComboBox.SelectedItem.ToString(), courseNameTextBox.Text, venueTextBox.Text, discriptionTextBox.Text, date, id)); MessageBox.Show("Data added success!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); c.LoadData(); courseNameTextBox.Clear(); venueTextBox.Clear(); discriptionTextBox.Clear(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void updateBtn_Click(object sender, EventArgs e) { try { if (instructorLevelText.Text == "") { CoacherController.AddNewCoacher(instructorLevelText.Text, member.AthleticId); MessageBox.Show("Coacher added success!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { CoacherController.UpdateCoacher(instructorLevelText.Text, member.AthleticId); MessageBox.Show("Coacher updated!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void addNationalStudentBtn_Click(object sender, EventArgs e) { if (student != null) { try { CoacherController.AddLocalStudent(student.AthleticId, member.AthleticId); MessageBox.Show("Student added success!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } try { nationalStudentGridView.DataSource = CoacherController.GetLocalStudents(member.AthleticId, StudentSelectType.Under_Coacher); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }