Ejemplo n.º 1
0
        private void lecSubmit_Click(object sender, EventArgs e)
        {
            if (idtxt.Text == "")
            {
                MessageBox.Show("Please fill ID");
                return;
            }
            if (idtxt.Text.Length != 8)
            {
                MessageBox.Show("Length of ID must be 8 charcters");
                return;
            }
            if (nametxt.Text == "")
            {
                MessageBox.Show("Please fill Name");
                return;
            }
            if (emailtxt.Text == "")
            {
                MessageBox.Show("Please fill Email");
                return;
            }
            if (addresstxt.Text == "")
            {
                MessageBox.Show("Please fill Address");
                return;
            }
            if (deptxt.Text == "")
            {
                MessageBox.Show("Please fill Department of lecturer");
                return;
            }
            Lecturer newLec = new Lecturer();

            newLec.Id      = idtxt.Text;
            newLec.Name    = nametxt.Text;
            newLec.Address = addresstxt.Text;
            if (!CheckValidation.checkEmail(emailtxt.Text))
            {
                MessageBox.Show("Please enter a valid email!");
                return;
            }
            var result = DataProvider.Instance.findLecturerById(idtxt.Text);

            if (result != null)
            {
                MessageBox.Show("Id is not available!");
                return;
            }
            newLec.Email       = emailtxt.Text;
            newLec.DateOfBirth = DoBtxt.Value.ToString("dd-MM-yyyy");
            newLec.Department  = deptxt.Text;
            DataProvider.Instance.insertLecturer(newLec);
            this.Close();
        }
Ejemplo n.º 2
0
        private void submitStu_Click(object sender, EventArgs e)
        {
            if (IDCombobox.SelectedIndex < 0)
            {
                MessageBox.Show("Please select Standard header for ID!");
                return;
            }
            if (Idtxt.Text == "")
            {
                MessageBox.Show("Please fill ID");
                return;
            }
            if (Nametxt.Text == "")
            {
                MessageBox.Show("Please fill Name");
                return;
            }
            if (Emailtxt.Text == "")
            {
                MessageBox.Show("Please fill Email");
                return;
            }
            if (Addresstxt.Text == "")
            {
                MessageBox.Show("Please fill Address");
                return;
            }
            if (Batchtxt.Text == "")
            {
                MessageBox.Show("Please fill Batch of student");
                return;
            }
            Student newStu = new Student();

            newStu.Id      = IDCombobox.Text + Idtxt.Text;
            newStu.Name    = Nametxt.Text;
            newStu.Address = Addresstxt.Text;
            if (!CheckValidation.checkEmail(Emailtxt.Text))
            {
                MessageBox.Show("Please enter a valid email!");
                return;
            }
            newStu.Email       = Emailtxt.Text;
            newStu.DateOfBirth = DoBtxt.Value.ToString("dd-MM-yyyy");
            newStu.Batch       = Batchtxt.Text;
            var result = DataProvider.Instance.findStudentById(IDCombobox.Text + Idtxt.Text);

            if (result != null)
            {
                MessageBox.Show("Id is not available!");
                return;
            }
            DataProvider.Instance.insertStudent(newStu);
            this.Close();
        }
Ejemplo n.º 3
0
        private void updateBtn_Click(object sender, EventArgs e)
        {
            if (nametxt.Text == "")
            {
                MessageBox.Show("Please fill Name");
                return;
            }
            if (emailtxt.Text == "")
            {
                MessageBox.Show("Please fill Email");
                return;
            }
            if (addresstxt.Text == "")
            {
                MessageBox.Show("Please fill Address");
                return;
            }
            if (batchtxt.Text == "")
            {
                MessageBox.Show("Please fill Batch of student");
                return;
            }
            if (!CheckValidation.checkEmail(emailtxt.Text))
            {
                MessageBox.Show("Please enter a valid email!");
                return;
            }

            Student student = new Student();

            student.Id          = idtxt.Text;
            student.Name        = nametxt.Text;
            student.Email       = emailtxt.Text;
            student.Address     = addresstxt.Text;
            student.Batch       = batchtxt.Text;
            student.DateOfBirth = dobtxt.Value.ToString("dd-MM-yyyy");
            DataProvider.Instance.updateStudent(student);
            this.Close();
        }
Ejemplo n.º 4
0
        private void updateBtn_Click(object sender, EventArgs e)
        {
            if (nametxt.Text == "")
            {
                MessageBox.Show("Please fill Name");
                return;
            }
            if (emailtxt.Text == "")
            {
                MessageBox.Show("Please fill Email");
                return;
            }
            if (addresstxt.Text == "")
            {
                MessageBox.Show("Please fill Address");
                return;
            }
            if (deptxt.Text == "")
            {
                MessageBox.Show("Please fill Department of lecturer");
                return;
            }
            if (!CheckValidation.checkEmail(emailtxt.Text))
            {
                MessageBox.Show("Please enter a valid email!");
                return;
            }
            Lecturer lecturer = new Lecturer();

            lecturer.Id          = idtxt.Text;
            lecturer.Name        = nametxt.Text;
            lecturer.DateOfBirth = dobtxt.Value.ToString("dd-MM-yyyy");
            lecturer.Address     = addresstxt.Text;
            lecturer.Email       = emailtxt.Text;
            lecturer.Department  = deptxt.Text;
            DataProvider.Instance.updateLecturer(lecturer);
            this.Close();
        }