コード例 #1
0
        public int saveTimeSlot(timeSlotList list)
        {
            int rowCount = 0;

            try
            {
                bo = new ClassBo();
                con.ConnectionString = connStr;
                cmd             = new SqlCommand(ClassBo.insTimeSlot, con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue(bo.P_id, Convert.ToInt32(list.id));
                cmd.Parameters.AddWithValue(bo.P_lecturerToCoursesdId, list.lecturerToCoursesdId);
                cmd.Parameters.AddWithValue(bo.P_timeFrom, list.timeFrom);
                cmd.Parameters.AddWithValue(bo.P_timeTo, list.timeTo);
                cmd.Parameters.AddWithValue(bo.P_room, list.room);
                cmd.Parameters.AddWithValue(bo.P_day, list.day);
                cmd.Parameters.AddWithValue(bo.status, list.status);
                cmd.Parameters.AddWithValue(bo.P_By, 1);
                con.Open();
                rowCount = cmd.ExecuteNonQuery();
                con.Close();
                return(rowCount);
            }
            catch (Exception ex)
            {
                con.Close();
                return(rowCount);
            }
        }
コード例 #2
0
 public DataTable checkTimeSlot(timeSlotList list)
 {
     try
     {
         bo = new ClassBo();
         dt = new DataTable();
         con.ConnectionString = connStr;
         cmd             = new SqlCommand(ClassBo.checkTimeSlot, con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue(bo.P_id, list.id);
         cmd.Parameters.AddWithValue(bo.P_day, list.day);
         cmd.Parameters.AddWithValue(bo.P_timeFrom, list.timeFrom);
         cmd.Parameters.AddWithValue(bo.P_timeTo, list.timeTo);
         con.Open();
         da = new SqlDataAdapter(cmd);
         da.Fill(dt);
         con.Close();
         return(dt);
     }
     catch (Exception ex)
     {
         con.Close();
         return(null);
     }
 }
コード例 #3
0
        public List <timeSlotList> getTimeSlot(int id)
        {
            bl = new ClassBl();
            bo = new ClassBo();
            dt = new DataTable();
            dt = da.getTimeSlot(id);
            List <timeSlotList> list = new List <timeSlotList>();

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    timeSlotList itlist = new timeSlotList();
                    itlist.id = dr[bo.id].ToString();
                    itlist.lecturerToCoursesdId = dr[bo.lecturerToCoursesdId].ToString();
                    itlist.day         = dr[bo.day].ToString();
                    itlist.timeFrom    = dr[bo.timeFrom].ToString();
                    itlist.timeTo      = dr[bo.timeTo].ToString();
                    itlist.room        = dr[bo.room].ToString();
                    itlist.coursesID   = dr[bo.coursesID].ToString();
                    itlist.coursesName = dr[bo.name].ToString();
                    itlist.commonName  = dr[bo.commonName].ToString();
                    itlist.status      = dr[bo.status].ToString() == "I" ? "Inactive" : "Active";
                    switch (dr[bo.day].ToString())
                    {
                    case "1":
                        itlist.dayName = "Monday";
                        break;

                    case "2":
                        itlist.dayName = "Tuesday";
                        break;

                    case "3":
                        itlist.dayName = "Wednesday";
                        break;

                    case "4":
                        itlist.dayName = "Thursday";
                        break;

                    case "5":
                        itlist.dayName = "Friday";
                        break;

                    default:
                        break;
                    }

                    list.Add(itlist);
                }
            }
            return(list);
        }
コード例 #4
0
 public int saveTimeSlot(timeSlotList list)
 {
     bl = new ClassBl();
     da = new ClassDa();
     dt = new DataTable();
     dt = da.checkTimeSlot(list);
     if (dt.Rows.Count > 0)
     {
         return(2);
     }
     else
     {
         return(da.saveTimeSlot(list));
     }
 }
コード例 #5
0
        public static int websaveTimeSlot(timeSlotList list)
        {
            timeslot cl = new timeslot();

            return(cl.saveTimeSlot(list));
        }