public List<Branch_Model> GetListTrungTam()
    {
        List<Branch_Model> rs = new List<Branch_Model>();
        ThuVien tv = new ThuVien();
        try
        {
            DataTable tbBranch = tv.SP_SelectDataTable("USP_Branch_GetAll", new string[] { "@First", "@Count" }, new object[] { "0", "10" });
            if (tbBranch.Rows.Count > 0)
            {
                for (int i = 0; i < tbBranch.Rows.Count; i++)
                {
                    Branch_Model bmodel = new Branch_Model();
                    bmodel.BranchID = tbBranch.Rows[i]["BranchID"].ToString();
                    bmodel.BranchName = tbBranch.Rows[i]["BranchName"].ToString();

                    rs.Add(bmodel);
                }
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }
        return rs;
    }
    public Schedule_Model GetSchedule(VariableConditionsSchedule_Model vsc)
    {
        ThuVien tv = new ThuVien();

        Schedule_Model rs = new Schedule_Model();
        rs.listClass = new List<listClass_Model>();
        rs.listBranch = new List<Branch_Model>();
        //rs.listStudent = new List<Student_Model>();

        DataTable tbSchedule = tv.SP_SelectDataTable("USP_Schedule_GetBySomeConditional",//DataTable tbSchedule = tv.SP_SelectDataTable("USP_Schedule_GetBySomeConditional",
                new string[] { "@flag", "@BranchID", "@TeacherID", "@StartDate", "@EndDate", "@Mon", "@Tue", "@Wed", "@Thu", "@Fri", "@Sat", "@Sun" },
                new object[] { 1, vsc.BranchID, vsc.TeacherID, vsc.StartDate, vsc.EndDate, vsc.Thu2, vsc.Thu3, vsc.Thu4, vsc.Thu5, vsc.Thu6, vsc.Thu7, vsc.ChuNhat });
        if (tbSchedule.Rows.Count > 0)
        {
            for (int i = 0; i < tbSchedule.Rows.Count; i++)
            {
                listClass_Model armodel = new listClass_Model();
                //armodel.ScheduleID = tbSchedule.Rows[i]["ScheduleID"].ToString();
                armodel.BranchID = tbSchedule.Rows[i]["BranchID"].ToString();
                armodel.BranchName = tbSchedule.Rows[i]["BranchName"].ToString();
                armodel.Coordinates = tbSchedule.Rows[i]["Coordinates"].ToString();
                armodel.ClassID = tbSchedule.Rows[i]["ClassID"].ToString();
                armodel.ClassName = tbSchedule.Rows[i]["ClassName"].ToString();
                armodel.TeacherID = tbSchedule.Rows[i]["TeacherID"].ToString();
                armodel.TeacherName = tbSchedule.Rows[i]["TeacherName"].ToString();
                armodel.BeginDate = Convert.ToString(tbSchedule.Rows[i]["BeginDate"]);
                armodel.Hour = tbSchedule.Rows[i]["Hour"].ToString();
                armodel.Minute = tbSchedule.Rows[i]["Minute"].ToString();
                armodel.Monday = tbSchedule.Rows[i]["Monday"].ToString();
                armodel.Tuesday = tbSchedule.Rows[i]["Tuesday"].ToString();
                armodel.Wednesday = tbSchedule.Rows[i]["Wednesday"].ToString();
                armodel.Thursday = tbSchedule.Rows[i]["Thursday"].ToString();
                armodel.Friday = tbSchedule.Rows[i]["Friday"].ToString();
                armodel.Saturday = tbSchedule.Rows[i]["Saturday"].ToString();
                armodel.Sunday = tbSchedule.Rows[i]["Sunday"].ToString();
                armodel.TotalStudent = tbSchedule.Rows[i]["TotalStudent"].ToString();
                armodel.TotalDangHoc = tbSchedule.Rows[i]["TotalDangHoc"].ToString();
                armodel.TotalDangHocThu = tbSchedule.Rows[i]["TotalDangHocThu"].ToString();
                armodel.TotalDaHocThuChuaGhiDanh = tbSchedule.Rows[i]["TotalDaHocThuChuaGhiDanh"].ToString();
                armodel.MaxStudent = tbSchedule.Rows[i]["MaxStudent"].ToString();
                rs.listClass.Add(armodel);

                Branch_Model brmodel = new Branch_Model();
                if (rs.listBranch.Count == 0)
                {
                    brmodel.BranchID = tbSchedule.Rows[i]["BranchID"].ToString();
                    brmodel.BranchName = tbSchedule.Rows[i]["BranchName"].ToString();
                    brmodel.Coordinates = tbSchedule.Rows[i]["Coordinates"].ToString();
                    rs.listBranch.Add(brmodel);
                }
                else
                {
                    if (rs.listBranch.FindIndex(f => f.BranchID == tbSchedule.Rows[i]["BranchID"].ToString()) < 0)
                    {
                        brmodel.BranchID = tbSchedule.Rows[i]["BranchID"].ToString();
                        brmodel.BranchName = tbSchedule.Rows[i]["BranchName"].ToString();
                        brmodel.Coordinates = tbSchedule.Rows[i]["Coordinates"].ToString();
                        rs.listBranch.Add(brmodel);
                    }
                }
                //ThuVien tv1 = new ThuVien();
                //string sID = tbSchedule.Rows[i]["ScheduleID"].ToString();
                //DataTable tbStudent = tv1.SP_SelectDataTable("USP_Student_GetScheduleID", new string[] { "@ScheduleID" }, new object[] { sID });
                //if (tbStudent.Rows.Count > 0)
                //{
                //    for (int j = 0; j < tbStudent.Rows.Count; j++)
                //    {
                //        Student_Model sdmodel = new Student_Model();
                //        sdmodel.StudentID = tbStudent.Rows[i]["StudentID"].ToString();
                //        sdmodel.StudentName = tbStudent.Rows[i]["StudentName"].ToString();
                //        sdmodel.ScheduleID = tbStudent.Rows[i]["ScheduleID"].ToString();
                //        sdmodel.StudentStatusID = tbStudent.Rows[i]["StudentStatusID"].ToString();
                //        sdmodel.StudentStatusName = tbStudent.Rows[i]["StudentStatusName"].ToString();
                //        sdmodel.Present = tbStudent.Rows[i]["Present"].ToString();
                //        sdmodel.Color = tbStudent.Rows[i]["Color"].ToString();
                //        rs.listStudent.Add(sdmodel);
                //    }
                //}
            }
        }

        return rs;
    }