public UpdateCoachDetailResponse UpdateCoachDetail(UpdateCoachDetailRequest request) { return(AdminManager.GetInstance().UpdateCoachDetail(request)); }
/// <summary> /// 更新教练详情 /// </summary> /// <param name="request"></param> /// <returns></returns> public UpdateCoachDetailResponse UpdateCoachDetail(UpdateCoachDetailRequest request) { var result = new UpdateCoachDetailResponse() { Result = true, ResultMessage = "更新教练详情成功" }; try { string sql = @"select CoachNumber from Coach where CoachNumber=?CoachNumber"; var dr = MySqlHelper.ExecuteDataRow(ConfigurationManager.ConnectionStrings[dbName].ConnectionString, sql, new MySqlParameter { ParameterName = "CoachNumber", DbType = DbType.String, Value = request.CoachNumber }); if (dr == null) { result.Result = false; result.ResultMessage = "找不到教练信息"; return(result); } sql = @"update coach set BriefIntroduction=?BriefIntroduction,ContactInfo=?ContactInfo,CourseDesc=?CourseDesc,GymID=?GymID,HeadPortraitUri=?HeadPortraitUri, HonorDesc=?HonorDesc,Level=?Level,PersonalSign=?PersonalSign where CoachNumber=?CoachNumber"; int res = MySqlHelper.ExecuteNonQuery(ConfigurationManager.ConnectionStrings[dbName].ConnectionString, sql, new MySqlParameter() { ParameterName = "BriefIntroduction", Value = request.BriefIntroduction, DbType = DbType.String }, new MySqlParameter() { ParameterName = "ContactInfo", Value = request.ContactInfo, DbType = DbType.String }, new MySqlParameter() { ParameterName = "CourseDesc", Value = request.CourseDesc, DbType = DbType.String }, new MySqlParameter() { ParameterName = "GymID", Value = request.GymID, DbType = DbType.Int32 }, new MySqlParameter() { ParameterName = "HeadPortraitUri", Value = request.HeadPortraitUri, DbType = DbType.String }, new MySqlParameter() { ParameterName = "HonorDesc", Value = request.HonorDesc, DbType = DbType.String }, new MySqlParameter() { ParameterName = "Level", Value = request.Level, DbType = DbType.SByte }, new MySqlParameter() { ParameterName = "PersonalSign", Value = request.PersonalSign, DbType = DbType.String }, new MySqlParameter() { ParameterName = "CoachNumber", Value = request.CoachNumber, DbType = DbType.String }); if (res <= 0) { result.Result = false; result.ResultMessage = "更新教练详情失败"; } } catch (Exception ex) { result.Result = false; result.ResultMessage = "更新教练详情异常"; result.Errors.Add(ex.Message); } return(result); }
public UpdateCoachDetailResponse UpdateCoachDetail(UpdateCoachDetailRequest request) { throw new NotImplementedException(); }