Exemple #1
0
        static Assignment GetFromSO(ConfigurationContext config)
        {
            using (var cmd = new Assignment_Load_p())
            {
                cmd.Parameters.Assignment_id = 99;

                using (var sm = new SqlConnectionManager())
                using (var dr = sm.ExecuteReader(cmd, config))
                {
                    var data = AssignmentInfoAssembler.CreateList(dr)[0];

                    return new Assignment
                    {
                        Assignment_id = data.Assignment_id,
                        AssignmentType = (AssignmentType)Enum.Parse(typeof(AssignmentType), data.AssignmentTypeCode),
                        Parent_id = data.ParentAssignment_id,
                        Title = data.Title,
                    };
                }
            }
        }
Exemple #2
0
        public BookingContextInfo LoadBookingContextInfo(ScheduledClassInfoList classesInfoList, int student_id, DateTime classUtcDate, DateTime studentBookingBeginUtcDate)
        {
            BookingContextInfo result = new BookingContextInfo();

            using (SqlConnectionManager cm = new SqlConnectionManager())
            {
                //
                //  Load Student related data
                //

                using (var cmd = new Student_Load_p())
                {
                    cmd.Parameters.Student_id = student_id;

                    using (SqlDataReader reader = cm.ExecuteReader(cmd, _studentContext))
                    {
                        result.Student = StudentInfoAssembler.CreateList(reader).First();
                    }
                }

                using (Coupon_LoadCount_p cmd = new Coupon_LoadCount_p())
                {
                    cmd.Parameters.Student_id = student_id;

                    using (SqlDataReader reader = cm.ExecuteReader(cmd, _couponContext))
                    {
                        result.StudentCoupon = CouponCountInfoAssembler.CreateList(reader);
                    }
                }

                using (var cmd = new Booking_LoadByStudentDateRange_p())
                {
                    cmd.Parameters.Student_id = student_id;
                    cmd.Parameters.BeginDate = studentBookingBeginUtcDate;
                    cmd.Parameters.EndDate = DateTime.MaxValue;

                    using (SqlDataReader reader = cm.ExecuteReader(cmd, _bookingContext))
                    {
                        result.StudentBookingInfo = new StudentBookingInfoList(BookingInfoAssembler.CreateList(reader));
                    }
                }

                //
                //  Load scheduled class related data
                //
                result.ClassesInfoList = classesInfoList;
                result.BookingInfoListForClasses = new System.Collections.Generic.List<ScheduledClassBookingInfoList>();

                foreach (var c in result.ClassesInfoList.ScheduledClass)
                {
                    using (Booking_LoadByScheduledClass_id_p cmd = new Booking_LoadByScheduledClass_id_p())
                    {
                        cmd.Parameters.ScheduledClass_id = c.ScheduledClass_id;

                        using (SqlDataReader reader = cm.ExecuteReader(cmd, _scheduledClassContext))
                        {
                            var bookingList = BookingInfoAssembler.CreateList(reader);

                            result.BookingInfoListForClasses.Add(new ScheduledClassBookingInfoList(c.ScheduledClass_id, bookingList));
                        }
                    }
                }
            }

            return result;
        }
Exemple #3
0
 public List<Classroom_lkpInfo> LoadClassroomAllWithoutCache()
 {
     List<Classroom_lkpInfo> result = null;
     using(var cm = new SqlConnectionManager())
     {
         using (var cmd = new Classroom_lkp_LoadAll_p())
         {
             using(var reader = cm.ExecuteReader(cmd,_context))
             {
                 result = Classroom_lkpInfoAssembler.CreateList(reader);
             }
         }
     }
     return result;
 }