Exemplo n.º 1
0
        // Khoa
        // -- Hệ
        //    -- Trình độ
        //       -- Khoá
        //          -- Lớp
        public DataTable CreateTree(DataTable dt)
        {
            string[]  UnDistinct = { "IDDM_He", "IDDM_TrinhDo", "IDDM_Khoa", "IDDM_KhoaHoc", "IDDM_Nganh", "IDDM_ChuyenNganh", "DM_LopID", "IDKQHT_ChuongTrinhDaoTao", "IDDM_DiaDiem" };
            DataTable dtTree = CreateTableTree();
            DataTable dtHe, dtTrinhDo, dtKhoaHoc, dtLop;
            // Add Khoa
            DataTable dtKhoa = clsTable.SelectDistinct(dt, new string[] { "TenKhoa" }, UnDistinct);
            int       ParentKhoa = 0, pHe, pTrinhDo, pKhoaHoc, pLop;

            currID = 0;
            foreach (DataRow drKhoa in dtKhoa.Rows)
            {
                AddTreeNode(dtTree, drKhoa, "TenKhoa", "", "Khoa", ParentKhoa, new int[] { int.Parse(drKhoa["IDDM_Khoa"].ToString()), 0, 0, 0, 0, 0, 0, 0, 0 }, 0);
                // Add He
                dtHe = clsTable.SelectDistinct(dt, new string[] { "TenHe" }, UnDistinct, "TenKhoa = '" + drKhoa["TenKhoa"] + "'");
                pHe  = currID;
                foreach (DataRow drHe in dtHe.Rows)
                {
                    AddTreeNode(dtTree, drHe, "TenHe", "", "Hệ", pHe, new int[] { int.Parse(drHe["IDDM_Khoa"].ToString()),
                                                                                  int.Parse(drHe["IDDM_He"].ToString()), 0, 0, 0, 0, 0, 0, 0 }, 1);
                    // Add TrinhDo
                    dtTrinhDo = clsTable.SelectDistinct(dt, new string[] { "TenTrinhDo" }, UnDistinct,
                                                        "TenKhoa = '" + drKhoa["TenKhoa"] + "' And TenHe = '" + drHe["TenHe"] + "'");
                    pTrinhDo = currID;
                    foreach (DataRow drTrinhDo in dtTrinhDo.Rows)
                    {
                        AddTreeNode(dtTree, drTrinhDo, "TenTrinhDo", "", "Trình độ", pTrinhDo, new int[] { int.Parse(drTrinhDo["IDDM_Khoa"].ToString()),
                                                                                                           int.Parse(drTrinhDo["IDDM_He"].ToString()), int.Parse(drTrinhDo["IDDM_TrinhDo"].ToString()), 0, 0, 0, 0, 0, 0 }, 2);
                        // Add KhoaHoc
                        dtKhoaHoc = clsTable.SelectDistinct(dt, new string[] { "TenKhoaHoc" }, UnDistinct, "TenKhoa = '" + drKhoa["TenKhoa"]
                                                            + "' And TenHe = '" + drHe["TenHe"] + "' And TenTrinhDo = '" + drTrinhDo["TenTrinhDo"] + "'");
                        pKhoaHoc = currID;
                        foreach (DataRow drKhoaHoc in dtKhoaHoc.Rows)
                        {
                            AddTreeNode(dtTree, drKhoaHoc, "TenKhoaHoc", "", "Khoá", pKhoaHoc, new int[] { int.Parse(drKhoaHoc["IDDM_Khoa"].ToString()),
                                                                                                           int.Parse(drKhoaHoc["IDDM_He"].ToString()), int.Parse(drKhoaHoc["IDDM_TrinhDo"].ToString()), int.Parse(drKhoaHoc["IDDM_KhoaHoc"].ToString()), 0, 0, 0, 0, 0 }, 3);
                            // Add Lop
                            dtLop = clsTable.SelectDistinct(dt, new string[] { "TenLop", "TenNganh" }, UnDistinct, "TenKhoa = '" + drKhoa["TenKhoa"]
                                                            + "' And TenHe = '" + drHe["TenHe"] + "' And TenTrinhDo = '" + drTrinhDo["TenTrinhDo"] + "' And TenKhoaHoc = '" + drKhoaHoc["TenKhoaHoc"] + "'");
                            pLop = currID;
                            foreach (DataRow drLop in dtLop.Rows)
                            {
                                AddTreeNode(dtTree, drLop, "TenLop", "TenNganh", "Lớp", pLop, new int[] { int.Parse(drLop["IDDM_Khoa"].ToString()),
                                                                                                          int.Parse(drLop["IDDM_He"].ToString()), int.Parse(drLop["IDDM_TrinhDo"].ToString()), int.Parse(drLop["IDDM_KhoaHoc"].ToString()), 0, 0,
                                                                                                          int.Parse(drLop["DM_LopID"].ToString()), int.Parse("0" + drLop["IDKQHT_ChuongTrinhDaoTao"]), "" + drLop["IDDM_DiaDiem"] == ""? 0: int.Parse(drLop["IDDM_DiaDiem"].ToString()) }, 4);
                            }
                        }
                    }
                }
            }
            return(dtTree);
        }
        // lay phong thi theo dot thi
        private void GetPhongThi()
        {
            // get phong thi theo dot thi
            DataTable dtPhongThi = cls.SelectDistinct(dtDanhSachDuThi, new string[] { "IDDM_PhongHoc", "PhongThi" });

            cmbPhongThi.Properties.DataSource = dtPhongThi;
        }
Exemplo n.º 3
0
 private void LoadDanhSachDotThi(int IDDM_MonHoc)
 {
     dtDanhSachDuThi = oBKQHT_ToChucThi.GetByMonHoc(IDDM_MonHoc, Program.IDNamHoc, Program.HocKy);
     if (dtDanhSachDuThi.Rows.Count > 0)
     {
         DataTable dt = cls.SelectDistinct(dtDanhSachDuThi, new string[] { "Chon", "KQHT_ToChucThiID", "LanThi", "DotThi", "NgayThi",
                                                                           "CaThi", "NhomTiet", "TenLop", "DongTui" });
         dtDotThi = dt.Clone();
         string KQHT_ToChucThiID = "";
         foreach (DataRow dr in dt.Rows)
         {
             if (dr["KQHT_ToChucThiID"].ToString() != KQHT_ToChucThiID)
             {
                 dtDotThi.ImportRow(dr);
             }
             else
             {
                 dtDotThi.Rows[dtDotThi.Rows.Count - 1]["TenLop"] = dtDotThi.Rows[dtDotThi.Rows.Count - 1]["TenLop"] + ", " + dr["TenLop"];
             }
             KQHT_ToChucThiID = dr["KQHT_ToChucThiID"].ToString();
         }
         dtDotThi.AcceptChanges();
         grdDotThi.DataSource = dtDotThi;
     }
     else
     {
         grdDotThi.DataSource = null;
     }
 }
Exemplo n.º 4
0
        private void LoadKeHoach()
        {
            fg.Rows.Count = 0;
            fg.Cols.Count = 0;
            DataTable dtLop;
            int       row = RowBegin;

            dtToanTruong       = new cBDM_Lop().GetKeHoachToanTruong(Program.IDNamHoc, Program.NamHoc, pDM_LopInfo);
            dtPhanCongGiangDay = new cBXL_MonHocTrongKy().GetByHocKyNamHoc(0, Program.HocKy, Program.IDNamHoc, 0, 0);
            clsdt = new clsDataTableHelper();
            dtLop = clsdt.SelectDistinct(dtToanTruong, new string[] { "IDDM_He", "IDDM_TrinhDo", "TenKhoaHoc", "DM_LopID", "TenLop", "SoSinhVien" });
            if (dtLop.Rows.Count > 0)
            {
                fg.Rows.Count = row + dtLop.Rows.Count;
                fg.Cols.Count = ColBegin + LoadTuan().Rows.Count;
                FormatGrid();
                for (int i = 0; i < dtLop.Rows.Count; i++)
                {
                    // Gán giá trị lớp
                    fg.Rows[row].Height = rowHeight;
                    fg[row, 0]          = 0;
                    fg[row, 1]          = int.Parse(dtLop.Rows[i]["DM_LopID"].ToString());
                    fg[row, 3]          = dtLop.Rows[i]["TenLop"].ToString();
                    fg[row, 4]          = int.Parse(dtLop.Rows[i]["SoSinhVien"].ToString());
                    CellRange rg = fg.GetCellRange(row, 0, row, fg.Cols.Fixed - 1);
                    rg.Style = fg.Styles["MyCellStyleLop"];
                    FillKeHoachLop(row, int.Parse(dtLop.Rows[i]["DM_LopID"].ToString()));
                    row++;
                    FillChiTietLop(ref row, int.Parse(dtLop.Rows[i]["DM_LopID"].ToString()));
                }
                TinhSoTietCon(RowBegin, fg.Rows.Count - 1);
            }
        }
Exemplo n.º 5
0
        private void FillChiTietLop(ref int row, int DM_LopID)
        {
            DataRow[] drChiTiet;
            DataTable dtChiTiet = oBXL_KeHoachChiTiet.GetKeHoachByLop(Program.IDNamHoc, Program.HocKy, DM_LopID);
            DataTable dtTemp    = clsdt.SelectDistinct(dtChiTiet, new string[] { "HocKy", "TenMonHoc", "XL_MonHocTrongKyID", "DM_MonHocID", "SoHocTrinh", "TongSoTiet" });

            fg.Rows.Count = fg.Rows.Count + dtTemp.Rows.Count + 1;
            int i = 0;

            foreach (DataRow dr in dtTemp.Rows)
            {
                // Gán giá trị lớp
                fg.Rows[row + i].Height = rowHeight;
                fg[row + i, 0]          = row - 1;
                fg[row + i, 1]          = dr["DM_MonHocID"].ToString();
                fg[row + i, 2]          = dr["HocKy"].ToString();
                fg[row + i, 3]          = dr["TenMonHoc"].ToString();
                fg[row + i, 4]          = Encode(dr["SoHocTrinh"].ToString(), row + i);
                fg[row + i, 5]          = Encode(dr["TongSoTiet"].ToString(), row + i);
                fg[row + i, 7]          = dr["XL_MonHocTrongKyID"].ToString();
                fg[row + i, 8]          = GetGiaoVienGiangDay(int.Parse(dr["XL_MonHocTrongKyID"].ToString()));
                // Gán kế hoạch chi tiết môn cho hàng thứ row
                drChiTiet = dtChiTiet.Select("DM_MonHocID = " + dr["DM_MonHocID"].ToString());
                FillChiTietMon(row + i, drChiTiet);
                //CellRange rg = fg.GetCellRange(row, 0, row, fg.Cols.Fixed - 1);
                i++;
            }

            fg.Rows[row + i].Height       = rowHeight;
            fg[row + i, 0]                = (row - 1).ToString() + ",Tong";
            fg[row + i, 1]                = 0;
            fg[row + i, 2]                = "Tổng hợp kỳ";
            fg[row + i, 3]                = "Tổng hợp kỳ";
            fg.Rows[row + i].AllowMerging = true;
            fg.Rows[row + i].Style        = fg.Styles["MyCellStyleTongHop"];
            CellRange rg = fg.GetCellRange(row + i, 0, row + i, fg.Cols.Fixed - 1);

            rg.Style = fg.Styles["MyCellStyleTongHop"];

            row += i + 1;
        }