// sự kiện phím tắt trên tabcontrol sinh viên
 private void tco_admin_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData == (Keys.S | Keys.Control))
     {
         if (MessageBox.Show("Bạn có muốn lưu bản ghi không?", "", MessageBoxButtons.OKCancel) == DialogResult.OK)
         {
             if (txt_masv.Text == "" || txt_tensv.Text == "")
             {
                 MessageBox.Show("Chưa nhập đủ thông tin");
                 return;
             }
             Object_SinhVien sv = new Object_SinhVien();
             // gan cac thuoc tinh cho cac control tren form sinhvien
             sv.MaSV       = txt_masv.Text.ToString();
             sv.TenSV      = txt_tensv.Text.ToString();
             sv.NgaySinh   = dtp_ngaysinh.Value;
             sv.GioiTinhSV = rbt_nam.Checked ? "Nam" : "Nữ";
             sv.QueQuan    = txt_quequan.Text;
             sv.MaLop      = cbx_lop.SelectedValue.ToString();
             // int b = Bus.themSV(sv);
             if (MessageBox.Show(string.Format("Thêm sinh viên {0}, mã SV {1}", sv.TenSV, sv.MaSV), "Thêm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
             {
                 if (Bus.themSV(sv) > 0)
                 {
                     MessageBox.Show("Thêm Thành Công!");
                     Admin_Load(sender, e);
                 }
                 else
                 {
                     MessageBox.Show("Thêm Thất Bại!");
                 }
             }
         }
     }
 }
        private void btn_xem3_Click(object sender, EventArgs e)
        {
            Object_SinhVien sv = new Object_SinhVien();

            sv.MaSV = txt_masv1.Text;
            dgr_bangdiem.DataSource = Bus.ThongKeDiem_MaSV(sv);
        }
Beispiel #3
0
 //XEM THỜI KHÓA BIỂU
 public static DataTable GetThoiKhoaBieu(Object_SinhVien sv)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@masv", sv.MaSV),
     };
     return(DataProvider.GetDatadk("xemthoikhoabieu", para));
 }
Beispiel #4
0
 //XEM BẢNG ĐIỂM
 public static DataTable GetBangDiem(Object_SinhVien sv)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@masv", sv.MaSV)
     };
     return(DataProvider.GetDatadk("ketquahoctap", para));
 }
Beispiel #5
0
 //XEM THÔNG TIN TRÊN BẢNG ĐIỂM
 public static DataTable GetThongTinSV(Object_SinhVien sv)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@masv", sv.MaSV)
     };
     return(DataProvider.GetDatadk("thongtinsv_bangdiem", para));
 }
Beispiel #6
0
 // Thống kê điểm theo từng sinh viên
 public static DataTable ThongKeDiem_MaSV(Object_SinhVien sv)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@maSV", sv.MaSV)
     };
     return(DataProvider.GetDatadk("ThongKeDiem_MaSV", para));
 }
Beispiel #7
0
 public static DataTable ThongKeDiem_MaSV_NamHoc_HocKi(Object_SinhVien sv, Object_LopHocPhan lhp)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@masv", sv.MaSV),
         new SqlParameter("@hocki", lhp.Hocki),
         new SqlParameter("@namhoc", lhp.Namhoc)
     };
     return(DataProvider.GetDatadk("ThongKeDiem_masv_hk_namhoc", para));
 }
Beispiel #8
0
 public static DataTable GetThongTinSV_ThongKe(Object_SinhVien sv, Object_LopHocPhan lhp)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@masv", sv.MaSV),
         new SqlParameter("@hocki", lhp.Hocki),
         new SqlParameter("@namhoc", lhp.Namhoc)
     };
     return(DataProvider.GetDatadk("getthongtinsv", para));
 }
Beispiel #9
0
        //XÓA SV
        public static int XoaSinhVien(Object_SinhVien sv)
        {
            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@masv", sv.MaSV)
            };


            return(DataProvider.ExecuteNonQuery("xoasinhvien", para));
        }
Beispiel #10
0
        private void btn_xem_Click(object sender, EventArgs e)
        {
            Object_SinhVien sv = new Object_SinhVien();

            sv.MaSV = txt_timkiemsv.Text;
            dgr_thoikhoabieu.DataSource = Bus.GetThoiKhoaBieu(sv);
            dgr_thoikhoabieu.AutoResizeRows();
            dgr_thoikhoabieu.AutoResizeColumns();
            DoiTen();
        }
Beispiel #11
0
 //SỬA SV
 public static int SuaSinhVien(Object_SinhVien sv)
 {
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@masv", sv.MaSV),
         new SqlParameter("@tensv", sv.TenSV),
         new SqlParameter("@ngaysinh", sv.NgaySinh),
         new SqlParameter("@gioitinh", sv.GioiTinhSV),
         new SqlParameter("@quequan", sv.QueQuan),
         new SqlParameter("@tenlop", sv.MaLop)
     };
     return(DataProvider.ExecuteNonQuery("suasinhvien", para));
 }
        //xóa
        private void btn_xoa_Click(object sender, EventArgs e)
        {
            Object_SinhVien sv = new Object_SinhVien();

            sv.MaSV = txt_masv.Text;
            if (MessageBox.Show(string.Format("Xóa sinh viên có mã sv{0}", sv.MaSV), "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
            {
                if (Bus.XoaSV(sv) > 0)
                {
                    MessageBox.Show("Xóa Thành Công!");
                    Admin_Load(sender, e);
                }
                else
                {
                    MessageBox.Show("Xóa Thất Bại!");
                }
            }
        }
        //sửa
        private void btn_sua_Click(object sender, EventArgs e)
        {
            Object_SinhVien sv = new Object_SinhVien();

            sv.MaSV       = txt_masv.Text;
            sv.TenSV      = txt_tensv.Text;
            sv.NgaySinh   = dtp_ngaysinh.Value;
            sv.GioiTinhSV = rbt_nam.Checked ? "Nam" : "Nữ";
            sv.QueQuan    = txt_quequan.Text;
            sv.MaLop      = cbx_lop.SelectedValue.ToString();
            if (MessageBox.Show(string.Format("Sửa sinh viên có mã {0}", sv.MaSV), "Xóa", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                if (Bus.SuaSV(sv) > 0)
                {
                    MessageBox.Show("Sửa Thành Công!");
                    Admin_Load(sender, e);
                }
                else
                {
                    MessageBox.Show("Sửa Thất Bại!");
                }
            }
        }
        private void btn_xem_Click(object sender, EventArgs e)
        {
            Object_SinhVien sv = new Object_SinhVien();

            //
            sv.MaSV = txt_timkiemsv.Text;
            dgr_bangdiem.DataSource = Bus.GetBangDiem(sv);
            dgr_bangdiem.AutoResizeRows();
            dgr_bangdiem.AutoResizeColumns();

            try {
                DataTable dt = Bus.GetThongTinSV(sv);
                int       a  = dt.Columns.Count;
                lbl_masv1.Text     = ": " + dt.Rows[0].Field <string>("masv");
                lbl_sinhvien1.Text = ": " + dt.Rows[0].Field <string>("tensv");
                lbl_namhoc1.Text   = ": " + dt.Rows[0].Field <double?>("diemtichluy");
                //lbl_hocki1.Text = ": " + dt.Rows[0].Field<string>("hocki");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Record empty!");
            }
        }
        private void btn_in3_Click(object sender, EventArgs e)
        {
            Object_SinhVien   sv  = new Object_SinhVien();
            Object_LopHocPhan lhp = new Object_LopHocPhan();
            DataTable         dt  = new DataTable();

            string pattern = @"([0-9]{4,4}[\s][-][\s][0-9])";
            Regex  myregex = new Regex(pattern);

            if (string.IsNullOrEmpty(txt_masv2.Text))
            {
                MessageBox.Show("Nhập vào mã sinh viên!");
            }
            else
            if (string.IsNullOrEmpty(txt_namhoc2.Text))
            {
                MessageBox.Show("Nhập vào năm học!");
            }
            else
            if (cbo_hocki2.SelectedIndex == -1)
            {
                MessageBox.Show("Chọn học kì!");
            }
            else
            if (!myregex.IsMatch(txt_namhoc2.Text))
            {
                MessageBox.Show("Nhập đúng định dạng : yyyy - yyyy");
            }
            else
            {
                try
                {
                    sv.MaSV    = txt_masv2.Text;
                    lhp.Namhoc = txt_namhoc2.Text;
                    lhp.Hocki  = cbo_hocki2.SelectedItem.ToString();
                    dt         = Bus.GetThongTinSV_ThongKe(sv, lhp);
                    dgr_thongkediem.DataSource = Bus.ThongKeDiem_MaSV_NamHoc_HocKi(sv, lhp);

                    label6.ResetText(); label7.ResetText(); label8.ResetText(); label9.ResetText(); label10.ResetText(); label11.ResetText();
                    label8.Text = DateTime.Now.ToShortDateString();
                    label7.Text = "Sinh Viên ,Học Kì " + cbo_hocki2.SelectedItem.ToString() + ", Năm học " + txt_namhoc2.Text;
                    label6.Text = "Sinh Viên:  " + dt.Rows[0].Field <string>("tensv");

                    //label9.Text = "Số TC Nợ:  " + Convert.ToSingle( dt.Rows[0].Field<int?>("tcno"));
                    //label10.Text = "TB Học Kì:  " +Convert.ToDouble( dt.Rows[0].Field<float>("tbhk"));
                    //label11.Text = "Điểm Tích Lũy:  " +Convert.ToDouble (dt.Rows[0].Field<float>("diemtichluy"));
                    if (dt.Rows[0].Field <int?>(2) == null)
                    {
                        label9.Text = "Số TC Nợ:  0";
                    }
                    else
                    {
                        label9.Text = "Số TC Nợ:  " + dt.Rows[0].Field <int?>(2);
                    }
                    label10.Text = "TB Học Kì:  " + dt.Rows[0].Field <double?>(3);
                    label11.Text = "Điểm Tích Lũy:  " + dt.Rows[0].Field <double?>(1);

                    Export ex = new Export();
                    ex.ExportExcel_MaSV(Bus.ThongKeDiem_MaSV_NamHoc_HocKi(sv, lhp), txt_masv2.Text, string.Format(label7.Text + "\n" + label6.Text + "\n" + label10.Text + "\n" + label9.Text + "\n" + label11.Text));
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Beispiel #16
0
 //Xem thong tinsv tren bang diem
 public static DataTable GetThongTinSV(Object_SinhVien sv)
 {
     return(Dao.GetThongTinSV(sv));
 }
Beispiel #17
0
 public static DataTable ThongKeDiem_MaSV_NamHoc_HocKi(Object_SinhVien sv, Object_LopHocPhan lhp)
 {
     return(Dao.ThongKeDiem_MaSV_NamHoc_HocKi(sv, lhp));
 }
Beispiel #18
0
 // thống kê điểm theo từng sinh viên
 public static DataTable ThongKeDiem_MaSV(Object_SinhVien sv)
 {
     return(Dao.ThongKeDiem_MaSV(sv));
 }
Beispiel #19
0
 public static DataTable GetThongTinSV_ThongKe(Object_SinhVien sv, Object_LopHocPhan lhp)
 {
     return(Dao.GetThongTinSV_ThongKe(sv, lhp));
 }
Beispiel #20
0
 //--------SINH VIÊN------------------
 //
 //xem thoi khoa bieu
 public static DataTable GetThoiKhoaBieu(Object_SinhVien sv)
 {
     return(Dao.GetThoiKhoaBieu(sv));
 }
Beispiel #21
0
 //xem thoi khoa bieu
 public static DataTable GetBangDiem(Object_SinhVien sv)
 {
     return(Dao.GetBangDiem(sv));
 }
Beispiel #22
0
 public static int themSV(Object_SinhVien sv)
 {
     return(Dao.themSV(sv));
 }
Beispiel #23
0
 public static int SuaSV(Object_SinhVien sv)
 {
     return(Dao.SuaSinhVien(sv));
 }