示例#1
0
        //public ActionResult Reports()
        //{

        //    //var rooms_empty = from slot s in db.slots join day d in db.days on s.dayid equals d.dayid
        //    //                  join vslottype st in db.vslottypes on s.slottypeid equals st.slottypeid
        //    //                  join room r in db.rooms on s.roomid equals r.roomid
        //    //                  where d.dayid == 1 && r.campus == "90" && !(from slot s in db.slots join vschedule sch in db.vschedules on s.slotid equals sch.slotid where s.dayid == 1 group s.slotid by s)
        //    //                 select new {s.roomid,r.roomno,r.campus,st.duration,st.occupied,st.slottypeid}

        //    ReportsVM vm = new ReportsVM();
        //    //var empty=List<>;
        //    DateTime today = DateTime.Now;
        //    int currentDayOfWeek = (int)today.DayOfWeek;
        //    DateTime sunday = today.AddDays(-currentDayOfWeek);
        //    DateTime monday = sunday.AddDays(1);

        //    //DateTime mon = monday.Date.ToString("dd/MM/YYYY");
        //    if (currentDayOfWeek == 0)
        //    {
        //        monday = monday.AddDays(-7);
        //    }
        //    var dates = Enumerable.Range(0, 7).Select(days => monday.AddDays(days)).ToList();
        //    DateTime start = dates[0].Date;
        //    DateTime end = dates[6].Date;


        //    ViewBag.startdate = start;
        //    ViewBag.enddate = end;

        //    var day = from d in db.days
        //               select new
        //               {
        //                   Id = d.dayid,
        //                   Name = d.dayname
        //               };

        //    ViewBag.days = new SelectList(day, "Id", "Name", currentDayOfWeek);

        //    var hour = today.Hour;

        //    var slottypes = from s in db.slottypes
        //                    where s.slottypeid <= 4
        //                    select new
        //                    {
        //                        Id = s.slottypeid,
        //                        Name = s.duration
        //                    };


        //    if (hour >=0 && hour <=10 || hour >=22 && hour <=23)
        //    {
        //        ViewBag.slottypes = new SelectList(slottypes, "Id", "Name", 1);
        //        var empty = db.Database.SqlQuery<EmptyRooms_Result>("EmptyRooms @dayid, @campus, @slottypeid, @startdate, @enddate", new SqlParameter("@dayid", currentDayOfWeek),
        //                    new SqlParameter("@campus", "90"), new SqlParameter("@slottypeid", "1")
        //                    , new SqlParameter("@startdate", start), new SqlParameter("@enddate", end)).ToList();
        //        vm.empty_rooms = empty;
        //    }
        //    else if(hour >= 11 && hour <= 14)
        //    {
        //        ViewBag.slottypes = new SelectList(slottypes, "Id", "Name", 2);
        //        var empty = db.Database.SqlQuery<EmptyRooms_Result>("EmptyRooms @dayid, @campus, @slottypeid, @startdate, @enddate", new SqlParameter("@dayid", currentDayOfWeek),
        //                    new SqlParameter("@campus", "90"), new SqlParameter("@slottypeid", "2")
        //                    , new SqlParameter("@startdate", start), new SqlParameter("@enddate", end)).ToList();
        //        vm.empty_rooms = empty;
        //    }
        //    else if(hour >= 15 && hour <= 17)
        //    {
        //        ViewBag.slottypes = new SelectList(slottypes, "Id", "Name", 3);
        //        var empty = db.Database.SqlQuery<EmptyRooms_Result>("EmptyRooms @dayid, @campus, @slottypeid, @startdate, @enddate", new SqlParameter("@dayid", currentDayOfWeek),
        //                    new SqlParameter("@campus", "90"), new SqlParameter("@slottypeid", "3")
        //                    , new SqlParameter("@startdate", start), new SqlParameter("@enddate", end)).ToList();
        //        vm.empty_rooms = empty;
        //    }
        //    else if(hour >= 18 && hour <= 21)
        //    {
        //        ViewBag.slottypes = new SelectList(slottypes, "Id", "Name", 4);
        //        var empty = db.Database.SqlQuery<EmptyRooms_Result>("EmptyRooms @dayid, @campus, @slottypeid, @startdate, @enddate", new SqlParameter("@dayid", currentDayOfWeek),
        //                     new SqlParameter("@campus", "90"), new SqlParameter("@slottypeid", "4")
        //                     , new SqlParameter("@startdate", start), new SqlParameter("@enddate", end)).ToList();
        //        vm.empty_rooms = empty;
        //    }



        //    return View(vm);
        //}

        public ActionResult AddTeacher()
        {
            CombineScheduleVM vm = new CombineScheduleVM();

            vm.teachers = db.teachers.ToList();


            return(View(vm));
        }
示例#2
0
        public ActionResult Index()
        {
            CombineScheduleVM vmm = new CombineScheduleVM();
            FilterScheduleVM  vm  = new FilterScheduleVM();

            vmm.ListByCampus();
            vm.day       = db.days.ToList();
            vm.vslottype = db.vslottypes.ToList();


            return(View(vm));
        }
示例#3
0
        public ActionResult Sample()
        {
            CombineScheduleVM vm = new CombineScheduleVM();

            vm.days       = db.days.ToList();
            vm.vslottypes = db.vslottypes.ToList();
            //vm.slottypes = db.slottypes.Where(st => st.slottype1 == 1).ToList();
            vm.rooms = db.rooms.Where(c => c.campus == "90").ToList();



            return(View(vm));
        }
示例#4
0
        // GET: Admin
        public ActionResult IndexOld()
        {
            CombineScheduleVM vm = new CombineScheduleVM();

            vm.days       = db.days.ToList();
            vm.rooms      = db.rooms.ToList();
            vm.slottypes  = db.slottypes.Where(st => st.slottype1 == 1).ToList();
            vm.vslottypes = db.vslottypes.ToList();


            vm.hSchedule = vm.ListByCampus();

            return(View(vm));
        }
        public ActionResult AddRoomCapacity()
        {
            CombineScheduleVM vm = new CombineScheduleVM();

            vm.dOffCourses = ListByCampus();
            vm.slots       = db.slots.ToList();

            //Random rnd = new Random();
            // 1 <= month < 13

            //foreach (room room in db.rooms)
            //{
            //    int classcap = rnd.Next(30, 55);
            //    int labcap = rnd.Next(40, 60);

            //    if (room.roomtype == "class")
            //    {
            //        room.capacity = classcap;
            //    }
            //    else if (room.roomtype == "lab")
            //    {
            //        room.capacity = labcap;
            //    }

            //}
            //foreach (offeredcourse off in db.offeredcourses)
            //{
            //    int classcap = rnd.Next(30, 50);
            //    int labcap = rnd.Next(40, 60);


            //    off.students_count = classcap;

            //}

            ////db.schedules.Find(schid).teacherid = teacherid;

            //db.SaveChanges();
            return(View(vm));
        }
示例#6
0
        // GET: AAC
        public ActionResult Schedule()
        {
            if (Session["Username"] == null)
            {
                return(RedirectToAction("Index", "Login"));
            }
            else
            {
                ViewBag.username = Session["Username"];
                CombineScheduleVM vm = new CombineScheduleVM();
                vm.days       = db.days.ToList();
                vm.vslottypes = db.vslottypes.Where(o => o.occupied == 3).ToList();
                //vm.slottypes = db.slottypes.Where(st => st.slottype1 == 1).ToList();
                vm.rooms = db.rooms.Where(c => c.campus == "90").ToList().OrderBy(c => c.OrderCol);


                //vm.vschedule =
                // db.vschedules.Where(a => a.dayid >= 1 && a.dayid <= 7 && a.campus == "90").ToList();
                //var current_date = DateTime.Now;
                //var current_week = current_date.AddDays(7);
                //DateTime myDate = DateTime.Parse(dateString);
                //string td = "9-19-2016";
                //string tq = "9-25-2016";

                //DateTime start = Convert.ToDateTime(td);
                //DateTime end = Convert.ToDateTime(tq);

                var sdate = db.Semesters.Where(s => s.flag == true).Select(s => s.SemesterStartDate).Single();

                DateTime date1 = Convert.ToDateTime(sdate);

                //DateTime date1 = new DateTime(2016, 09, 05);
                //DateTime date2 = new DateTime(2016, 09, 19);
                DateTime date2 = DateTime.Now;
                //var weeks = ((date2 - date1).TotalDays) / 7;
                //int week = Convert.ToInt32(Math.Floor((date2 - date1).TotalDays / 7));
                int week  = (int)((date2 - date1).TotalDays / 7) + 1;
                var weeks = Enumerable.Range(1, 18).ToList();
                ViewBag.weeks = new SelectList(weeks);
                ViewBag.week  = week;

                List <int> durations = new List <int>(new int[] { 1, 2, 3 });
                ViewBag.weeks = new SelectList(weeks);


                DateTime today            = DateTime.Now;
                int      currentDayOfWeek = (int)today.DayOfWeek;
                DateTime sunday           = today.AddDays(-currentDayOfWeek);
                DateTime monday           = sunday.AddDays(1);

                //DateTime mon = monday.Date.ToString("dd/MM/YYYY");
                if (currentDayOfWeek == 0)
                {
                    monday = monday.AddDays(-7);
                }
                var      dates = Enumerable.Range(0, 7).Select(days => monday.AddDays(days)).ToList();
                DateTime start = dates[0].Date;
                DateTime end   = dates[6].Date;

                DateTime n = start.AddDays(7);
                //ViewBag.currentdate = monday.Date.ToString("dd/MMMM");
                ViewBag.currdate = today.Date.ToString("dd/MMMM");
                ViewBag.currtime = today.Hour;
                //ViewBag.currday = today.Date.ToString("ddd");

                ViewBag.dates = dates;

                vm.WeekWise = db.WeekWises.Where(w => w.Date >= start && w.Date <= end).ToList();

                vm.vschedule = (from a in db.vschedules
                                where ((a.startdate >= start && a.startdate <= end) ||
                                       (a.enddate >= start && a.enddate <= end) || (a.startdate <= start && a.enddate >= end)) && a.campus == "90"
                                orderby a.dayid, a.roomid, a.slottypeid, a.occupied
                                select a).ToList();


                //DateTime first = (FirstDateOfWeekISO8601(2016, 17)).AddDays(245);
                //DateTime second = (FirstDateOfWeekISO8601(2016, 17)).AddDays(251);
                return(View(vm));
            }
        }
示例#7
0
        //public ActionResult Schedule()
        //{
        //    CombineScheduleVM vm = new CombineScheduleVM();
        //    vm.days = db.days.ToList();
        //    vm.vslottypes = db.vslottypes.ToList();
        //    //vm.slottypes = db.slottypes.Where(st => st.slottype1 == 1).ToList();
        //    vm.rooms = db.rooms.Where(c => c.campus == "90").ToList();



        //    return View(vm);
        //}



        public ActionResult Schedule()
        {
            //if (Session["Username"] == null)
            //{
            //    return RedirectToAction("Index", "Login");

            //}
            //else
            //{

            CombineScheduleVM vm = new CombineScheduleVM();

            vm.days       = db.days.ToList();
            vm.vslottypes = db.vslottypes.Where(o => o.occupied == 3).ToList();
            //vm.slottypes = db.slottypes.Where(st => st.slottype1 == 1).ToList();
            vm.rooms = db.rooms.Where(c => c.campus == "90").ToList();


            //vm.vschedule =
            // db.vschedules.Where(a => a.dayid >= 1 && a.dayid <= 7 && a.campus == "90").ToList();
            //var current_date = DateTime.Now;
            //var current_week = current_date.AddDays(7);
            //DateTime myDate = DateTime.Parse(dateString);
            //string td = "9-19-2016";
            //string tq = "9-25-2016";

            //DateTime start = Convert.ToDateTime(td);
            //DateTime end = Convert.ToDateTime(tq);

            DateTime date1 = new DateTime(2016, 09, 05);
            //DateTime date2 = new DateTime(2016, 09, 19);
            DateTime date2 = DateTime.Now;
            //var weeks = ((date2 - date1).TotalDays) / 7;
            //int week = Convert.ToInt32(Math.Floor((date2 - date1).TotalDays / 7));
            int week  = (int)((date2 - date1).TotalDays / 7) + 1;
            var weeks = Enumerable.Range(1, 18).ToList();

            ViewBag.weeks = new SelectList(weeks);
            ViewBag.week  = week;

            DateTime today            = DateTime.Now;
            int      currentDayOfWeek = (int)today.DayOfWeek;
            DateTime sunday           = today.AddDays(-currentDayOfWeek);
            DateTime monday           = sunday.AddDays(1);

            //DateTime mon = monday.Date.ToString("dd/MM/YYYY");
            if (currentDayOfWeek == 0)
            {
                monday = monday.AddDays(-7);
            }
            var      dates = Enumerable.Range(0, 7).Select(days => monday.AddDays(days)).ToList();
            DateTime start = dates[0].Date;
            DateTime end   = dates[6].Date;

            DateTime n = start.AddDays(7);

            //ViewBag.currentdate = monday.Date.ToString("dd/MMMM");
            ViewBag.currdate = today.Date.ToString("dd/MMMM");
            ViewBag.currtime = today.Hour;
            //ViewBag.currday = today.Date.ToString("ddd");

            ViewBag.dates = dates;
            //select * from vschedule where campus =90 and StartDate>='9/5/2016' and StartDate<='9/11/2016';



            //   SELECT* from vschedule where

            //  ((StartDate BETWEEN '9/26/2016' and '10/2/2016') OR
            //  (EndDate BETWEEN '9/26/2016'and '10/2/2016') OR
            //   StartDate <= '9/26/2016' AND EndDate >= '10/2/2016')
            //and campus = 90

            vm.WeekWise = db.WeekWises.Where(w => w.Date >= start && w.Date <= end).ToList();

            vm.vschedule = (from a in db.vschedules
                            where ((a.startdate >= start && a.startdate <= end) ||
                                   (a.enddate >= start && a.enddate <= end) || (a.startdate <= start && a.enddate >= end)) && a.campus == "90"
                            orderby a.dayid, a.roomid, a.slottypeid, a.occupied
                            select a).ToList();



            //vm.vschedule = (from a in db.vschedules where (a.dayid >= 1 && a.dayid <= 7) && (a.campus == "90" &&
            //                a.startdate >= start) && (a.startdate <= end) || (a.startdate == start &&
            //                a.enddate != end) && (a.campus=="90") orderby a.dayid, a.roomid, a.slottypeid, a.occupied select a).ToList();

            //select* from vschedule where campus = 90 and StartDate>= '9/12/2016' and StartDate<= '9/17/2016' or StartDate = '9/5/2016' and EndDate!= '9/11/2016' and campus = 90;
            //vm.vschedule = (from a in db.vschedules where a.dayid >= 1 && a.dayid <= 7 && a.campus == "90" orderby a.dayid, a.roomid, a.slottypeid, a.occupied select a).ToList();

            //var sch = db.vschedules.Where(d => d.dayid == 1 && d.slottypeid == 4 && d.roomid == 6);

            //    if (sch.Count()>0)
            //        {

            //        }
            //    else
            //        {
            //    int a = 0;
            //}

            DateTime first  = (FirstDateOfWeekISO8601(2016, 17)).AddDays(245);
            DateTime second = (FirstDateOfWeekISO8601(2016, 17)).AddDays(251);

            return(View(vm));
            //}
        }
示例#8
0
        public ActionResult ScheduleHashMap()
        {
            //if (Session["Username"] == null)
            //{
            //    return RedirectToAction("Index", "Login");

            //}
            //else
            //{

            CombineScheduleVM vm = new CombineScheduleVM();

            vm.days       = db.days.ToList();
            vm.vslottypes = db.vslottypes.Where(o => o.occupied == 3).ToList();
            //vm.slottypes = db.slottypes.Where(st => st.slottype1 == 1).ToList();
            vm.rooms = db.rooms.Where(c => c.campus == "90").ToList();
            //vm.vschedule =
            // db.vschedules.Where(a => a.dayid >= 1 && a.dayid <= 7 && a.campus == "90").ToList();
            //var current_date = DateTime.Now;
            //var current_week = current_date.AddDays(7);
            //DateTime myDate = DateTime.Parse(dateString);
            //string td = "9-19-2016";
            //string tq = "9-25-2016";

            //DateTime start = Convert.ToDateTime(td);
            //DateTime end = Convert.ToDateTime(tq);


            DateTime today            = DateTime.Today;
            int      currentDayOfWeek = (int)today.DayOfWeek;
            DateTime sunday           = today.AddDays(-currentDayOfWeek);
            DateTime monday           = sunday.AddDays(1);

            //DateTime mon = monday.Date.ToString("dd/MM/YYYY");
            if (currentDayOfWeek == 0)
            {
                monday = monday.AddDays(-7);
            }
            var      dates = Enumerable.Range(0, 7).Select(days => monday.AddDays(days)).ToList();
            DateTime start = dates[0];
            DateTime end   = dates[6];

            DateTime n = start.AddDays(7);

            //ViewBag.currentdate = monday.Date.ToString("dd/MMMM");
            ViewBag.currdate = today.Date.ToString("dd/MMMM");
            ViewBag.dates    = dates;
            //select * from vschedule where campus =90 and StartDate>='9/5/2016' and StartDate<='9/11/2016';



            //   SELECT* from vschedule where

            //  ((StartDate BETWEEN '9/26/2016' and '10/2/2016') OR
            //  (EndDate BETWEEN '9/26/2016'and '10/2/2016') OR
            //   StartDate <= '9/26/2016' AND EndDate >= '10/2/2016')
            //and campus = 90

            vm.vschedule = (from a in db.vschedules
                            where ((a.startdate >= start && a.startdate <= end) ||
                                   (a.enddate >= start && a.enddate <= end) || (a.startdate <= start && a.enddate >= end)) && a.campus == "90"
                            orderby a.dayid, a.roomid, a.slottypeid, a.occupied
                            select a).ToList();


            Dictionary <string, List <vschedule> > hSchedule = new Dictionary <string, List <vschedule> >();

            string key, pkey = null;

            List <vschedule> alSch = (from a in db.vschedules
                                      where
                                      ((a.startdate >= start && a.startdate <= end) ||
                                       (a.enddate >= start && a.enddate <= end) || (a.startdate <= start && a.enddate >= end)) &&
                                      a.campus == "90"
                                      orderby a.dayid, a.roomid, a.slottypeid, a.occupied
                                      select a).ToList();

            List <vschedule> alSch1 = new List <vschedule>();

            foreach (var sch in alSch)
            {
                key = sch.dayid.ToString() + "-" + sch.roomid.ToString() + "-" + sch.slottypeid.ToString() + "-" + sch.occupied;
                if (key.Equals(pkey))
                {
                    alSch1.Add(sch);
                }
                else
                {
                    alSch1 = new List <vschedule>();
                    alSch1.Add(sch);
                }
                hSchedule[key] = alSch1;

                pkey = key;
            }


            vm.hSchedule = hSchedule;



            //vm.vschedule = (from a in db.vschedules where (a.dayid >= 1 && a.dayid <= 7) && (a.campus == "90" &&
            //                a.startdate >= start) && (a.startdate <= end) || (a.startdate == start &&
            //                a.enddate != end) && (a.campus=="90") orderby a.dayid, a.roomid, a.slottypeid, a.occupied select a).ToList();

            //select* from vschedule where campus = 90 and StartDate>= '9/12/2016' and StartDate<= '9/17/2016' or StartDate = '9/5/2016' and EndDate!= '9/11/2016' and campus = 90;
            //vm.vschedule = (from a in db.vschedules where a.dayid >= 1 && a.dayid <= 7 && a.campus == "90" orderby a.dayid, a.roomid, a.slottypeid, a.occupied select a).ToList();

            //var sch = db.vschedules.Where(d => d.dayid == 1 && d.slottypeid == 4 && d.roomid == 6);

            //    if (sch.Count()>0)
            //        {

            //        }
            //    else
            //        {
            //    int a = 0;
            //}


            return(View(vm));
            //}
        }
示例#9
0
        // GET: Sample
        public ActionResult LiveData()
        {
            DBEntities        db = new DBEntities();
            CombineScheduleVM vm = new CombineScheduleVM();

            vm.days       = db.days.ToList();
            vm.vslottypes = db.vslottypes.Where(o => o.occupied == 3).ToList();
            //vm.slottypes = db.slottypes.Where(st => st.slottype1 == 1).ToList();
            vm.rooms = db.rooms.Where(c => c.campus == "90").ToList().OrderBy(c => c.OrderCol);


            //vm.vschedule =
            // db.vschedules.Where(a => a.dayid >= 1 && a.dayid <= 7 && a.campus == "90").ToList();
            //var current_date = DateTime.Now;
            //var current_week = current_date.AddDays(7);
            //DateTime myDate = DateTime.Parse(dateString);
            //string td = "9-19-2016";
            //string tq = "9-25-2016";

            //DateTime start = Convert.ToDateTime(td);
            //DateTime end = Convert.ToDateTime(tq);

            DateTime date1 = new DateTime(2016, 09, 05);
            //DateTime date2 = new DateTime(2016, 09, 11);
            DateTime date2 = DateTime.Now;
            //var weeks = ((date2 - date1).TotalDays) / 7;
            //int week = Convert.ToInt32(Math.Floor((date2 - date1).TotalDays / 7));
            int week  = (int)((date2 - date1).TotalDays / 7) + 1;
            var weeks = Enumerable.Range(1, 18).ToList();

            ViewBag.weeks = new SelectList(weeks);
            ViewBag.week  = week;

            List <int> durations = new List <int>(new int[] { 1, 2, 3 });

            ViewBag.weeks = new SelectList(weeks);


            DateTime today            = DateTime.Now;
            int      currentDayOfWeek = (int)today.DayOfWeek;
            DateTime sunday           = today.AddDays(-currentDayOfWeek);
            DateTime monday           = sunday.AddDays(1);

            //DateTime mon = monday.Date.ToString("dd/MM/YYYY");
            if (currentDayOfWeek == 0)
            {
                monday = monday.AddDays(-7);
            }
            var      dates = Enumerable.Range(0, 7).Select(days => monday.AddDays(days)).ToList();
            DateTime start = dates[0].Date;
            DateTime end   = dates[6].Date;

            DateTime n = start.AddDays(7);

            //ViewBag.currentdate = monday.Date.ToString("dd/MMMM");
            ViewBag.currdate = today.Date.ToString("dd/MMMM");
            ViewBag.currtime = today.Hour;
            //ViewBag.currday = today.Date.ToString("ddd");

            ViewBag.dates = dates;

            vm.WeekWise = db.WeekWises.Where(w => w.Date >= start && w.Date <= end).ToList();

            vm.vschedule = (from a in db.vschedules
                            where ((a.startdate >= start && a.startdate <= end) ||
                                   (a.enddate >= start && a.enddate <= end) || (a.startdate <= start && a.enddate >= end)) && a.campus == "90" && a.schid > 580
                            orderby a.dayid, a.roomid, a.slottypeid, a.occupied
                            select a).ToList();


            return(View(vm));
        }
示例#10
0
        // GET: PM
        public ActionResult ISchedule()
        {
            CombineScheduleVM vm = new CombineScheduleVM();

            vm.days       = db.days.ToList();
            vm.vslottypes = db.vslottypes.Where(o => o.occupied == 3).ToList();

            vm.sections = db.sections.Where(a => a.sectionname.Contains("BCS/BS") && a.STID == 1).ToList();
            //vm.slottypes = db.slottypes.Where(st => st.slottype1 == 1).ToList();
            //vm.rooms = db.rooms.ToList();

            var sdate = db.Semesters.Where(s => s.flag == true).Select(s => s.SemesterStartDate).Single();

            DateTime date1 = Convert.ToDateTime(sdate);

            //DateTime date1 = new DateTime(2016, 09, 05);
            //DateTime date2 = new DateTime(2016, 09, 19);
            DateTime date2 = DateTime.Now;
            //var weeks = ((date2 - date1).TotalDays) / 7;
            //int week = Convert.ToInt32(Math.Floor((date2 - date1).TotalDays / 7));
            int week  = (int)((date2 - date1).TotalDays / 7) + 1;
            var weeks = Enumerable.Range(1, 18).ToList();

            ViewBag.weeks = new SelectList(weeks);
            ViewBag.week  = week;

            List <int> durations = new List <int>(new int[] { 1, 2, 3 });

            ViewBag.weeks = new SelectList(weeks);


            DateTime today            = DateTime.Now;
            int      currentDayOfWeek = (int)today.DayOfWeek;
            DateTime sunday           = today.AddDays(-currentDayOfWeek);
            DateTime monday           = sunday.AddDays(1);

            //DateTime mon = monday.Date.ToString("dd/MM/YYYY");
            if (currentDayOfWeek == 0)
            {
                monday = monday.AddDays(-7);
            }
            var      dates = Enumerable.Range(0, 7).Select(days => monday.AddDays(days)).ToList();
            DateTime start = dates[0].Date;
            DateTime end   = dates[6].Date;



            //select* from vschedule where secid = 1 and slottypeid = 1 and dayid = 1



            vm.vschedule = (from a in db.vschedules
                            where ((a.startdate >= start && a.startdate <= end) ||
                                   (a.enddate >= start && a.enddate <= end) || (a.startdate <= start && a.enddate >= end)) &&
                            a.flag == true &&
                            a.sectionname.Contains("BCS/BS")
                            orderby a.dayid, a.slottypeid, a.secid, a.occupied
                            select a).ToList();

            return(View(vm));
        }