Exemplo n.º 1
0
        private static string genTkb(String gv)
        {
            G9Service.G9_Service sv = new G9Service.G9_Service();
            var list = sv.getListTKBByGiaoVien(gv);
            string temp = "";
            temp += "        <table>";
            temp += "            <tr>";
            temp += "                <th></th>";
            temp += "                <th>Hai</th>";
            temp += "                <th>Ba</th>";
            temp += "                <th>Tư</th>";
            temp += "                <th>Năm</th>";
            temp += "                <th>Sáu</th>";
            temp += "                <th>Bảy</th>";
            temp += "                <th>Chủ nhật</th>";
            temp += "            </tr>";
            for (int j = 1; j < 13; j++)
            {
                temp += "   <tr>";
                temp += "       <td>Tiết " + j + "</td>";
                for (int i = 2; i < 9; i++)
                {

                    temp += "       <td>&" + i + "&" + j + "&</td>";//tkb.MaTKB +
                }
                temp += "   </tr>";
            }
            temp += "</table>";
            if (list == null || list.Count() == 0)
            {
                for (int j = 1; j < 13; j++)
                {
                    for (int i = 2; i < 9; i++)
                    {
                        temp = temp.Replace("&" + i + "&" + j + "&", "");
                    }

                }
            }
            else
                foreach (var cur in list)
                {
                    String checkin = "";
                    String tenLop = "";
                    if (sv.getLopByMaChiTietTKB(cur.MaChiTietTKB) != null)
                        tenLop = sv.getLopByMaChiTietTKB(cur.MaChiTietTKB).TenLop;
                    String tenphong = "";
                    if (sv.getPhongByMaChiTietTKB(cur.MaChiTietTKB) != null)
                        tenphong = sv.getPhongByMaChiTietTKB(cur.MaChiTietTKB).TenPhong;

                    checkin = tenLop + "/" + tenphong;
                    temp = temp.Replace("&" + cur.Thu + "&" + cur.TietBatDau + "&", checkin);

                }
            for (int j = 1; j < 13; j++)
            {
                for (int i = 2; i < 9; i++)
                {
                    temp = temp.Replace("&" + i + "&" + j + "&", "");
                }

            }

            return temp;
        }