Пример #1
0
 private void btn_bienLai_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (isAdminDangNhap || isModDangNhap || isUserDangNhap)
     {
         Loading.ShowLoading();
         Form frm = this.CheckExist(typeof(frmLapBienLai));
         if (frm != null)
         {
             frm.Activate();
         }
         else
         {
             frmLapBienLai f = new frmLapBienLai();
             f.MdiParent         = this;
             f.Dock              = DockStyle.Fill;
             f.btn_luuBL.Enabled = false;
             f.btn_thoat.Visible = false;
             f.isSave            = true;
             f.Show();
         }
         Loading.HideLoading();
     }
     else
     {
         XtraMessageBox.Show("Không đủ quyền để truy cập", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
 }
Пример #2
0
        private void btn_luu_Click(object sender, EventArgs e)
        {
            if (lke_khoaHoc.Text == "" || lke_lopHoc.Text == "")
            {
                XtraMessageBox.Show("Chưa điền đầy đủ thông tin!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (hvDTO != null)
                {
                    GetDetail();

                    int kq = hvBUS.AddHV(hvDTO);
                    if (kq == 1)
                    {
                        frmLapBienLai f = new frmLapBienLai();
                        XtraMessageBox.Show(string.Format("Thêm khóa học cho học viên mã {0} thành công!", hvDTO.MSHV), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        f.lb_mahv.Text       = this.txt_mshv.Text.Trim();
                        f.lb_tenhv.Text      = this.txt_ho.Text + ' ' + this.txt_ten.Text;
                        f.lb_gioiTinh.Text   = this.cbo_gioiTinh.Text.Trim();
                        f.lb_sdt.Text        = this.txt_sdt.Text.Trim();
                        f.lb_diaChi.Text     = this.txt_diaChi.Text.Trim();
                        f.lb_ngaySinh.Text   = this.dt_ngaySinh.Text.Trim();
                        f.lb_email.Text      = this.txt_email.Text.Trim();
                        f.lb_maLop.Text      = this.lke_lopHoc.Text.Trim();
                        f.lb_khoahoc.Text    = this.lke_khoaHoc.Text.Trim();
                        f.lb_tenkh.Text      = this.lke_khoaHoc.GetColumnValue("TenKH").ToString().Trim();
                        f.lb_hocPhi.Text     = this.lke_khoaHoc.GetColumnValue("HocPhi").ToString().Trim();
                        f.lb_ngayBatDau.Text = DateTime.Parse(this.lke_khoaHoc.GetColumnValue("NgayBatDau").ToString()).ToShortDateString();
                        f.lb_lichHoc.Text    = this.lke_lopHoc.GetColumnValue("LichHoc").ToString().Trim();
                        f.lb_thoiGian.Text   = this.lke_lopHoc.GetColumnValue("GioBatDau").ToString().Trim();
                        f.lb_manv.Text       = this.lke_lopHoc.GetColumnValue("MaNV").ToString().Trim();
                        //f.lb_nguoiLapBL.Text = "";

                        f.dgcontrol_bienLai.Enabled = false;
                        f.btn_thoat.Visible         = true;
                        f.BackColor        = Color.FromArgb(224, 224, 224);
                        f.FormBorderEffect = FormBorderEffect.Shadow;

                        Loading.ShowReportLoading();
                        f.ShowDialog();
                        Loading.HideLoading();

                        ucQLHV_DanhSach.LoadDSHV();
                        this.Close();
                    }
                    else
                    {
                        XtraMessageBox.Show("Học viên đang học khóa học này!!\n Vui lòng chọn khóa học khác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
Пример #3
0
        private void btn_luu_Click(object sender, EventArgs e)
        {
            if (txt_ho.Text == "" || txt_ten.Text == "" ||
                cbo_gioiTinh.Text == "" || dt_ngaySinh.EditValue == null ||
                txt_sdt.Text == "" || txt_diaChi.Text == "" ||
                lke_khoaHoc.Text == "" || lke_lopHoc.Text == "")
            {
                XtraMessageBox.Show("Chưa điền đầy đủ thông tin!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (dt_ngaySinh.DateTime.Year >= DateTime.Now.Year)
                {
                    XtraMessageBox.Show("Năm sinh không được lớn hơn hoặc bằng năm hiện tại!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    if (Math.Abs(dt_ngaySinh.DateTime.Year - DateTime.Now.Year) < 6)
                    {
                        XtraMessageBox.Show("Học viên phải trên 6 tuổi!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        if (txt_sdt.Text.Length < 10)
                        {
                            XtraMessageBox.Show("Số điện thoại phải đủ 10 số!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            if (!txt_sdt.Text.StartsWith("0"))
                            {
                                XtraMessageBox.Show("Số điện thoại phải bắt đầu bằng số 0!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                            else
                            {
                                if (Utilities.IsValidEmail(txt_email.Text.Trim()) == false)
                                {
                                    XtraMessageBox.Show("Địa chỉ email sai định dạng!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                }
                                else
                                {
                                    if (hvDTO != null)
                                    {
                                        GetDetail();

                                        int kq = hvBUS.AddHV(hvDTO);
                                        if (kq == 1)
                                        {
                                            frmLapBienLai f = new frmLapBienLai();
                                            XtraMessageBox.Show(string.Format("Thêm học viên mã {0} thành công!", hvDTO.MSHV), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                            f.lb_mahv.Text       = this.txt_mshv.Text.Trim();
                                            f.lb_tenhv.Text      = this.txt_ho.Text + ' ' + this.txt_ten.Text;
                                            f.lb_gioiTinh.Text   = this.cbo_gioiTinh.Text.Trim();
                                            f.lb_sdt.Text        = this.txt_sdt.Text.Trim();
                                            f.lb_diaChi.Text     = this.txt_diaChi.Text.Trim();
                                            f.lb_ngaySinh.Text   = this.dt_ngaySinh.Text.Trim();
                                            f.lb_email.Text      = this.txt_email.Text.Trim();
                                            f.lb_maLop.Text      = this.lke_lopHoc.Text.Trim();
                                            f.lb_khoahoc.Text    = this.lke_khoaHoc.Text.Trim();
                                            f.lb_tenkh.Text      = this.lke_khoaHoc.GetColumnValue("TenKH").ToString().Trim();
                                            f.lb_hocPhi.Text     = this.lke_khoaHoc.GetColumnValue("HocPhi").ToString().Trim();
                                            f.lb_ngayBatDau.Text = DateTime.Parse(this.lke_khoaHoc.GetColumnValue("NgayBatDau").ToString()).ToShortDateString();
                                            f.lb_lichHoc.Text    = this.lke_lopHoc.GetColumnValue("LichHoc").ToString().Trim();
                                            f.lb_thoiGian.Text   = this.lke_lopHoc.GetColumnValue("GioBatDau").ToString().Trim();
                                            f.lb_manv.Text       = this.lke_lopHoc.GetColumnValue("MaNV").ToString().Trim();
                                            //f.lb_nguoiLapBL.Text = "";

                                            f.dgcontrol_bienLai.Enabled = false;
                                            f.btn_thoat.Visible         = true;
                                            f.BackColor        = Color.FromArgb(224, 224, 224);
                                            f.FormBorderEffect = FormBorderEffect.Shadow;

                                            Loading.ShowReportLoading();
                                            f.ShowDialog();
                                            Loading.HideLoading();

                                            ucQLHV_DanhSach.LoadDSHV();
                                            RefreshTextBox();
                                        }
                                        else
                                        {
                                            XtraMessageBox.Show("Thêm không thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }