/// <summary> /// 修改报名信息 /// </summary> /// <returns></returns> public bool UpdateActivtiyUser(LuckyCharmUserModel model) { bool isSuccess = false; try { using (var client = new LuckyCharmClient()) { var request = new UpdateLuckyCharmUserRequest() { AreaId = model.AreaId, AreaName = model.AreaName, Phone = model.Phone, UserName = model.UserName, PKID = model.PKID, ActivityId = model.ActivityId, }; isSuccess = client.UpdateLuckyCharmUser(request).Result; } } catch (Exception e) { Logger.Error($"UpdateActivtiyUser -> {JsonConvert.SerializeObject(model)}", e); throw; } return(isSuccess); }
public static async Task <int> UpdateActivityUser(UpdateLuckyCharmUserRequest model) { string sql = @"Update Activity.dbo.T_LuckyCharmUser set UserName=@UserName,Phone=@Phone,AreaId=@AreaId,AreaName=@AreaName,ActivityId=@ActivityId where PKID=@PKID"; using (var cmd = new SqlCommand(sql)) { cmd.Parameters.AddWithValue("@UserName", model.UserName); cmd.Parameters.AddWithValue("@Phone", model.Phone); cmd.Parameters.AddWithValue("@AreaId", model.AreaId); cmd.Parameters.AddWithValue("@AreaName", model.AreaName); cmd.Parameters.AddWithValue("@PKID", model.PKID); cmd.Parameters.AddWithValue("@ActivityId", model.ActivityId); return(await DbHelper.ExecuteNonQueryAsync(false, cmd)); } }
/// <summary> /// 修改报名用户资料 /// </summary> /// <param name="model"></param> /// <returns></returns> public static async Task <OperationResult <bool> > UpdateActivityUserAsync(UpdateLuckyCharmUserRequest model) { if (model.PKID <= 0 || string.IsNullOrWhiteSpace(model.AreaName) || string.IsNullOrWhiteSpace(model.UserName) || model.Phone.Length != 11) { return(OperationResult.FromError <bool>("1", "参数错误")); } var isUserExist = await DalLuckyCharm.IsExistUserByPKID(model.PKID); var isActivityExist = await DalLuckyCharm.IsExistActivityByPKID(model.ActivityId); if (isUserExist > 0) { return(OperationResult.FromError <bool>("2", "用户已报名")); } if (isActivityExist <= 0) { return(OperationResult.FromError <bool>("1", "活动不存在")); } return(OperationResult.FromResult(await DalLuckyCharm.UpdateActivityUser(model) > 0)); }
public async Task <OperationResult <bool> > UpdateLuckyCharmUserAsync(UpdateLuckyCharmUserRequest request) { return(await LuckyCharmManager.UpdateActivityUserAsync(request)); }