Example #1
0
        //      Save Student Tab

        private void saveButton_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(nameStudentTextbox.Text) || String.IsNullOrEmpty(fatherNameStudentTextbox.Text) ||
                String.IsNullOrEmpty(requiredDarjaStudentCombobox.Text) || String.IsNullOrEmpty(takmeelDateCombobox.Text) ||
                String.IsNullOrEmpty(takmeelMonthCombobox.Text) || String.IsNullOrEmpty(takmeelYearCombobox.Text))
            {
                if (String.IsNullOrEmpty(nameStudentTextbox.Text))
                {
                    errorProvider.SetError(nameStudentTextbox, "طالبعلم کا نام ضروری ہے۔");
                }

                if (String.IsNullOrEmpty(fatherNameStudentTextbox.Text))
                {
                    errorProvider.SetError(fatherNameStudentTextbox, "والد کا نام ضروری ہے۔");
                }

                if (String.IsNullOrEmpty(requiredDarjaStudentCombobox.Text))
                {
                    errorProvider.SetError(requiredDarjaStudentCombobox, "درجہ ضروری ہے۔");
                }

                if (String.IsNullOrEmpty(takmeelDateCombobox.Text) || String.IsNullOrEmpty(takmeelMonthCombobox.Text) ||
                    String.IsNullOrEmpty(takmeelYearCombobox.Text))
                {
                    errorProvider.SetError(takmeelDateCombobox, "تاریخ تکمیل ضروری ہے۔");
                }
            }
            else
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    Student newStudent = getStudentFromForm();
                    DataManipulation.addStudent(newStudent, false);

                    DakhlaCardReport rpt = new DakhlaCardReport();
                    rpt.Student = newStudent;

                    LandingPage newPage = new LandingPage();
                    this.Hide();
                    newPage.Show();
                    rpt.Show();
                    Cursor.Current = Cursors.Default;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                    Cursor.Current = Cursors.Default;
                }
            }
        }
Example #2
0
        private void updateButton_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(nameStudentTextbox.Text) || String.IsNullOrEmpty(fatherNameStudentTextbox.Text) ||
                String.IsNullOrEmpty(requiredDarjaStudentCombobox.Text) || String.IsNullOrEmpty(takmeelDateCombobox.Text) ||
                String.IsNullOrEmpty(takmeelMonthCombobox.Text) || String.IsNullOrEmpty(takmeelYearCombobox.Text))
            {
                if (String.IsNullOrEmpty(nameStudentTextbox.Text))
                {
                    errorProvider.SetError(nameStudentTextbox, "طالبعلم کا نام ضروری ہے۔");
                }

                if (String.IsNullOrEmpty(fatherNameStudentTextbox.Text))
                {
                    errorProvider.SetError(fatherNameStudentTextbox, "والد کا نام ضروری ہے۔");
                }

                if (String.IsNullOrEmpty(requiredDarjaStudentCombobox.Text))
                {
                    errorProvider.SetError(requiredDarjaStudentCombobox, "درجہ ضروری ہے۔");
                }

                if (String.IsNullOrEmpty(takmeelDateCombobox.Text) || String.IsNullOrEmpty(takmeelMonthCombobox.Text) ||
                    String.IsNullOrEmpty(takmeelYearCombobox.Text))
                {
                    errorProvider.SetError(takmeelDateCombobox, "تاریخ تکمیل ضروری ہے۔");
                }
            }
            else
            {
                try
                {
                    Student newStudent = getStudentFromForm();
                    DataManipulation.editStudent(newStudent);
                    LandingPage newPage = new LandingPage();
                    newPage.Show();
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Example #3
0
        private void deleteStudentButton_Click(object sender, EventArgs e)
        {
            List <string> dakhlaNumbers = new List <string>();

            foreach (DataGridViewRow row in studentGridView.SelectedRows)
            {
                dakhlaNumbers.Add(row.Cells[1].Value.ToString());
            }

            DialogResult confirm = MessageBox.Show("Are you sure, You want to delete students?", "Delete Student", MessageBoxButtons.YesNo);

            if (confirm == DialogResult.Yes)
            {
                DataManipulation.deleteStudent(dakhlaNumbers);
                LandingPage newPage = new LandingPage();
                this.Hide();
                newPage.Show();
                newPage.mainTab.SelectedIndex = 2;
                //searchStudentButton.PerformClick();
            }
        }