Ejemplo n.º 1
0
        public void Add(HttpRequestBase req)
        {
            TimeTable u_TimeTab;
            List<TimeTable> list_u_TimeTab = new List<TimeTable>();
            for (int i = 0; i < 13; ++i)
            {
                u_TimeTab = new TimeTable()
                {
                    UserID = Convert.ToInt32(req.Cookies[GLB.id].Value),
                    Section = Convert.ToInt16(i + 1),
                    FirstDay = req.Form["row" + i + "cell0"] == "on" ? '1' : '0',
                    SecondDay = req.Form["row" + i + "cell1"] == "on" ? '1' : '0',
                    ThirdDay = req.Form["row" + i + "cell2"] == "on" ? '1' : '0',
                    FourthDay = req.Form["row" + i + "cell3"] == "on" ? '1' : '0',
                    FifthDay = req.Form["row" + i + "cell4"] == "on" ? '1' : '0',
                    SixthDay = req.Form["row" + i + "cell5"] == "on" ? '1' : '0',
                    SeventhDay = req.Form["row" + i + "cell6"] == "on" ? '1' : '0'
                };
                list_u_TimeTab.Add(u_TimeTab);
            }
            tmTabDal = new TimeTableDAL();

            tmTabDal.Add(list_u_TimeTab);
            tmTabDal.ReturnUnitToPool();
        }
Ejemplo n.º 2
0
 //public static TimeTableDAL Instance()
 //{
 //    if (tmTab == null)
 //    {
 //        tmTab = new TimeTableDAL();
 //    }
 //    return tmTab;
 //}
 public void GetDetails(int id)
 {
     dalBase.sql = "SELECT * FROM db_user_timetable WHERE id = @id";
     dalBase.Param = new MySqlParameter("@id", id);
     dalBase.Run(Behavious.SELECT_WITH_SINGLEPARAM, false);
     list_t.Clear();
     while (dalBase.DataRead.Read())
     {
         t = new TimeTable()
         {
             Section = Convert.ToInt16(dalBase.DataRead["class"]),
             FirstDay = Convert.ToChar(dalBase.DataRead["firstDay"]),
             SecondDay = Convert.ToChar(dalBase.DataRead["secondDay"]),
             ThirdDay = Convert.ToChar(dalBase.DataRead["thirdDay"]),
             FourthDay = Convert.ToChar(dalBase.DataRead["fourthDay"]),
             FifthDay = Convert.ToChar(dalBase.DataRead["fifthDay"]),
             SixthDay = Convert.ToChar(dalBase.DataRead["sixthDay"]),
             SeventhDay = Convert.ToChar(dalBase.DataRead["seventhDay"])
         };
         list_t.Add(t);
     }
     dalBase.CloseConnect();
 }