Ejemplo n.º 1
0
        /// <summary>
        /// 课程【特殊人群/指定】报名
        /// </summary>
        /// <param name="courseId">课程Id</param>
        /// <param name="courseName">课程名称</param>
        /// <param name="courseStartTime">课程开始时间</param>
        /// <param name="courseEndTime">课程结束时间</param>
        /// <param name="isAppoint">1:部门指定;2:总所指定</param>
        /// <param name="userIds">学员Id</param>
        /// <param name="timespan">排队状态更改为正常预定状态的时间点</param>
        public void AddSpecialCrowdUserToCourse(int courseId, string courseName, DateTime courseStartTime, DateTime courseEndTime, int isAppoint, string userIds, double timespan)
        {
            var ids = userIds.Split(',');
            int num = 0;

            for (int i = 0; i < ids.Length; i++)
            {
                if (string.IsNullOrWhiteSpace(ids[i]))
                {
                    continue;
                }
                try
                {
                    int flag = _courseOrderDB.GetCanSignupSpecialCrowdUserToCourse(out num, courseId, timespan);
                    if (flag == 1 || flag == 2)
                    {
                        Add(new Cl_CourseOrder
                        {
                            CourseId        = courseId,
                            UserId          = Convert.ToInt32(ids[i]),
                            OrderTime       = DateTime.Now,
                            OrderStatus     = flag,
                            OrderEndTime    = courseStartTime.AddHours(timespan * -1),
                            IsAppoint       = isAppoint,
                            CourseStartTime = courseStartTime,
                            CourseEndTime   = courseEndTime,
                            CourseName      = courseName,
                            PassStatus      = 2,
                            FtriggerFlag    = 0
                        });
                    }
                }
                catch
                {
                }
            }
        }