public int UserInfoUpdate(UserInfoUpdateRequest request) { UserLoginRequest userInfoReq = new UserLoginRequest(); userInfoReq.UserName = request.UserName; userInfoReq.PassWord = request.PassWord; UserInfoResponse userInfoRes = UserLogin(userInfoReq); UserInfoRequestModel userInfoModel = AutoMappingUtils.ConvertTo <UserInfoRequestModel>(request); if (userInfoRes != null) { userInfoModel.UID = userInfoRes.UID; userInfoModel.UserNO = userInfoRes.UserNO; userInfoModel.UserName = userInfoRes.UserName; userInfoModel.UserEmail = userInfoRes.UserEmail; userInfoModel.PassWord = request.NewPassWord; return(_userInfoDal.UserInfoUpdate(userInfoModel)); } else { return(0); } }
public UserInfoResponse UserLogin(UserLoginRequest request) { UserInfoRequestModel userInfoModel = AutoMappingUtils.ConvertTo <UserInfoRequestModel>(request); UserInfoResponse response = AutoMappingUtils.ConvertTo <UserInfoResponse>(_userInfoDal.UserLogin(userInfoModel)); return(response); }
public UserInfoResponseModel UserLogin(UserInfoRequestModel request) { var obj = db.UserInfo.ToList().Find(i => i.UserName == request.UserName); UserInfoResponseModel response = AutoMappingUtils.ConvertTo <UserInfoResponseModel>(obj); return(response); }
public UserInfoResponse UserRegister(UserRegisterRequest request) { string userNo = "E" + DateTime.Now.ToString("yyyyMMddHHmmss"); UserInfoRequestModel userInfoModel = AutoMappingUtils.ConvertTo <UserInfoRequestModel>(request); userInfoModel.UserNO = userNo; UserInfoResponse response = AutoMappingUtils.ConvertTo <UserInfoResponse>(_userInfoDal.UserRegister(userInfoModel)); return(response); }
/// <summary> /// 获取用户基本信息(包括UnionID机制) /// </summary> /// <param name="openId">普通用户的标识,对当前公众号唯一</param> /// <param name="lang">返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语</param> /// <remarks> /// <![CDATA[https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839]]> /// </remarks> public async Task <UserInfoResultModel> GetInfoAsync(UserInfoRequestModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } string url = $"{ServerHostConfig.DefaultApiHost}/cgi-bin/user/info?access_token={_api.Token?.AccessToken}&openid={model.Openid}&lang={model.Lang}"; return((await HttpService.GetAsync <UserInfoResultModel>(url)).Data); }
public void UserInfoObjectTest(string userId) { var modelAct = new UserInfoRequestModel(userId); var modelExp = new UserInfoRequestModel(userId) { ApiPath = "/api/v3/get_user_info/" + userId, Method = ERestCommands.GET }; var result = modelExp.Equals(modelAct); Assert.IsTrue(result); }
public ServicesResponse <IEnumerable <UserInfoModel> > GetAllDataByFilter(UserInfoRequestModel requestModel) { var methodName = MethodBase.GetCurrentMethod().GetMethodName(); try { var data = cache.GetAllCachedData().AsQueryable(); var predicate = PredicateBuilderHelper.True <UserInfoModel>(); #region Filter Condition if (!requestModel.UserId.IsNullOrLessOrEqToZero()) { predicate = predicate.Or(q => q.Id == requestModel.UserId); } if (!requestModel.UserNo.IsNullOrEmpty()) { predicate = predicate.Or(q => q.UserNo == requestModel.UserNo); } if (!requestModel.UserName.IsNullOrEmpty()) { predicate = predicate.Or(q => q.UserName.Contains(requestModel.UserName)); } if (!requestModel.FullName.IsNullOrEmpty()) { predicate = predicate.Or(q => q.FullName.Contains(requestModel.FullName)); } #endregion var result = data.Where(predicate).AsEnumerable(); return(GlobalHelper.CreateServicesResponse(result)); } catch (FattalDbException ex) { logger.AddErrorLog(LogTypeEnum.Error, methodName, null, ex.ExceptionMessageProp, ex); return(GlobalHelper.CreateServicesErrorResponse <IEnumerable <UserInfoModel> >(ex.ExceptionMessageProp, ex.ErrorTypeProp)); } catch (KnownException ex) { return(GlobalHelper.CreateServicesErrorResponse <IEnumerable <UserInfoModel> >(ex.ExceptionMessageProp, ex.ErrorTypeProp)); } catch (Exception ex) { logger.AddErrorLog(LogTypeEnum.Error, methodName, null, ex.Message, ex); return(GlobalHelper.CreateServicesErrorResponse <IEnumerable <UserInfoModel> >()); } }
public static UserInfoResponseModel GetUserInfoResponseModel(UserInfoRequestModel request) { var response = new UserInfoResponseModel(); var userSettings = SettingService.GetSettings(request.Id); ChatLocoContext DbContext = new ChatLocoContext(); UserDTO user = DbContext.Users.FirstOrDefault(u => u.Id == request.Id); response.DefaultHandle = userSettings.DefaultHandle; response.Username = user.Username; response.Email = userSettings.Email; return(response); }
public UserInfoResponseModel UserRegister(UserInfoRequestModel request) { UserInfoResponseModel response = new UserInfoResponseModel(); UserInfoResponseModel userData = new UserInfoResponseModel() { UserName = request.UserName, UserNO = request.UserNO, PassWord = request.PassWord }; db.UserInfo.Add(userData); int result = db.SaveChanges(); if (result == 1) { response.UserNO = request.UserNO; } return(response); }
public int UserInfoUpdate(UserInfoRequestModel request) { EntityFrameworkDbContext _db = new EntityFrameworkDbContext(); //修改需要对主键赋值,注意:这里需要对所有字段赋值,没有赋值的字段会用NULL更新到数据库 var user = new UserInfoResponseModel { UID = request.UID, UserNO = request.UserNO, UserName = request.UserName, UserEmail = request.UserEmail, PassWord = request.NewPassWord }; //将实体附加到对象管理器中 _db.UserInfo.Attach(user); //获取到状态实体,可以修改其状态 var setEntry = ((IObjectContextAdapter)_db).ObjectContext.ObjectStateManager.GetObjectStateEntry(user); //只修改实体属性 setEntry.SetModifiedProperty("PassWord"); return(_db.SaveChanges()); }
public async Task <ActionResult> Index() { UserInfoInCartResponseModel responseContent = null; using (HttpClient client = new HttpClient()) { var uid = User.Identity.GetUserId(); string actionPath = "Account/GetUserInfo"; client.BaseAddress = baseApiUrl; client.DefaultRequestHeaders.Authorization = AuthHandler.AuthenticationHeader(); UserInfoRequestModel msModel = new UserInfoRequestModel() { UserId = uid//"33669f22-43da-4f5d-b801-91ade07afc5d" }; HttpResponseMessage response = await client.PostAsJsonAsync(actionPath, msModel); if (response.IsSuccessStatusCode) { responseContent = await response.Content.ReadAsAsync <UserInfoInCartResponseModel>(); } } return(View(responseContent)); }
public PartialViewResult GetUserInfo(UserInfoRequestModel request) { var model = UserService.GetUserInfoResponseModel(request); return(PartialView("~/Views/User/_UserInfo.cshtml", model)); }