Ejemplo n.º 1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            StudentDAL potentialStudentDAL = new StudentDAL();
            SignupDAL  sgDAL = new SignupDAL();

            potentialStudentDAL.ConnectToDatabase();
            StudentDTO   currentObject = (StudentDTO)dgvListStudent.CurrentRow.DataBoundItem;
            DialogResult rs            = MessageBox.Show("Bạn muốn xoá học viên: " + currentObject.StudentId, "Thông báo", MessageBoxButtons.YesNo);

            if (rs == DialogResult.Yes)
            {
                try
                {
                    if (sgDAL.DeleteSignupStudent(currentObject.StudentId) && potentialStudentDAL.DeleteStudent(currentObject.StudentId))
                    {
                        MessageBox.Show("Xoá học viên thành công!!!");
                        this.Close();
                        OfficalStudentForm f = new OfficalStudentForm();
                        f.Show();
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Xoá học viên thất bại!!!");
                }
            }
        }
Ejemplo n.º 2
0
        public AddOfficalStudentForm()
        {
            InitializeComponent();
            StudentDAL studentDAL = new StudentDAL();

            studentDAL.ConnectToDatabase();
            textboxStudentID.Text = ID_CHAR + (studentDAL.GetAllStudent().Count + 1).ToString();
        }
Ejemplo n.º 3
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            StudentDTO currentObject       = (StudentDTO)dgvListStudent.CurrentRow.DataBoundItem;
            StudentDAL potentialStudentDAL = new StudentDAL();

            potentialStudentDAL.ConnectToDatabase();
            potentialStudentDAL.DeleteStudent(currentObject.StudentId);
        }
Ejemplo n.º 4
0
        void InitStudentData()
        {
            StudentDAL studentDAL = new StudentDAL();

            studentDAL.ConnectToDatabase();
            List <StudentDTO> studentDTOs = studentDAL.GetAllStudent();

            dgvListStudent.DataSource = studentDTOs;
        }
Ejemplo n.º 5
0
        public AddPotentialStudentForm()
        {
            string time = DateTime.Now.ToString("yyMMddhmmsstt");

            InitializeComponent();
            StudentDAL studentDAL = new StudentDAL();

            studentDAL.ConnectToDatabase();
            textboxPotentialStudentID.Text = ID_CHAR + time;
        }
Ejemplo n.º 6
0
        void LoadComboBoxStudent()
        {
            StudentDAL studentDAL = new StudentDAL();

            studentDAL.ConnectToDatabase();
            List <StudentDTO> classDTOs = studentDAL.GetAllStudent();

            comboBoxListStudent.DataSource    = classDTOs;
            comboBoxListStudent.DisplayMember = "StudentName";
            comboBoxListStudent.ValueMember   = "StudentId";
        }
Ejemplo n.º 7
0
        void InitOfficialStudentData()
        {
            StudentDAL studentDAL = new StudentDAL();

            studentDAL.ConnectToDatabase();
            List <StudentDTO> studentDTOs = studentDAL.GetAllStudent();

            dgvListStudent.DataSource = studentDTOs;
            DataGridViewCheckBoxColumn addConfirm = new DataGridViewCheckBoxColumn()
            {
                HeaderText = "Add"
            };

            dgvListStudent.Columns.Add(addConfirm);
        }
Ejemplo n.º 8
0
        private void btConfim_Click(object sender, EventArgs e)
        {
            StudentDAL studentDAL = new StudentDAL();

            studentDAL.ConnectToDatabase();
            try
            {
                if ((studentDAL.InsertStudent(textboxStudentID.Text, textboxStudentName.Text, textboxStudentMail.Text, textboxStudentAddress.Text, textboxStudentPhoneNumber.Text, birthDateTimePicker.Value)) &&
                    textboxStudentName.Text != "")
                {
                    MessageBox.Show("Thêm học viên thành công!!!");
                    this.Close();
                    OfficalStudentForm f = new OfficalStudentForm();
                    f.Show();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Thêm học viên thất bại, vui lòng kiểm tra lại dữ liệu!!!");
            }
        }
Ejemplo n.º 9
0
        private void btConfim_Click(object sender, EventArgs e)
        {
            StudentDAL studentDAL = new StudentDAL();

            studentDAL.ConnectToDatabase();
            try
            {
                StudentDTO studentDTO = new StudentDTO(textboxStudentID.Text, textboxStudentName.Text, textboxStudentMail.Text, textboxStudentAddress.Text, textboxStudentPhoneNumber.Text, birthDateTimePicker.Value);
                if (studentDAL.UpdateStudent(studentDTO))
                {
                    MessageBox.Show("Thay đổi thông tin học viên thành công!!!");
                    this.Close();
                    OfficalStudentForm f = new OfficalStudentForm();
                    f.Show();
                }
            }
            catch
            {
                MessageBox.Show("Thay đổi thất bại, kiểm tra lại thông tin!!!");
            }
        }