Beispiel #1
0
        public int CreateClassroom(Classroom_lkpInfo info)
        {
            if (info == null)
            {
                throw new Exception(ExceptionMessage.InputParameterNull);
            }

            using (SqlConnectionManager cm = new SqlConnectionManager())
            {
                Nullable<int> classroom_id = null;
                using(var cmd = new Classroom_lkp_Save_p())
                {
                    cmd.Parameters.IsInsert = true;

                    cmd.Parameters.Classroom_id = info.Classroom_id;
                    cmd.Parameters.School_id = info.School_id;
                    cmd.Parameters.IsDeleted = info.IsDeleted;
                    cmd.Parameters.ClassroomName = info.ClassroomName;
                    cmd.Parameters.Classroom_Blurb_id = info.Classroom_Blurb_id;
                    cmd.Parameters.DefaultPhysicalCapacity = info.DefaultPhysicalCapacity;
                    cmd.Parameters.DisplayOrder = info.DisplayOrder;
                    cmd.Parameters.Insertby = info.Insertby;
                    cmd.Parameters.Updateby = info.Updateby;
                    cmd.Parameters.IsHidden = info.IsHidden;

                    cm.ExecuteNonQuery(cmd, _context);
                    classroom_id = cmd.Parameters.Classroom_id;
                    if (!classroom_id.HasValue)
                    {
                        throw new Exception(ExceptionMessage.NoIdReturnedForCreatedObject);
                    }
                }
                return classroom_id.Value;
            }
        }
Beispiel #2
0
        public bool IsAvailable(int scheduledClass_id, int classRoom_id, DateTime startDate, DateTime endDate)
        {
            using (var cm = new SqlConnectionManager())
            {
                using (var cmd = new Classroom_IsAvailable_p())
                {
                    cmd.Parameters.ScheduledClass_id = scheduledClass_id;
                    cmd.Parameters.ClassRoom_id = classRoom_id;
                    cmd.Parameters.BeginDate = startDate;
                    cmd.Parameters.EndDate = endDate;
                    cmd.Parameters.IsAvailable = false;

                    cm.ExecuteNonQuery(cmd, _context);
                    return cmd.Parameters.IsAvailable.GetValueOrDefault();
                }
            }
        }
Beispiel #3
0
        private DateTime? GetLastDateClassroomScheduled(int classRoomId)
        {
            using (var cm = new SqlConnectionManager())
            {
                using (var cmd = new Classroom_GetLastDateScheduled_p())
                {
                    cmd.Parameters.ClassRoom_id = classRoomId;
                    cmd.Parameters.LastDate = null;

                    cm.ExecuteNonQuery(cmd, _context);

                    return cmd.Parameters.LastDate;
                }
            }
        }
Beispiel #4
0
        public void UpdateClassroom(Classroom_lkpInfo info)
        {
            if (info == null)
            {
                throw new Exception(ExceptionMessage.InputParameterNull);
            }

            using (SqlConnectionManager cm = new SqlConnectionManager())
            {
                using (var cmd = new Classroom_lkp_Save_p())
                {
                    cmd.Parameters.IsInsert = false;

                    cmd.Parameters.Classroom_id = info.Classroom_id;
                    cmd.Parameters.School_id = info.School_id;
                    cmd.Parameters.IsDeleted = info.IsDeleted;
                    cmd.Parameters.ClassroomName = info.ClassroomName;
                    cmd.Parameters.Classroom_Blurb_id = info.Classroom_Blurb_id;
                    cmd.Parameters.DefaultPhysicalCapacity = info.DefaultPhysicalCapacity;
                    cmd.Parameters.DisplayOrder = info.DisplayOrder;
                    cmd.Parameters.Insertby = info.Insertby;
                    cmd.Parameters.Updateby = info.Updateby;
                    cmd.Parameters.IsHidden = info.IsHidden;

                    cm.ExecuteNonQuery(cmd, _context);
                }
            }
        }