Пример #1
0
        /// <summary>
        /// 0:不可报名
        /// 1:可直接报名
        /// 2:可报名,需排队
        /// 3:报名失败
        /// 4:不可报名,排队已关闭
        /// 5:不可报名,报名已关闭
        /// </summary>
        public int GetCanSignup(out int num, int courseId, int userId, double timespan)
        {
            var flag = _courseOrderDB.GetCanSignup(out num, courseId, timespan);

            if (flag == 1)
            {
                try
                {
                    var course = _courseDB.GetCo_Course(courseId);
                    Add(new Cl_CourseOrder
                    {
                        CourseId        = courseId,
                        UserId          = userId,
                        OrderTime       = DateTime.Now,
                        OrderStatus     = 1,
                        OrderEndTime    = course.StartTime.AddHours(timespan * -1),
                        IsAppoint       = 0,
                        CourseStartTime = course.StartTime,
                        CourseEndTime   = course.EndTime,
                        CourseName      = course.CourseName,
                        PassStatus      = 2,
                        FtriggerFlag    = 0,
                        DropType        = 0,
                        DropReason      = ""
                    });
                    return(1);
                }
                catch
                {
                    return(3);
                }
            }
            return(flag);
        }