コード例 #1
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);
        }
コード例 #2
0
        /// <summary>
        /// 更新用户密码
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public UpdatePwdResponse UpdatePwd(UpdatePwdRequest request)
        {
            var result = base.CreateResponse <UpdatePwdResponse>("更新用户密码");

            try
            {
                if (this.ConsumeValidationCode(request.Mobile) == request.ValidationCode)
                {
                    using (var con = new DbConnectionProvider(dbName).GetOpenConnection())
                    {
                        var parms = new DynamicParameters();
                        parms.Add("P_NewPwd", Utility.EncryptHelper.AESEncrypt(request.NewPwd), DbType.String);
                        parms.Add("P_UserID", request.UserID, DbType.Double);

                        con.ExecuteNoneQuery("sp_UpdatePwd", parms, CommandType.StoredProcedure);
                    }
                }
                else
                {
                    result.ResultMessage = "验证码错误";
                }
            }
            catch (Exception ex)
            {
                base.HandleResponseException(ref result, ex);
            }

            return(result);
        }
コード例 #3
0
        public CancelBookingByCustomerResponse CancelBookingByCustomer(CancelBookingByCustomerRequest request)
        {
            var result = new CancelBookingByCustomerResponse()
            {
                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_CancelReason", request.CancelReason, DbType.String);

                    con.ExecuteNoneQuery("sp_CancelBookingByCustomer"
                                         , 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);
        }
コード例 #4
0
        public CheckInResponse CheckIn(CheckInRequest request)
        {
            var result = new CheckInResponse()
            {
                ResultMessage = "签到成功",
                Result        = ResultCode.Success
            };

            try
            {
                using (var con = new DbConnectionProvider(dbName).GetOpenConnection())
                {
                    var parms = new DynamicParameters();
                    parms.Add("P_UserID", request.UserID, DbType.Int32);

                    con.ExecuteNoneQuery("sp_CheckIn"
                                         , 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);
        }
コード例 #5
0
        public ConfirmBookingByCoachResponse ConfirmBookingByCoach(ConfirmBookingByCoachRequest request)
        {
            var result = new ConfirmBookingByCoachResponse()
            {
                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_IsCoachMobilePublic", request.IsCoachMobilePublic, DbType.Boolean);

                    con.ExecuteNoneQuery("sp_ConfirmBookingByCoach"
                                         , 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);
        }
コード例 #6
0
        public UpdateUserInfoResponse UpdateUserInfo(UpdateUserInfoRequest request)
        {
            var result = base.CreateResponse <UpdateUserInfoResponse>("更新用户信息");

            try
            {
                using (var con = new DbConnectionProvider(dbName).GetOpenConnection())
                {
                    var parms = new DynamicParameters();
                    parms.Add("UserID", request.NewUserInfo.UserID, DbType.Int32);
                    parms.Add("Mobile", request.NewUserInfo.Mobile, DbType.String);
                    parms.Add("MobileInfo", request.NewUserInfo.MobileInfo, DbType.String);
                    parms.Add("UserType", request.NewUserInfo.UserType, DbType.SByte);
                    parms.Add("NickName", request.NewUserInfo.NickName, DbType.String);
                    parms.Add("Sex", request.NewUserInfo.Sex, DbType.String);
                    parms.Add("Age", request.NewUserInfo.Age, DbType.SByte);
                    parms.Add("PersonalSign", request.NewUserInfo.PersonalSign, DbType.String);
                    parms.Add("HeadPortraitUri", request.NewUserInfo.HeadPortraitUri, DbType.String);
                    parms.Add("Height", request.NewUserInfo.Height, DbType.Double);
                    parms.Add("Weight", request.NewUserInfo.MobileInfo, DbType.Double);
                    parms.Add("UserStatus", request.NewUserInfo.MobileInfo, DbType.SByte);
                    con.ExecuteNoneQuery("sp_UpdateUserInfo", parms, CommandType.StoredProcedure);
                }
            }
            catch (Exception ex)
            {
                base.HandleResponseException(ref result, ex);
            }
            return(result);
        }
コード例 #7
0
        public UpdateGymLocationResponse UpdateGymLocation(UpdateGymLocationRequest request)
        {
            var result = base.CreateResponse <UpdateGymLocationResponse>("更新场馆地图位置信息");

            try
            {
                using (var con = new DbConnectionProvider(dbName).GetOpenConnection())
                {
                    var parms = new DynamicParameters();
                    parms.Add("GymID", request.GymID, DbType.Int32);
                    parms.Add("Longitude", request.Longitude, DbType.Decimal);
                    parms.Add("Latitude", request.Latitude, DbType.Decimal);

                    con.ExecuteNoneQuery("sp_UpdateGymLocation", parms, CommandType.StoredProcedure);
                }
            }
            catch (Exception ex)
            {
                base.HandleResponseException(ref result, ex);
            }
            return(result);
        }
コード例 #8
0
        public SubmitGymCorrectionResponse SubmitGymCorrection(SubmitGymCorrectionRequest request)
        {
            var result = base.CreateResponse <SubmitGymCorrectionResponse>("提交场馆纠错信息");

            try
            {
                using (var con = new DbConnectionProvider(dbName).GetOpenConnection())
                {
                    var parms = new DynamicParameters();
                    parms.Add("GymID", request.GymID, DbType.Int32);
                    parms.Add("UserID", request.UserID, DbType.Double);
                    parms.Add("Content", request.Content, DbType.String);
                    parms.Add("P_Photos_Json", request.PhotoList != null && request.PhotoList.Count > 0 ? JsonConvert.SerializeObject(request.PhotoList) : string.Empty, DbType.String);

                    con.ExecuteNoneQuery("sp_SubmitGymCorrection", parms, CommandType.StoredProcedure);
                }
            }
            catch (Exception ex)
            {
                base.HandleResponseException(ref result, ex);
            }
            return(result);
        }
コード例 #9
0
        /// <summary>
        /// 发送验证码
        /// </summary>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public SendValidationCodeResponse SendValidationCode(string mobile)
        {
            var result = base.CreateResponse <SendValidationCodeResponse>("发送验证码");

            try
            {
                var validationCode = Utility.SmsValidationHelper.SendValidationCode(mobile);

                //缓存验证码
                using (var con = new DbConnectionProvider(dbName).GetOpenConnection())
                {
                    var parms = new DynamicParameters();
                    parms.Add("P_Mobile", mobile, DbType.String);
                    parms.Add("P_ValidationCode", validationCode, DbType.String);
                    parms.Add("P_ExpireTime", DateTime.Now.AddHours(1), DbType.DateTime);
                    con.ExecuteNoneQuery("sp_AddSmsValidationCode", parms, CommandType.StoredProcedure);
                }
            }
            catch (Exception ex)
            {
                base.HandleResponseException(ref result, ex);
            }
            return(result);
        }