예제 #1
0
        public HocSinhInfo LayTuMa(string maHocSinh)
        {
            if (this.Data == null)
            {
                this.Data = new HocSinhData();
            }
            DataTable table = this.Data.LayTuMa(maHocSinh);

            if (table.Rows.Count > 0)
            {
                DataRow     row  = table.Rows[0];
                HocSinhInfo info = new HocSinhInfo();
                info.MaHocSinh     = row["MaHocSinh"].ToString();
                info.HoTen         = row["HoTen"].ToString();
                info.GioiTinh      = bool.Parse(row["GioiTinh"].ToString());
                info.NgaySinh      = DateTime.Parse(row["NgaySinh"].ToString());
                info.NoiSinh       = row["NoiSinh"].ToString();
                info.DiaChi        = row["DiaChi"].ToString();
                info.DanToc        = new DanTocInfo();
                info.TonGiao       = new TonGiaoInfo();
                info.HoTenCha      = row["HoTenMe"].ToString();
                info.NgheNghiepCha = new NgheNghiepInfo();
                info.HoTenMe       = row["HoTenMe"].ToString();
                info.NgheNghiepMe  = new NgheNghiepInfo();
                return(info);
            }
            return(null);
        }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 public string LayMaCuoi()
 {
     if (this.Data == null)
     {
         this.Data = new HocSinhData();
     }
     return(Convert.ToString(this.Data.LayMaCuoi()));
 }
예제 #3
0
        public void HienThiComboBox(String namHoc, String lop, ComboBoxEx comboBox)
        {
            HocSinhData m_HSData = new HocSinhData();

            comboBox.DataSource    = m_HSData.LayDsHocSinhTheoLop(namHoc, lop);
            comboBox.DisplayMember = "HoTen";
            comboBox.ValueMember   = "MaHocSinh";
        }
예제 #4
0
        public static IList <HocSinhInfo> LayDsHocSinh()

        {
            HocSinhData m_HSData = new HocSinhData();

            DataTable m_DT = m_HSData.LayDsHocSinhForReport();


            IList <HocSinhInfo> dS = new List <HocSinhInfo>();


            foreach (DataRow Row in m_DT.Rows)
            {
                HocSinhInfo hs = new HocSinhInfo();


                NgheNghiepInfo nn = new NgheNghiepInfo();
                nn.MaNghe  = Convert.ToString(Row["MaNghe"]);
                nn.TenNghe = Convert.ToString(Row["TenNghe"]);


                DanTocInfo dt = new DanTocInfo();
                dt.MaDanToc = Convert.ToString(Row["MaDanToc"]);

                dt.TenDanToc = Convert.ToString(Row["TenDanToc"]);

                TonGiaoInfo tg = new TonGiaoInfo();
                tg.MaTonGiao = Convert.ToString(Row["MaTonGiao"]);

                tg.TenTonGiao = Convert.ToString(Row["TenTonGiao"]);

                hs.MaHocSinh = Convert.ToString(Row["MaHocSinh"]);

                hs.HoTen = Convert.ToString(Row["HoTen"]);


                hs.GioiTinh = Convert.ToBoolean(Row["GioiTinh"]);

                hs.NgaySinh = Convert.ToDateTime(Row["NgaySinh"]);
                hs.NoiSinh  = Convert.ToString(Row["NoiSinh"]);

                hs.DanToc  = dt;
                hs.TonGiao = tg;


                hs.HoTenCha   = Convert.ToString(Row["HoTenCha"]);
                hs.NNghiepCha = nn;


                hs.HoTenMe   = Convert.ToString(Row["HoTenMe"]);
                hs.NNghiepMe = nn;


                dS.Add(hs);
            }

            return(dS);
        }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dg"></param>
        /// <param name="bn"></param>
        /// <param name="tenhs"></param>
        public void TimTenHocSinh(DataGridView dg, BindingNavigator bn, String tenhs)
        {
            BindingSource bs  = new BindingSource();
            DataTable     tbl = new HocSinhData().TimTenHocSinh(tenhs);

            bs.DataSource    = tbl;
            bn.BindingSource = bs;
            dg.DataSource    = bs;
        }
예제 #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cmb"></param>
 public void HienThiCombobox(ComboBox cmb)
 {
     if (this.Data == null)
     {
         this.Data = new HocSinhData();
     }
     cmb.DataSource    = this.Data.LayDS();
     cmb.DisplayMember = "HoTen";
     cmb.ValueMember   = "MaHocSinh";
     cmb.SelectedValue = "MaHocSinh";
 }
예제 #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="col"></param>
 public void HienThiDataGridComboBoxColumn(DataGridViewComboBoxColumn col)
 {
     if (this.Data == null)
     {
         this.Data = new HocSinhData();
     }
     col.DataSource       = this.Data.LayDS();
     col.DisplayMember    = "HoTen";
     col.ValueMember      = "MaHocSinh";
     col.DataPropertyName = "MaHocSinh";
 }
예제 #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lvDS"></param>
        public void HienThiDS(ListView lvDS)
        {
            if (this.Data == null)
            {
                this.Data = new HocSinhData();
            }
            DataTable table = this.Data.LayDS();

            IEnumerator ie = table.Rows.GetEnumerator();

            lvDS.Items.Clear();
            while (ie.MoveNext())
            {
                DataRow row = (DataRow)ie.Current;

                HocSinhInfo info = new HocSinhInfo();
                info.MaHocSinh     = row["MaHocSinh"].ToString();
                info.HoTen         = row["HoTen"].ToString();
                info.GioiTinh      = bool.Parse(row["GioiTinh"].ToString());
                info.NgaySinh      = DateTime.Parse(row["NgaySinh"].ToString());
                info.NoiSinh       = row["NoiSinh"].ToString();
                info.DiaChi        = row["DiaChi"].ToString();
                info.DanToc        = new DanTocInfo();
                info.TonGiao       = new TonGiaoInfo();
                info.HoTenCha      = row["HoTenMe"].ToString();
                info.NgheNghiepCha = new NgheNghiepInfo();
                info.HoTenMe       = row["HoTenMe"].ToString();
                info.NgheNghiepMe  = new NgheNghiepInfo();

                ListViewItem item = new ListViewItem();
                item.Text = info.MaHocSinh;
                item.SubItems.Add(info.HoTen);
                if (info.GioiTinh == true)
                {
                    item.SubItems.Add("Nam");
                }
                else
                {
                    item.SubItems.Add("Nữ");
                }
                item.SubItems.Add(info.NgaySinh.ToShortDateString());
                item.SubItems.Add(info.NoiSinh);
                item.SubItems.Add(info.DiaChi);
                item.Tag = info;

                lvDS.Items.Add(item);
            }
        }
예제 #9
0
        //Lay danh sach hoc sinh do vao report
        public static IList <HocSinhInfo> LayDsHocSinh()
        {
            HocSinhData m_HSData = new HocSinhData();
            DataTable   m_DT     = m_HSData.LayDsHocSinhForReport();

            IList <HocSinhInfo> dS = new List <HocSinhInfo>();

            foreach (DataRow Row in m_DT.Rows)
            {
                HocSinhInfo hs = new HocSinhInfo();
                hs.MaHocSinh = Convert.ToString(Row["MaHocSinh"]);
                hs.HoTen     = Convert.ToString(Row["HoTen"]);
                hs.GioiTinh  = Convert.ToString(Row["GioiTinh"]).Trim();
                hs.NgaySinh  = Convert.ToDateTime(Row["NgaySinh"]);
                hs.NoiSinh   = Convert.ToString(Row["NoiSinh"]);

                dS.Add(hs);
            }
            return(dS);
        }
예제 #10
0
        //Mới
        public static IList <HocSinhInfo> LayDsHocSinh(String namHoc, String khoiLop, String lop)
        {
            HocSinhData m_HSData = new HocSinhData();
            DataTable   m_DT     = m_HSData.LayDsHocSinhForReport(namHoc, khoiLop, lop);

            IList <HocSinhInfo> dS = new List <HocSinhInfo>();

            foreach (DataRow Row in m_DT.Rows)
            {
                HocSinhInfo hs = new HocSinhInfo();

                hs.MaHocSinh = Convert.ToString(Row["MaHocSinh"]);
                hs.HoTen     = Convert.ToString(Row["HoTen"]);
                hs.GioiTinh  = Convert.ToBoolean(Row["GioiTinh"]);
                hs.NgaySinh  = Convert.ToDateTime(Row["NgaySinh"]);
                hs.Email     = Convert.ToString(Row["Email"]);
                hs.DiaChi    = Convert.ToString(Row["DiaChi"]);

                dS.Add(hs);
            }
            return(dS);
        }
예제 #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dgvDS"></param>
        /// <param name="bnDS"></param>
        /// <param name="txtMaHocSinh"></param>
        /// <param name="txtHoTen"></param>
        /// <param name="dpNgaySinh"></param>
        /// <param name="cbxGioiTinh"></param>
        /// <param name="txtNoiSinh"></param>
        /// <param name="txtDiaChi"></param>
        /// <param name="cmbDanToc"></param>
        /// <param name="cmbTonGiao"></param>
        /// <param name="txtHoTenCha"></param>
        /// <param name="cmbNNghiepCha"></param>
        /// <param name="txtHoTenMe"></param>
        /// <param name="cmbNNghiepMe"></param>
        public void HienThiDS(DataGridView dgvDS, BindingNavigator bnDS, TextBox txtMaHocSinh, TextBox txtHoTen, DateTimePicker dpNgaySinh, CheckBox cbxGioiTinh, TextBox txtNoiSinh, TextBox txtDiaChi, ComboBox cmbDanToc, ComboBox cmbTonGiao, TextBox txtHoTenCha, ComboBox cmbNNghiepCha, TextBox txtHoTenMe, ComboBox cmbNNghiepMe)
        {
            if (this.Data == null)
            {
                this.Data = new HocSinhData();
            }
            BindingSource bs = new BindingSource();

            bs.DataSource      = this.Data.LayDS();
            bnDS.BindingSource = bs;
            dgvDS.DataSource   = bs;
            txtMaHocSinh.DataBindings.Add("Text", bs, "MaHocSinh");
            txtHoTen.DataBindings.Add("Text", bs, "HoTen");
            dpNgaySinh.DataBindings.Add("Text", bs, "NgaySinh");
            cbxGioiTinh.DataBindings.Add("Checked", bs, "GioiTinh");
            txtNoiSinh.DataBindings.Add("Text", bs, "NoiSinh");
            txtDiaChi.DataBindings.Add("Text", bs, "DiaChi");
            cmbDanToc.DataBindings.Add("SelectedValue", bs, "MaDanToc");
            cmbTonGiao.DataBindings.Add("SelectedValue", bs, "MaTonGiao");
            txtHoTenCha.DataBindings.Add("Text", bs, "HoTenCha");
            cmbNNghiepCha.DataBindings.Add("SelectedValue", bs, "MaNNghiepCha");
            txtHoTenMe.DataBindings.Add("Text", bs, "HoTenMe");
            cmbNNghiepMe.DataBindings.Add("SelectedValue", bs, "MaNNghiepMe");
        }
예제 #12
0
        private void DanhGiaHocLucTheoNam()
        {
            List <KetQuaHocLucInfo> lstKQ = new List <KetQuaHocLucInfo>();
            //Khởi tạo các đối tượng get dữ liệu
            var maLop  = cmbLop.SelectedValue.ToString();
            var namHoc = cmbNamHoc.SelectedValue.ToString();

            String[]           HocLuc        = { "Giỏi", "Khá", "Trung Bình", "Yếu", "Kém" };
            float[]            diemCanDuoi   = { 8, 6.5f, 5, 3.5f, 0 };
            HocSinhData        m_HocSinhData = new HocSinhData();
            MonHocData         m_MonHocData  = new MonHocData();
            DiemCtrl           m_DiemCtrl    = new DiemCtrl();
            DataTable          m_DT          = m_MonHocData.LayDsMonHoc(namHoc, maLop);
            List <HocSinhInfo> lstHS         = m_HocSinhData.LayDSHocSinhTheoLop(namHoc, maLop);

            //Tính điểm TB và xếp loại học lực cho mỗi học sinh trong lớp
            foreach (HocSinhInfo hs in lstHS)
            {
                //Khởi tạo các biến điểm cho mỗi học sinh
                float   tongDiem           = 0;
                float   tongDiemCacMon     = 0;
                float   diemTBTungMon      = 0;
                int     tongHeSoCacMon     = 0;
                String  xepLoai            = "";
                float[] arrayDiemTBTungMon = new float[m_DT.Rows.Count];
                int     soMonHoc           = 0;
                //Tính điểm trung bình
                foreach (DataRow row in m_DT.Rows)
                {
                    diemTBTungMon = m_DiemCtrl.DiemTrungBinhMonCaNam(hs.MaHocSinh, row["MaMonHoc"].ToString(), namHoc, maLop);
                    arrayDiemTBTungMon[soMonHoc++] = diemTBTungMon;
                    tongDiemCacMon += diemTBTungMon * Convert.ToInt32(row["HeSo"].ToString());
                    tongHeSoCacMon += Convert.ToInt32(row["HeSo"].ToString());
                }
                if (tongHeSoCacMon > 0)
                {
                    tongDiem = tongDiemCacMon / tongHeSoCacMon;
                }
                else
                {
                    tongDiem = 0;
                }
                //Xếp loại học lực
                //Tìm điểm TB Môn nhỏ nhất
                float diemTBMonNhoNhat = arrayDiemTBTungMon[0];
                for (int i = 1; i < arrayDiemTBTungMon.Length - 1; i++)
                {
                    diemTBMonNhoNhat = Math.Min(diemTBMonNhoNhat, arrayDiemTBTungMon[i]);
                }
                //Xét học lực theo điểm TB và điểm TB môn nhỏ nhất
                for (int i = 0; i < 4; i++)
                {
                    if (tongDiem >= diemCanDuoi[i] && diemTBMonNhoNhat >= diemCanDuoi[i + 1])
                    {
                        xepLoai = HocLuc[i];
                        break;
                    }
                }
                if (xepLoai == "")
                {
                    xepLoai = HocLuc[4].ToString();
                }
                lstKQ.Add(new KetQuaHocLucInfo(hs.MaHocSinh, hs.HoTen, tongDiem, xepLoai));
            }
            //Hiển thị ra gridview
            bSKQCNTH.DataSource = lstKQ;
            gvHocLuc.DataSource = bSKQCNTH;
        }
예제 #13
0
 public HocSinhController()
 {
     this.Data = new HocSinhData();
 }