예제 #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!!!");
                }
            }
        }
예제 #2
0
        public ReportDetailForm(ClassDTO _class)
        {
            InitializeComponent();
            SignupDAL signupDAL = new SignupDAL();

            signupDAL.ConnectToDatabase();
            List <SignupDTO> signupDTOs = signupDAL.GetAllSignupClass(_class.ClassId);

            dgvReport.DataSource = signupDTOs;
            ProgramDAL programDAL = new ProgramDAL();

            programDAL.ConnectToDatabase();
            TotalFee       = (programDAL.GetProgram(_class.ProgramId).Fee *signupDTOs.Count).ToString();
            labelType.Text = "Tổng số tiền thu được (USD): ";
            labelInfo.Text = TotalFee;
        }
예제 #3
0
        public StudentReportForm(StudentDTO _studentDTO)
        {
            InitializeComponent();

            string            TotalFee = "";
            List <StudentDTO> a        = new List <StudentDTO>();

            a.Add(_studentDTO);
            SignupDAL signupDAL = new SignupDAL();

            signupDAL.ConnectToDatabase();
            List <SignupDTO> signupDTOs = signupDAL.GetAllSignupStudent(_studentDTO.StudentId);


            //DataTable dt = new DataTable();
            //dt.Columns.Add("StudentId", typeof(string));
            //dt.Columns.Add("StudentName", typeof(string));
            //dt.Columns.Add("StudentMail", typeof(string));
            //dt.Columns.Add("StudentAddress", typeof(string));
            //dt.Columns.Add("StudentPhone", typeof(string));
            //dt.Columns.Add("StudentBirthDate", typeof(DateTime));
            //DataRow row = dt.NewRow();
            //row["StudentId"] = _studentDTO.StudentId;
            //row["StudentName"] = _studentDTO.StudentName;
            //row["StudentMail"] = _studentDTO.StudentMail;
            //row["StudentAddress"] = _studentDTO.StudentAddress;
            //row["StudentPhone"] = _studentDTO.StudentPhone;
            //row["StudentBirthDate"] = _studentDTO.StudentBirthDate;
            //dt.Rows.Add(row);
            //DataSet ds = new DataSet();
            //ds.Tables.Add(dt);
            //StudentInfoReport1.SetDataSource(ds);

            ((TextObject)StudentInfoReport1.Section4.ReportObjects["txtId"]).Text        = "Mã: " + _studentDTO.StudentId;
            ((TextObject)StudentInfoReport1.Section4.ReportObjects["txtName"]).Text      = "Tên: " + _studentDTO.StudentName;
            ((TextObject)StudentInfoReport1.Section4.ReportObjects["txtMail"]).Text      = "Địa chỉ mail: " + _studentDTO.StudentMail;
            ((TextObject)StudentInfoReport1.Section4.ReportObjects["txtAddress"]).Text   = "Địa chỉ: " + _studentDTO.StudentAddress;
            ((TextObject)StudentInfoReport1.Section4.ReportObjects["txtPhone"]).Text     = "Số điện thoại: " + _studentDTO.StudentPhone;
            ((TextObject)StudentInfoReport1.Section4.ReportObjects["txtBirthDate"]).Text = "Ngày sinh: " + _studentDTO.StudentBirthDate.ToLongDateString();


            TotalFee = (250 * signupDTOs.Count).ToString();
            ((TextObject)StudentInfoReport1.Section4.ReportObjects["txtMoney"]).Text = "Tổng số tiền đã đóng (USD): " + TotalFee;
            crystalReportViewerStudent.ReportSource = StudentInfoReport1;
            crystalReportViewerStudent.Refresh();
            crystalReportViewerStudent.RefreshReport();
        }
예제 #4
0
 private void btnConfirm_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow item in dgvListStudent.Rows)
     {
         if ((Convert.ToBoolean(item.Cells[0].Value) == true))
         {
             string    studentId = item.Cells[1].Value.ToString();
             SignupDAL signupDAL = new SignupDAL();
             signupDAL.ConnectToDatabase();
             if (signupDAL.DeleteSignup(studentId, classId, "Joined"))
             {
                 MessageBox.Show(" Xoá thành công!!!");
                 this.Close();
             }
         }
     }
 }
예제 #5
0
        public ReportDetailForm(StudentDTO _student)
        {
            int fees = 0;

            InitializeComponent();

            List <StudentDTO> a = new List <StudentDTO>();

            a.Add(_student);
            dgvReport.DataSource = a;
            SignupDAL signupDAL = new SignupDAL();

            signupDAL.ConnectToDatabase();
            List <SignupDTO> signupDTOs = signupDAL.GetAllSignupStudent(_student.StudentId);

            TotalFee       = (250 * signupDTOs.Count).ToString();
            labelType.Text = "Tổng số tiền đã đóng (USD): ";
            labelInfo.Text = TotalFee;
        }
예제 #6
0
        public DeleteStudentToClassForm(string _classId, String nameClass)
        {
            InitializeComponent();
            InitOfficialStudentData();
            classId  = _classId;
            lb3.Text = "Xoá học viên khỏi lớp: " + nameClass;
            SignupDAL studentDAL = new SignupDAL();

            studentDAL.ConnectToDatabase();
            List <SignupDTO> studentDTOs = studentDAL.GetAllSignupClass(nameClass);

            dgvListStudent.DataSource = studentDTOs;
            DataGridViewCheckBoxColumn deleteConfirm = new DataGridViewCheckBoxColumn()
            {
                HeaderText = "Delete"
            };

            dgvListStudent.Columns.Add(deleteConfirm);
        }
예제 #7
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //xoa lop hoc
            //if (this.dgvListClass.SelectedRows.Count > 0)
            //{
            //    ClassDAL classDAL = new ClassDAL();
            //    classDAL.ConnectToDatabase();
            //    ClassDTO currentObject = (ClassDTO)dgvListClass.CurrentRow.DataBoundItem;
            //    if(classDAL.DeleteClass(currentObject.ClassId))
            //    {
            //        classDAL = new ClassDAL();
            //        classDAL.ConnectToDatabase();
            //        dgvListClass.DataSource = classDAL.GetAllClass();
            //        dgvListClass.Update();
            //        dgvListClass.Refresh();
            //    }
            //}
            //DeleteClassForm f = new DeleteClassForm();
            //this.Hide();
            //f.ShowDialog();
            //this.Show();
            ClassDAL  classDAL  = new ClassDAL();
            SignupDAL signupDAL = new SignupDAL();

            classDAL.ConnectToDatabase();
            ClassDTO currentObject = (ClassDTO)dgvListClass.CurrentRow.DataBoundItem;

            nameClass = currentObject.ClassId.ToUpperInvariant();
            DialogResult dialogResult = MessageBox.Show("Bạn có chắc xoá lớp học: " + nameClass, "Thông báo", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                signupDAL.DeleteSignup(nameClass);
                classDAL.DeleteClass(nameClass);
                MessageBox.Show("Xoá lớp học thành công!!!");
                this.Close();
                ClassForm f = new ClassForm();
                f.Show();
            }

            ;
        }
예제 #8
0
        public ClassReportForm(ClassDTO _classDTO)
        {
            InitializeComponent();
            ((TextObject)ClassInfoReport1.Section4.ReportObjects["txtClassId"]).Text   = "Mã lớp: " + _classDTO.ClassId;
            ((TextObject)ClassInfoReport1.Section4.ReportObjects["txtClassName"]).Text = "Tên lớp: " + _classDTO.ClassName;
            ((TextObject)ClassInfoReport1.Section4.ReportObjects["txtStartHour"]).Text = "Giờ học: " + _classDTO.StartHour;
            ((TextObject)ClassInfoReport1.Section4.ReportObjects["txtProgramId"]).Text = "Mã chương trình học: " + _classDTO.ProgramId;
            ((TextObject)ClassInfoReport1.Section4.ReportObjects["txtStartDate"]).Text = "Ngày bắt đầu: " + _classDTO.StartDate.ToLongDateString();
            ((TextObject)ClassInfoReport1.Section4.ReportObjects["txtEndDate"]).Text   = "Ngày kết thúc: " + _classDTO.EndDate.ToLongDateString();

            SignupDAL signupDAL = new SignupDAL();

            signupDAL.ConnectToDatabase();
            List <SignupDTO> signupDTOs = signupDAL.GetAllSignupClass(_classDTO.ClassId);
            ProgramDAL       programDAL = new ProgramDAL();

            programDAL.ConnectToDatabase();
            string TotalFee = (programDAL.GetProgram(_classDTO.ProgramId).Fee *signupDTOs.Count).ToString();

            ((TextObject)ClassInfoReport1.Section4.ReportObjects["txtStudentCount"]).Text = "Tổng số học sinh: " + signupDTOs.Count.ToString();
            ((TextObject)ClassInfoReport1.Section4.ReportObjects["txtMoney"]).Text        = "Tổng số tiền thu được (USD):  " + TotalFee;
        }