示例#1
0
        /// <summary>
        /// 预订课程
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public BookingCourseResponse BookingCourse(BookingCourseRequest request)
        {
            var result = new BookingCourseResponse()
            {
                Result        = true,
                ResultMessage = "预订课程成功"
            };

            try
            {
                //var courseBooking = new coursebooking()
                //{
                //    UserID = request.UserID,
                //    CourseNumber = request.CourseNumber,
                //    CoachNumber = request.CoachNumber,
                //    BookingTime = DateTime.Now,
                //    CourseTime = request.CourseTime,
                //    Hours = request.Hours,
                //    IsDelegated = request.IsDelegated,
                //    IsNotified = true,
                //    BookingStatus = 0,
                //    DataChange_CreateTime = DateTime.Now,
                //    DataChange_LastTime = DateTime.Now
                //};

                //db.coursebookings.Add(courseBooking);

                //var courseUser = db.courseusers.Where(p => p.UserID == request.UserID && p.CourseNumber == request.CourseNumber).ToList();
                //if (courseUser == null || courseUser.Count == 0)
                //{
                //    db.courseusers.Add(new courseuser()
                //    {
                //        CourseNumber = request.CourseNumber,
                //        UserID = request.UserID,
                //        CoachNumber = request.CoachNumber,
                //        DataChange_CreateTime = DateTime.Now,
                //        DataChange_LastTime = DateTime.Now
                //    });
                //}

                //db.SaveChanges();
            }
            catch (Exception ex)
            {
                result.Result        = false;
                result.ResultMessage = "预订课程异常";
                result.Errors.Add(ex.Message);
            }

            return(result);
        }
示例#2
0
        public BookingCourseResponse BookingCourse(BookingCourseRequest request)
        {
            var result = new BookingCourseResponse()
            {
                ResultMessage = "预约公益课成功",
                Result        = ResultCode.Success
            };

            try
            {
                using (var con = new DbConnectionProvider(dbName).GetOpenConnection())
                {
                    var parms = new DynamicParameters();
                    parms.Add("P_UserID", request.BookingInfo.UserID, DbType.Int32);
                    parms.Add("P_CourseTypeID", request.BookingInfo.CourseTypeID, DbType.Int32);
                    parms.Add("P_CoachID", request.BookingInfo.CoachID, DbType.Int32);
                    parms.Add("P_CourseDate", request.BookingInfo.CourseDate, DbType.DateTime);
                    parms.Add("P_Hours", request.BookingInfo.Hours, DbType.Int32);
                    parms.Add("P_GymAddress", request.BookingInfo.GymAddress, DbType.String);
                    parms.Add("P_Remark", request.BookingInfo.Remark, DbType.String);

                    result.CourseBookingID = con.ExecuteScalar <int>("sp_BookingCourse"
                                                                     , parms
                                                                     , CommandType.StoredProcedure);
                }
            }
            catch (Exception ex)
            {
                result.ResultMessage = "预约公益课异常";
                result.Result        = ResultCode.Error;
                result.Errors        = new List <string>();
                result.Errors.Add(ex.Message);
                LogHelper.WriteErrorLog(ex);
            }
            return(result);
        }
 public BookingCourseResponse BookingCourse(BookingCourseRequest request)
 {
     return(FiveStarCoachManager.GetInstance().BookingCourse(request));
 }
 public BookingCourseResponse BookingCourse(BookingCourseRequest request)
 {
     return(CourseBookingManager.GetInstance().BookingCourse(request));
 }