Пример #1
0
        void loadDeThi()
        {
            lvDeThi.Items.Clear();
            using (var qltn = Utils.QLTN.getInstance())
            {
                var dsdethi = qltn.DeThis.Where(i => i.loaidethi == (cb.SelectedIndex == 0 ? true : false) && i.kythiid.HasValue == false).ToList();
                if (dsdethi.Count > 0)
                {
                    foreach (DeThi dt in dsdethi)
                    {
                        ListViewItem lvi = new ListViewItem();
                        lvi.SubItems.Add(new ListViewItem.ListViewSubItem().Text = dt.id.ToString());
                        string monhoc = null;
                        monhoc = dt.CapHoc_MonHoc.MonHoc.tenmonhoc;
                        lvi.SubItems.Add(new ListViewItem.ListViewSubItem().Text = monhoc);
                        lvi.SubItems.Add(new ListViewItem.ListViewSubItem().Text = strCapHoc[dt.caphocid.Value - 1]);
                        lvi.SubItems.Add(new ListViewItem.ListViewSubItem().Text = dt.thoigiantoida.ToString());
                        if (dt.ngaythi.HasValue)
                        {
                            lvi.SubItems.Add(new ListViewItem.ListViewSubItem().Text = dt.ngaythi.Value.ToString("dd/MM/yyyy"));
                        }
                        else
                        {
                            lvi.SubItems.Add(new ListViewItem.ListViewSubItem().Text = "");
                        }
                        lvDeThi.Items.Add(lvi);

                        var dethicustom = new DeThiCusTom();
                        dethicustom.deThiid   = dt.id;
                        dethicustom.loaidethi = dt.loaidethi.Value;
                        dsDeThiCustom.Add(dethicustom);
                    }
                }
            }
        }
Пример #2
0
        void loadDeThi()
        {
            lvDeThi.Items.Clear();
            var dsdethi = qltn.DeThis.Where(i => i.loaidethi == (cb.SelectedIndex == 0 ? true : false)).ToList();

            if (dsdethi.Count > 0)
            {
                foreach (DeThi i in dsdethi)
                {
                    if (i.kythiid.HasValue == true && i.kythiid != kythiid)
                    {
                        continue;
                    }
                    ListViewItem lvi = new ListViewItem();
                    if (i.kythiid == kythiid)
                    {
                        lvi.Checked = true;
                    }
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem().Text = i.id.ToString());
                    string monhoc = null;
                    foreach (MonHoc mh in dsMonHoc)
                    {
                        if (i.monhocid == mh.id)
                        {
                            monhoc = mh.tenmonhoc;
                        }
                    }
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem().Text = monhoc);
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem().Text = strCapHoc[i.caphocid.Value - 1]);
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem().Text = i.thoigiantoida.ToString());
                    if (i.ngaythi.HasValue)
                    {
                        lvi.SubItems.Add(new ListViewItem.ListViewSubItem().Text = i.ngaythi.Value.Date.ToString("dd/MM/yyyy"));
                    }
                    else
                    {
                        lvi.SubItems.Add(new ListViewItem.ListViewSubItem().Text = "");
                    }
                    lvDeThi.Items.Add(lvi);

                    var dethicustom = new DeThiCusTom();
                    dethicustom.deThiid   = i.id;
                    dethicustom.DuocCheck = (i.kythiid == kythiid ? true : false);
                    dethicustom.loaidethi = i.loaidethi.Value;
                    if (i.ngaythi.HasValue)
                    {
                        dethicustom.CoNgayThi = true;
                        dethicustom.NgayThi   = i.ngaythi.Value;
                    }
                    else
                    {
                        dethicustom.CoNgayThi = false;
                    }
                    try
                    {
                        var hstg = qltn.HocSinhThamGias.Where(x => x.dethiid == i.id).ToList();
                        foreach (HocSinhThamGia hs in hstg)
                        {
                            dethicustom.hocsinhid.Add(hs.hocsinhid);
                        }
                    }
                    catch { }
                    dsDeThiCustom.Add(dethicustom);
                }
            }
        }