Example #1
0
        /// <summary>
        /// 更新课程预订信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public UpdateCourseBookingResponse UpdateCourseBooking(UpdateCourseBookingRequest request)
        {
            var result = new UpdateCourseBookingResponse()
            {
                Result        = true,
                ResultMessage = "更新课程预订信息成功"
            };

            try
            {
                //string sql = string.Format(@"UPDATE CourseBooking SET BookingTime='{0}',Hours={1},CourseTime='{2}',IsNotified=1 WHERE CourseBookingID={3}",
                //                request.BookingTime.ToString("yyyy-MM-dd HH:mm:ss"),
                //                request.Hours,
                //                request.CourseTime.ToString("yyyy-MM-dd HH:mm:ss"),
                //                request.CourseBookingID);
                //int res = db.Database.ExecuteSqlCommand(sql);
                //if (res == 0)
                //{
                //    return new UpdateCourseBookingResponse()
                //    {
                //        Result = false,
                //        ResultMessage = "更新课程预订信息失败"
                //    };
                //}
            }
            catch (Exception ex)
            {
                result.Result        = false;
                result.ResultMessage = "更新课程预订信息异常";
                result.Errors.Add(ex.Message);
            }

            return(result);
        }
Example #2
0
        public UpdateCourseBookingResponse UpdateCourseBooking(UpdateCourseBookingRequest request)
        {
            var result = new UpdateCourseBookingResponse()
            {
                ResultMessage = "更新公益课信息成功",
                Result        = ResultCode.Success
            };

            try
            {
                using (var con = new DbConnectionProvider(dbName).GetOpenConnection())
                {
                    var parms = new DynamicParameters();
                    parms.Add("P_CourseBookingID", request.CourseBookingID, DbType.Int32);
                    parms.Add("P_CourseBeginTime", request.CourseBeginTime, DbType.DateTime);
                    parms.Add("P_CourseEndTime", request.CourseEndTime, DbType.DateTime);
                    parms.Add("P_CoachID", request.CoachID, DbType.Int32);
                    parms.Add("P_Hours", request.Hours, DbType.Int32);

                    con.ExecuteNoneQuery("sp_UpdateCourseBooking"
                                         , 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);
        }