/// <summary> /// 修改活动 /// </summary> /// <returns></returns> public Reseponse <bool> UpdateActivity(T_Activity_xhrModel model, string managerId) { var result = new Reseponse <bool>(); if (string.IsNullOrWhiteSpace(model.Title)) { result.status = 0; result.Message = "标题不能为空!"; return(result); } if (string.IsNullOrWhiteSpace(model.ActivityContent)) { result.status = 0; result.Message = "内容不能为空!"; return(result); } if (string.IsNullOrWhiteSpace(model.StartTime)) { result.status = 0; result.Message = "开始时间不能为空!"; return(result); } if (string.IsNullOrWhiteSpace(model.EndTime)) { result.status = 0; result.Message = "结束时间不能为空!"; return(result); } if (string.IsNullOrWhiteSpace(model.Picture)) { result.status = 0; result.Message = "图片地址不能为空!"; return(result); } if (model.ActStatus < 0) { result.status = 0; result.Message = "请选择正确的活动状态!"; return(result); } if (string.IsNullOrWhiteSpace(managerId)) { result.status = 0; result.Message = "请先登录!"; return(result); } int userid = int.Parse(TuhuCryption.Decrypt(managerId)); DateTimeFormatInfo dtFormat = new DateTimeFormatInfo(); dtFormat.ShortDatePattern = "yyyy-MM-dd"; try { using (var client = new ActivityClient()) { var checkresult = client.CheckLoginAsync(userid); if (!checkresult.Result.Success) { result.status = 0; result.Message = "请先登录!"; return(result); } var request = new Tuhu.Service.Activity.Models.T_Activity_xhrModel() { Title = model.Title, ActivityContent = model.ActivityContent, StartTime = Convert.ToDateTime(model.StartTime, dtFormat), EndTime = Convert.ToDateTime(model.EndTime, dtFormat), Picture = model.Picture, ActStatus = model.ActStatus, ActivityId = model.ActivityID }; var addresult = client.UpdateActivityAsync(request); result.status = addresult.Result.Success ? 1 : 0; result.Message = addresult.Result.ErrorMessage; result.data = addresult.Result.Success; } } catch (Exception e) { Logger.Error($"UpdateActivity -> {JsonConvert.SerializeObject(model)}", e); throw; } return(result); }
/// <summary> /// 修改报名信息 /// </summary> /// <returns></returns> public Reseponse <bool> UpdateActivitiesUserAsync(ActivityUserInfo_xhrRequestModel model, string managerId) { var result = new Reseponse <bool>(); if (string.IsNullOrWhiteSpace(model.UserName)) { result.status = 0; result.Message = "用户名不能为空!"; return(result); } var regex = new Regex("^1[0-9]{10}$"); if (string.IsNullOrWhiteSpace(model.UserTell) || !regex.IsMatch(model.UserTell)) { result.status = 0; result.Message = "请输入正确的手机号!"; return(result); } if (model.AreaID <= 0) { result.status = 0; result.Message = "请选择地区!"; return(result); } if (model.PassStatus < 0) { result.status = 0; result.Message = "请选择正确的审核状态!"; return(result); } if (model.UserStatus < 0) { result.status = 0; result.Message = "请选择正确的用户状态!"; return(result); } int userid = int.Parse(TuhuCryption.Decrypt(managerId)); try { using (var client = new ActivityClient()) { var checkresult = client.CheckLoginAsync(userid); if (!checkresult.Result.Success) { result.status = 0; result.Message = "请先登录!"; return(result); } var request = new Tuhu.Service.Activity.Models.ActivityUserInfo_xhrRequest() { UserId = int.Parse(TuhuCryption.Decrypt(model.UserId)), UserName = model.UserName, UserTell = model.UserTell, AreaID = model.AreaID, PassStatus = model.PassStatus, ActID = model.ActID, UserStatus = model.UserStatus }; var addresult = client.UpdateActivitiesUserAsync(request); result.status = addresult.Result.Success ? 1 : 0; result.Message = addresult.Result.ErrorMessage; result.data = addresult.Result.Success; } } catch (Exception e) { Logger.Error($"UpdateActivitiesUser -> {JsonConvert.SerializeObject(model)}", e); throw; } return(result); }