示例#1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dialog = MessageBox.Show("Bạn có chắc muốn xóa trẻ này không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dialog == DialogResult.Yes)
                {
                    TreBLL.XoaTre(maTre);
                    MessageBox.Show("Đã xóa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    txtDiaChi.Text    = "";
                    txtDienThoai.Text = "";
                    txtHoTen.Text     = "";
                    txtHoTenBo.Text   = "";
                    txtHoTenMe.Text   = "";
                    dtNgaySinh.ResetText();

                    GetDataGridView();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Thông báo");
            }
        }
示例#2
0
 private void Init()
 {
     txtMaPhieu.Text       = PhieuTiepNhanBLL.GenMaPhieu().ToString();
     txtMaHocSinh.Text     = TreBLL.GenMaTre().ToString();
     txtNgayTiepNhan.Text  = DateTime.Now.ToShortDateString();
     txtNguoiTiepNhan.Text = TaiKhoanBLL.GetTenNguoiDung(username);
 }
示例#3
0
        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            try
            {
                Tre tre = new Tre();

                tre.MaTre    = maTre;
                tre.HoTenTre = txtHoTen.Text;

                if (rdoNam.Checked)
                {
                    tre.GioiTinh = "Nam";
                }
                else
                {
                    tre.GioiTinh = "Nu";
                }

                tre.NgaySinh = dtNgaySinh.Value;
                tre.HoTenCha = txtHoTenBo.Text;
                tre.HoTenMe  = txtHoTenMe.Text;
                tre.DiaChi   = txtDiaChi.Text;
                tre.SoDT     = txtDienThoai.Text;

                MessageBox.Show(tre.MaTre);

                TreBLL.CapNhatThongTinTre(tre);
                MessageBox.Show("Cập nhật thành công", "Thông báo");
                GetDataGridView();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Thông báo");
            }
        }
示例#4
0
        private void LayThongTinTre(string maTre)
        {
            int       gioiTinh;
            DataTable dt = TreBLL.LayThongTinTre(maTre);

            txtMaHocSinh.Text = dt.Rows[0]["MaTre"].ToString();
            txtHoTen.Text     = dt.Rows[0]["HoTenTre"].ToString();

            gioiTinh = Convert.ToInt32(dt.Rows[0]["GioiTinh"]);

            if (gioiTinh == 1)
            {
                rdbNam.Checked = true;
            }
            else
            {
                rdbNu.Checked = true;
            }

            dateNgaySinh.Value = Convert.ToDateTime(dt.Rows[0]["NgaySinh"].ToString());
            txtHoTenMe.Text    = dt.Rows[0]["HoTenMe"].ToString();
            txtHoTenCha.Text   = dt.Rows[0]["HoTenCha"].ToString();
            txtSDT.Text        = dt.Rows[0]["SDTLienLac"].ToString();
            txtDiaChi.Text     = dt.Rows[0]["DiaChi"].ToString();
        }
示例#5
0
        private void LoadDataGridView()
        {
            if (cboLop.SelectedItem == null)
            {
                dgvTre.DataSource = TreBLL.GetListTreTheoMaLop("");
            }
            else
            {
                dgvTre.DataSource = TreBLL.GetListTreTheoMaLop(
                    KeyHandle.GetKeyFromCombobox(cboLop.SelectedItem.ToString()));
            }

            dgvTre.Columns["HoTenTre"].DisplayIndex    = 1;
            dgvTre.Columns["NgaySinh"].DisplayIndex    = 2;
            dgvTre.Columns["GioiTinhCol"].DisplayIndex = 3;

            dgvTre.Columns["HoTenTre"].HeaderText    = "Họ tên trẻ";
            dgvTre.Columns["NgaySinh"].HeaderText    = "Ngày sinh";
            dgvTre.Columns["GioiTinhCol"].HeaderText = "Giới tính";

            dgvTre.Columns["HoTenTre"].Width    = 200;
            dgvTre.Columns["NgaySinh"].Width    = 120;
            dgvTre.Columns["GioiTinhCol"].Width = 80;

            string[] listProp = { "STT", "HoTenTre", "GioiTinhCol", "NgaySinh" };
            ControlFormat.DataGridViewFormat(dgvTre, listProp);

            dgvTre.ClearSelection();
            maTre = "";
            UpdateChartData();
        }
示例#6
0
        private void KhoiTaoHocPhi(string maTre, DateTime start, DateTime end)
        {
            List <ThangNam> listThangNam = DataHandle.GetThoiGianTrongKhoan(start, end);

            foreach (ThangNam tn in listThangNam)
            {
                TreBLL.KhoiTaoHocPhi(maTre, tn.thang, tn.nam);
            }
        }
示例#7
0
        private void GetDataGridView()
        {
            dgvTimKiem.DataSource = TreBLL.GetList();
            string[] columns = { "HoTenTre", "GioiTinh", "NgaySinh" };
            Utility.ControlFormat.DataGridViewFormat(dgvTimKiem, columns);

            /*dgvTimKiem.Columns[0].HeaderText = "Họ và tên";
            *  dgvTimKiem.Columns[1].HeaderText = "Ngày sinh";
            *  dgvTimKiem.Columns[2].HeaderText = "Giới tính";*/
        }
 private void LoadDataGridView()
 {
     dgvListTre.DataSource = TreBLL.GetListTreTheoLop(maLop);
     string[] listProp = { "CheckBox", "MaTre", "HoTenTre" };
     ControlFormat.DataGridViewFormat(dgvListTre, listProp);
     dgvListTre.Columns["MaTre"].HeaderText    = "Mã trẻ";
     dgvListTre.Columns["MaTre"].Width         = 150;
     dgvListTre.Columns["HoTenTre"].HeaderText = "Tên trẻ";
     dgvListTre.Columns["HoTenTre"].Width      = 250;
 }
示例#9
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtHoTen.Text.Length > 50 ||
                    txtHoTenCha.Text.Length > 50 ||
                    txtHoTenMe.Text.Length > 50 ||
                    txtDiaChi.Text.Length > 100)
                {
                    MessageBox.Show("Các trường họ tên không được quá dài (ít hơn 50 ký tự)", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (String.IsNullOrEmpty(txtHoTen.Text) ||
                    String.IsNullOrEmpty(txtHoTenCha.Text) ||
                    String.IsNullOrEmpty(txtHoTenMe.Text) ||
                    String.IsNullOrEmpty(txtDiaChi.Text) ||
                    String.IsNullOrEmpty(txtSDT.Text))
                {
                    MessageBox.Show("Phải nhập đầy đủ trưởng thông tin. Không có ghi rõ: 'Không có'", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if ((DateTime.Now - dateNgaySinh.Value).TotalDays <= 1095 || (DateTime.Now - dateNgaySinh.Value).TotalDays >= 2190)
                {
                    MessageBox.Show("Nhà trường chỉ nhận trẻ từ 3 đến 6 tuổi vào học", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                Tre tre = new Tre();

                tre.MaTre = maTre;
                tre.HoTen = txtHoTen.Text;

                if (rdbNam.Checked)
                {
                    tre.GioiTinh = (int)GioiTinh.Nam;
                }
                else
                {
                    tre.GioiTinh = (int)GioiTinh.Nu;
                }

                tre.NgaySinh  = dateNgaySinh.Value;
                tre.TenCha    = txtHoTenCha.Text;
                tre.TenMe     = txtHoTenMe.Text;
                tre.DiaChi    = txtDiaChi.Text;
                tre.DienThoai = txtSDT.Text;

                TreBLL.CapNhatThongTinTre(tre);
                MessageBox.Show("Cập nhật thành công", "Thông báo");
                loadDataGridView();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Cập nhật không thành công.\nHãy xem lại thông tin nhập", "Thông báo");
            }
        }
示例#10
0
 private void dgvKetQua_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex > -1)
     {
         txtHoTen.Text     = TreBLL.GetHoTen(maTre);
         txtCanNang.Text   = dgvKetQua.Rows[e.RowIndex].Cells["CanNang"].Value.ToString() + " kg";
         txtChieuCao.Text  = dgvKetQua.Rows[e.RowIndex].Cells["ChieuCao"].Value.ToString() + " cm";
         txtTinhTrang.Text = dgvKetQua.Rows[e.RowIndex].Cells["TheTrang"].Value.ToString();
         txtNgayKham.Text  = dgvKetQua.Rows[e.RowIndex].Cells["NgayKham"].Value.ToString();
     }
 }
示例#11
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (txtHoTen.Text.Length > 50 ||
                txtHoTenCha.Text.Length > 50 ||
                txtHoTenMe.Text.Length > 50 ||
                txtDiaChi.Text.Length > 100)
            {
                MessageBox.Show("Các trường họ tên không được quá dài (ít hơn 50 ký tự)", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (String.IsNullOrEmpty(txtHoTen.Text) ||
                String.IsNullOrEmpty(txtHoTenCha.Text) ||
                String.IsNullOrEmpty(txtHoTenMe.Text) ||
                String.IsNullOrEmpty(txtDiaChi.Text) ||
                String.IsNullOrEmpty(txtSDT.Text))
            {
                MessageBox.Show("Phải nhập đầy đủ trưởng thông tin. Không có ghi rõ: 'Không có'", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if ((DateTime.Now - dateNgaySinh.Value).TotalDays <= 1095 || (DateTime.Now - dateNgaySinh.Value).TotalDays >= 2190)
            {
                MessageBox.Show("Nhà trường chỉ nhận trẻ từ 3 đến 6 tuổi vào học", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            Tre hocsinhmoi = new Tre(txtMaHocSinh.Text, txtHoTen.Text,
                                     rdbNam.Checked == true ? (int)GioiTinh.Nam : (int)GioiTinh.Nu,
                                     Convert.ToDateTime(dateNgaySinh.Value.ToShortDateString()),
                                     txtHoTenCha.Text,
                                     txtHoTenMe.Text,
                                     txtDiaChi.Text,
                                     txtSDT.Text);
            string           ngaytiepnhan = DateTime.Now.ToString("dd-MM-yyyy");
            PhieuTiepNhanTre phieumoi     = new PhieuTiepNhanTre(txtMaHocSinh.Text, txtMaPhieu.Text, ngaytiepnhan, txtNguoiTiepNhan.Text);

            try
            {
                if (TreBLL.ThemTre(hocsinhmoi) && PhieuTiepNhanBLL.ThemPhieu(phieumoi))
                {
                    MessageBox.Show("Đã thêm trẻ thành công", "Thông báo", MessageBoxButtons.OK);
                    CleanInput();
                    loadDataGridView();
                }
                else
                {
                    MessageBox.Show("Lỗi khi thêm trẻ", "Thông báo", MessageBoxButtons.OK);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                MessageBox.Show("Vui lòng nhập đầy đủ thông tin cần thiết!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
示例#12
0
        private void KhoiTaoSucKhoe(List <string> listMatre, DateTime start, DateTime end)
        {
            List <ThangNam> listThangNam = DataHandle.GetThoiGianTrongKhoan(start, end);

            foreach (ThangNam tn in listThangNam)
            {
                foreach (string maTre in listMatre)
                {
                    TreBLL.KhoiTaoSucKhoe(maTre, tn.thang, tn.nam);
                }
            }
        }
示例#13
0
 private void GetDataGridViewDanhSachTre()
 {
     dgvListTre.DataSource = TreBLL.GetListTreTheoLop(cboLop.SelectedValue.ToString());
     string[] listProp = { "HoTenTre", "GioiTinh", "NgaySinh" };
     ControlFormat.DataGridViewFormat(dgvListTre, listProp);
     dgvListTre.Columns["HoTenTre"].HeaderText = "Họ tên trẻ";
     dgvListTre.Columns["HoTenTre"].Width      = 170;
     dgvListTre.Columns["GioiTinh"].HeaderText = "Giới tính";
     dgvListTre.Columns["GioiTinh"].Width      = 90;
     dgvListTre.Columns["NgaySinh"].HeaderText = "Ngày sinh";
     dgvListTre.Columns["NgaySinh"].Width      = 100;
 }
示例#14
0
        private void FillValue()
        {
            ReportParameter[] key    = new ReportParameter[3];
            ReportParameter   Nam    = new ReportParameter("Nam", nam.ToString());
            ReportParameter   NgayIn = new ReportParameter("NgayIn", DateTime.Today.ToShortTimeString());
            ReportParameter   TenTre = new ReportParameter("TenTre", TreBLL.GetHoTen(maTre));


            key[0] = NgayIn;
            key[1] = Nam;
            key[2] = TenTre;

            reportViewer1.LocalReport.SetParameters(key);
        }
示例#15
0
        public static decimal TinhHocPhiThangNay(HocPhi hocPhi, List <ChiTietHocPhi> list)
        {
            decimal tong        = 0;
            int     soNgayDiHoc = TreBLL.GetSoNgayDiHocTrongThang(hocPhi.MaTre, hocPhi.Thang, hocPhi.Nam);

            foreach (ChiTietHocPhi chiTiet in list)
            {
                DanhMucChiPhi danhMuc = DanhMucChiPhiBLL.GetInfoDanhMuc(chiTiet.MaDanhMuc);

                //cap nhat lai so tien trong list neu danh muc chi phi nay tinh tien theo so ngay di hoc
                tong += danhMuc.TinhTheoSoNgayDiHoc == 1 ? danhMuc.SoTien * soNgayDiHoc : chiTiet.SoTien;
            }

            return(tong);
        }
示例#16
0
 private void txtTimKiem_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (txtTimKiem.Text != "")
         {
             dgvTimKiem.DataSource = TreBLL.TreChuaCoLop(txtTimKiem.Text);
             labSoLuong.Text       = "Tìm được " + (dgvTimKiem.RowCount - 1).ToString() + " kết quả";
         }
         else
         {
             MessageBox.Show("Nhập từ khóa tìm kiếm", "Thông báo");
         }
     }
 }
示例#17
0
 // Có thêm ngày bắt đầu & ngày kết thúc là để khởi tạo thông tin sức khoẻ
 void XepLop(List <string> listMaTre, string maLop, DateTime ngayBatDau, DateTime ngayKetThuc)
 {
     if (TreBLL.XepLop(listMaTre, maLop))
     {
         KhoiTaoSucKhoe(listMaTre, ngayBatDau, ngayKetThuc);
         KhoiTaoHocPhi(listMaTre, ngayBatDau, ngayKetThuc);
         LoadDGVDanhSach();
         LoadDGVKetQua();
         MessageBox.Show("Thêm " + listMaTre.Count + " trẻ vào lớp " +
                         LopBLL.GetInfoLop(maLop).TenLop +
                         " thành công!",
                         "Thông báo",
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Information);
     }
 }
示例#18
0
 private void txtHoTen_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (txtNamSinh.Text != "")
         {
             dgvTre.DataSource = TreBLL.TreChuaCoLop(txtNamSinh.Text);
             txtKetQua.Text    = "Tìm được " + (dgvTre.RowCount).ToString() + " trẻ chưa được xếp lớp";
             GetDataGridView();
         }
         else
         {
             MessageBox.Show("Vui lòng nhập năm sinh để tìm kiếm trẻ", "Thông báo");
         }
     }
 }
示例#19
0
        private void btnCapNhat_Click(object sender, System.EventArgs e)
        {
            Tre tempTre = new Tre(txtMaTre.Text,
                                  txtHoTen.Text,
                                  rdoNam.Checked ? 1 : 0,
                                  dtNgaySinh.Value,
                                  txtHoTenCha.Text,
                                  txtHoTenMe.Text,
                                  txtDiaChi.Text,
                                  txtSDT.Text);

            if (TreBLL.CapNhatThongTinTre(tempTre))
            {
                MessageBox.Show("Cập nhật thông tin trẻ thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                loadDataGirdView();
            }
        }
示例#20
0
        private void btnApDungHocPhi_Click(object sender, EventArgs e)
        {
            if (dgvTre.SelectedRows.Count == 0)
            {
                MessageBox.Show("Phải chọn ít nhất một trẻ để áp dụng học phí.");
                return;
            }
            try
            {
                for (int i = 0; i < dgvTre.SelectedRows.Count; i++)
                {
                    if (TreBLL.KiemTraTreThoiHoc(dgvTre.SelectedRows[i].Cells["MaTre"].Value.ToString(),
                                                 KeyHandle.GetKeyFromCombobox(cboLop.SelectedItem.ToString())))
                    {
                        message += dgvTre.SelectedRows[i].Cells["HoTenTre"].Value.ToString() + "\n";
                        continue;
                    }
                    HocPhi hocPhi = new HocPhi();
                    hocPhi.MaHocPhi         = dgvTre.SelectedRows[i].Cells["MaHocPhi"].Value.ToString();
                    hocPhi.MaTre            = dgvTre.SelectedRows[i].Cells["MaTre"].Value.ToString();
                    hocPhi.Thang            = int.Parse(dgvTre.SelectedRows[i].Cells["Thang"].Value.ToString());
                    hocPhi.Nam              = int.Parse(dgvTre.SelectedRows[i].Cells["Nam"].Value.ToString());
                    hocPhi.HocPhiThangNay   = HocPhiBLL.TinhHocPhiThangNay(hocPhi, listChiTietHocPhi);
                    hocPhi.TienNoThangTruoc = HocPhiBLL.LayTienNoHocPhiThangTruoc(hocPhi);
                    hocPhi.TongTienHocPhi   = hocPhi.HocPhiThangNay + hocPhi.TienNoThangTruoc;
                    hocPhi.SoTienDaDong     = decimal.Parse(dgvTre.SelectedRows[i].Cells["SoTienDaDong"].Value.ToString());
                    hocPhi.SoTienConNo      = hocPhi.TongTienHocPhi - hocPhi.SoTienDaDong;

                    HocPhiBLL.CapNhatHocPhi(hocPhi, listChiTietHocPhi);
                }
                if (message == "")
                {
                    MessageBox.Show("Áp dụng học phí thanh công!");
                }
                else
                {
                    MessageBox.Show("Trẻ: \n" + message + "đã thôi học nên không được xét học phí.");
                    message = "";
                }
            } catch (Exception ex)
            {
                MessageBox.Show("Đã có lỗi xảy ra.");
            }

            RefreshView();
        }
示例#21
0
 private void ThemTreVaoLopCoSan()
 {
     if (cboLop.Text != "" && dgvTre.Rows.Count > 0)
     {
         foreach (DataGridViewRow row in dgvTre.Rows)
         {
             if (Convert.ToBoolean(row.Cells[0].Value))
             {
                 TreBLL.ThemTreVaoLop(row.Cells["MaTre"].Value.ToString(), cboLop.SelectedValue.ToString());
             }
         }
         MessageBox.Show("Thêm trẻ vào lớp thành công", "Thông báo");
     }
     else
     {
         MessageBox.Show("Vui lòng chọn trẻ & lớp để tiến hành xếp lớp", "Thông báo");
     }
 }
示例#22
0
 private void dgvTre_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
 {
     for (int i = 0; i < dgvTre.Rows.Count; i++)
     {
         dgvTre.Rows[i].Cells[0].Value             = i + 1;
         dgvTre.Rows[i].Cells["GioiTinhCol"].Value =
             int.Parse(dgvTre.Rows[i].Cells["GioiTinh"].Value.ToString()) == 1 ? "Nam" : "Nữ";
         if (TreBLL.KiemTraTreThoiHoc(dgvTre.Rows[i].Cells["MaTre"].Value.ToString(), KeyHandle.GetKeyFromCombobox(cboLop.SelectedItem.ToString())))
         {
             dgvTre.Rows[i].DefaultCellStyle.BackColor  = Color.Yellow;
             dgvTre.Rows[i].Cells["TinhTrangCol"].Value = "Đã thôi học";
         }
         else
         {
             dgvTre.Rows[i].DefaultCellStyle.BackColor = Color.White;
         }
     }
 }
        private void FillParameter()
        {
            ReportParameter[] key          = new ReportParameter[7];
            ReportParameter   ThangBatDau  = new ReportParameter("ThangBatDau", tgBatDau.Month.ToString());
            ReportParameter   NamBatDau    = new ReportParameter("NamBatDau", tgBatDau.Year.ToString());
            ReportParameter   ThangKetThuc = new ReportParameter("ThangKetThuc", tgKetThuc.Month.ToString());
            ReportParameter   NamKetThuc   = new ReportParameter("NamKetThuc", tgKetThuc.Year.ToString());
            ReportParameter   HoTenTre     = new ReportParameter("HoTenTre", TreBLL.GetTre(maTre).HoTen);
            ReportParameter   GioiTinh     = new ReportParameter("GioiTinh", TreBLL.GetTre(maTre).GioiTinh == 1 ? "Nam" : "Nữ");
            ReportParameter   NgaySinh     = new ReportParameter("NgaySinh", TreBLL.GetTre(maTre).NgaySinh.ToShortDateString());

            key[0] = ThangBatDau;
            key[1] = NamBatDau;
            key[2] = ThangKetThuc;
            key[3] = NamKetThuc;
            key[4] = HoTenTre;
            key[5] = GioiTinh;
            key[6] = NgaySinh;
            reportViewer1.LocalReport.SetParameters(key);
        }
示例#24
0
        public static void ThemTreVaoDBTuExcel(DataTable data, string ngayTiepNhan, string nguoiTiepNhan)
        {
            if (data == null || data.Rows.Count == 0)
            {
                MessageBox.Show("Không có dữ liệu để import");
                return;
            }
            try
            {
                for (int i = 0; i < data.Rows.Count; i++)
                {
                    string maTre = TreBLL.GenMaTre();
                    Tre    tre   = new Tre(maTre,
                                           data.Rows[i][0].ToString().Trim(),                 // Họ tên
                                           Convert.ToInt32(data.Rows[i][1].ToString()),       // Giới tính,
                                           DateTime.Parse(data.Rows[i][2].ToString().Trim()), // Ngày sinh
                                           data.Rows[i][3].ToString().Trim(),                 // Họ tên cha
                                           data.Rows[i][4].ToString().Trim(),                 // Họ tên mẹ
                                           data.Rows[i][5].ToString().Trim(),                 // Địa chỉ
                                           data.Rows[i][6].ToString().Trim());                // SĐT
                    PhieuTiepNhanTre phieumoi = new PhieuTiepNhanTre(maTre, PhieuTiepNhanBLL.GenMaPhieu(), ngayTiepNhan, nguoiTiepNhan);


                    try
                    {
                        TreBLL.ThemTre(tre);
                        PhieuTiepNhanBLL.ThemPhieu(phieumoi);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }

                MessageBox.Show("Import hoàn tất", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("File nhập vào không đúng định dạng!\nVui lòng xem HDSD để chuẩn bị file có định dạng đúng", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#25
0
        private void loadDataGridView()
        {
            if (dgvTiepNhan.Columns["GioiTinhCol"] == null)
            {
                DataGridViewTextBoxColumn gioiTinhColumn = new DataGridViewTextBoxColumn();
                gioiTinhColumn.Name       = "GioiTinhCol";
                gioiTinhColumn.HeaderText = "Giới tính";
                gioiTinhColumn.ReadOnly   = false;
                gioiTinhColumn.FillWeight = 10;
                dgvTiepNhan.Columns.Add(gioiTinhColumn);
            }
            dgvTiepNhan.DataSource = TreBLL.GetListTre();

            dgvTiepNhan.Columns["MaTre"].HeaderText      = "Mã trẻ";
            dgvTiepNhan.Columns["HoTenTre"].HeaderText   = "Họ tên trẻ";
            dgvTiepNhan.Columns["NgaySinh"].HeaderText   = "Ngày sinh";
            dgvTiepNhan.Columns["GioiTinh"].Visible      = false;
            dgvTiepNhan.Columns["HoTenCha"].HeaderText   = "Họ tên cha";
            dgvTiepNhan.Columns["HoTenMe"].HeaderText    = "Họ tên mẹ";
            dgvTiepNhan.Columns["DiaChi"].HeaderText     = "Địa chỉ";
            dgvTiepNhan.Columns["SDTLienLac"].HeaderText = "Số điện thoại";

            dgvTiepNhan.Columns["MaTre"].FillWeight       = 5;
            dgvTiepNhan.Columns["HoTenTre"].FillWeight    = 8;
            dgvTiepNhan.Columns["NgaySinh"].FillWeight    = 5;
            dgvTiepNhan.Columns["GioiTinhCol"].FillWeight = 2;
            dgvTiepNhan.Columns["HoTenCha"].Visible       = false;
            dgvTiepNhan.Columns["HoTenMe"].Visible        = false;
            dgvTiepNhan.Columns["DiaChi"].FillWeight      = 10;
            dgvTiepNhan.Columns["SDTLienLac"].FillWeight  = 5;


            dgvTiepNhan.Columns["MaTre"].DisplayIndex       = 0;
            dgvTiepNhan.Columns["HoTenTre"].DisplayIndex    = 1;
            dgvTiepNhan.Columns["NgaySinh"].DisplayIndex    = 2;
            dgvTiepNhan.Columns["GioiTinhCol"].DisplayIndex = 3;
            dgvTiepNhan.Columns["SDTLienLac"].DisplayIndex  = 4;
            dgvTiepNhan.Columns["HoTenCha"].DisplayIndex    = 5;
            dgvTiepNhan.Columns["HoTenMe"].DisplayIndex     = 6;
            dgvTiepNhan.Columns["DiaChi"].DisplayIndex      = 7;
        }
示例#26
0
        void LoadDGVKetQua()
        {
            if (cboLop.SelectedItem != null)
            {
                string maLop = KeyHandle.GetKeyFromCombobox(cboLop.SelectedItem.ToString());
                dgvKetQua.DataSource = TreBLL.GetListTre(LopBLL.GetInfoLop(maLop));

                dgvKetQua.Columns[2].HeaderText = "Họ tên trẻ";
                dgvKetQua.Columns[3].HeaderText = "Ngày sinh";
                dgvKetQua.Columns[9].HeaderText = "Mã tình trạng";

                dgvKetQua.Columns[0].Width = 50;
                dgvKetQua.Columns[2].Width = 140;
                dgvKetQua.Columns[3].Width = 120;
                dgvKetQua.Columns[9].Width = 120;

                for (int i = 0; i < dgvKetQua.Rows.Count; i++)
                {
                    dgvKetQua.Rows[i].Cells[0].Value = i + 1;
                    string maTinhTrang = dgvKetQua.Rows[i].Cells[9].Value.ToString().Trim();

                    if (string.Compare(maTinhTrang, "0") == 0)
                    {
                        dgvKetQua.Rows[i].Cells[9].Value             = "Đang học";
                        dgvKetQua.Rows[i].DefaultCellStyle.BackColor = Color.AliceBlue;
                    }
                    else if (string.Compare(maTinhTrang, "1") == 0)
                    {
                        dgvKetQua.Rows[i].Cells[9].Value             = "Đã lên lớp";
                        dgvKetQua.Rows[i].DefaultCellStyle.BackColor = Color.LightGoldenrodYellow;
                    }
                    else
                    {
                        dgvKetQua.Rows[i].Cells[9].Value             = "Đã thôi học";
                        dgvKetQua.Rows[i].DefaultCellStyle.BackColor = Color.HotPink;
                    }
                }
                string[] listProp = { "STT", "HoTenTre", "NgaySinh", "MaTinhTrang" };
                ControlFormat.DataGridViewFormat(dgvKetQua, listProp);
            }
        }
示例#27
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            List <string> listMaTre = DataHandle.SaveListMaTre(dgvTiepNhan);

            try
            {
                DialogResult dialog = MessageBox.Show("Bạn có chắc muốn xóa trẻ này không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dialog == DialogResult.Yes)
                {
                    TreBLL.XoaTre(listMaTre);
                    MessageBox.Show("Đã xóa " + listMaTre.Count + " trẻ thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    CleanInput();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Trẻ này đã học được một thời gian. Không thể xóa.\nNếu muốn cho thôi học, hãy sang bảng Xếp lớp -> Chọn thôi học", "Thông báo");
            }
            loadDataGridView();
        }
示例#28
0
        private void GetDataGridView()
        {
            dgvTre.DataSource = TreBLL.TreChuaCoLop(txtNamSinh.Text);

            string[] columns = { "MaTre", "HoTenTre", "NgaySinh", "GioiTinh" };
            Utility.ControlFormat.DataGridViewFormat(dgvTre, columns);

            dgvTre.Columns[0].HeaderText = "Mã trẻ";
            dgvTre.Columns[1].HeaderText = "Họ và tên";
            dgvTre.Columns[2].HeaderText = "Ngày sinh";
            dgvTre.Columns[3].HeaderText = "Giới tính";

            DataGridViewCheckBoxColumn columnSave = new DataGridViewCheckBoxColumn();

            ckbAll.Visible = true;
            ckbAll.Checked = false;

            // Set column values
            columnSave.Name       = "SaveButton";
            columnSave.HeaderText = "";
            dgvTre.Columns.Insert(0, columnSave);
        }
示例#29
0
 void ThoiHoc(List <string> listMaTre, string maLop)
 {
     if (TreBLL.ThoiHoc(listMaTre, maLop))
     {
         if (listMaTre.Count > 0)
         {
             MessageBox.Show("Thôi học " + listMaTre.Count + " trẻ trong lớp " +
                             LopBLL.GetInfoLop(maLop).TenLop +
                             " thành công!",
                             "Thông báo",
                             MessageBoxButtons.OK,
                             MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("Không thể thôi học trẻ đang không học ở lớp " + LopBLL.GetInfoLop(maLop).TenLop,
                         "Thông báo",
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Warning);
     }
 }
示例#30
0
        private void FillValue()
        {
            ReportParameter[] key      = new ReportParameter[8];
            ReportParameter   Nam      = new ReportParameter("Nam", nam.ToString());
            ReportParameter   NgayIn   = new ReportParameter("NgayIn", DateTime.Today.ToShortTimeString());
            ReportParameter   TenTre   = new ReportParameter("TenTre", TreBLL.GetHoTen(maTre));
            ReportParameter   TenDV    = new ReportParameter("TenDV", DichVuSucKhoeBLL.GetTenDV(maDV));
            ReportParameter   NgayKham = new ReportParameter("NgayKham", DichVuSucKhoeBLL.GetDV(maDV).NgayKham.ToShortDateString());
            ReportParameter   CanNang  = new ReportParameter("CanNang", canNang);
            ReportParameter   ChieuCao = new ReportParameter("ChieuCao", chieuCao);
            ReportParameter   TheTrang = new ReportParameter("TinhTrang", theTrang);

            key[0] = NgayIn;
            key[1] = Nam;
            key[2] = TenTre;
            key[3] = TenDV;
            key[4] = NgayKham;
            key[5] = CanNang;
            key[6] = ChieuCao;
            key[7] = TheTrang;

            reportViewer1.LocalReport.SetParameters(key);
        }