private void button1_Click(object sender, EventArgs e) { UserInfoData userInfoData = new UserInfoData(); if (string.IsNullOrEmpty(textBox1.Text)) { MessageBox.Show("用户名不能为空"); return; } if (textBox1.Text == "admin") { MessageBox.Show("不能使用admin作为用户名"); return; } if (userInfoData.GetUserInfos(t => t.UserName == textBox1.Text).FirstOrDefault() != null) { MessageBox.Show("该用户名已存在"); return; } UserInfo userInfo = new UserInfo(); userInfo.ID = Kit.GetGuid(); userInfo.UserName = textBox1.Text; userInfo.Password = Security.ParseMd5(textBox2.Text); userInfo.NickName = textBox3.Text; userInfo.RegistrationTime = DateTime.Now; userInfoData.Add(userInfo); MessageBox.Show("注册成功"); this.Close(); }
public void AddUserInfo(UserInfoData info) { IterateLoggers((logger) => { logger.UserInfo(info); }); }
public void SaveUserInfo(IUserInfoModel userInfoModel) { // 保存英雄信息 var heroInfoList = new List <HeroInfoData>(); foreach (var model in userInfoModel.heroList) { heroInfoList.Add(new HeroInfoData { id = model.id, characterId = model.characterId, lastHp = model.lastHp, lv = model.lv }); } // 保存用户信息 var userInfoData = new UserInfoData { chapterId = userInfoModel.chapterId, summonLv = userInfoModel.summonLv, money = userInfoModel.money, fightChapterId = userInfoModel.fightChapterId, heroInfoData = heroInfoList }; var bf = new BinaryFormatter(); FileStream fs = File.Create(savePath); bf.Serialize(fs, userInfoData); fs.Close(); }
public void DeleteUserChanged(string username) { if (!string.IsNullOrEmpty(username)) { UserInfoData.Remove(username); } }
public bool Handle(HttpListenerContext context) { if (context.Request.HttpMethod == "GET" && context.Request.Url.AbsolutePath.EndsWith(UserInfoPath)) { //So this is a little weird, but it is apparently the way it expects the claims so that's how we do it var claimCollection = new UserInfoData { Sub = "blah" }; var userinfoJson = JsonConvert.SerializeObject(claimCollection); var userInfo = new UserInfoResponse(userinfoJson); var memStream = new MemoryStream(); var streamWrite = new StreamWriter(memStream); streamWrite.Write(userInfo.Json); streamWrite.Flush(); memStream.Position = 0; memStream.CopyTo(context.Response.OutputStream); context.Response.ContentType = "application/json"; context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.Close(); return(true); } return(false); }
public ActionResult UserInfo(string user = "") { var cInfo = db.CInfoCommons.Where(p => p.UserLogin == user).FirstOrDefault(); ViewBag.User = user; var result = new UserInfoData(); if (cInfo != null) { if (cInfo.CType == "CI") { result.type = "Đại lý cấp 1"; } else if (cInfo.CType == "CII") { result.type = "Đại lý cấp 2"; } else if (cInfo.CType == "FARMER") { result.type = "Nông dân"; } result.fullname = cInfo.CName; result.phone = cInfo.Phone; result.address = cInfo.AddressInfo; result.birthday = ""; result.user = user; result.code = cInfo.CCode; result.branch = cInfo.BranchCode; return(View(result)); } else { var staff = db.HaiStaffs.Where(p => p.UserLogin == user).FirstOrDefault(); if (staff != null) { result.type = "Nhân viên"; result.fullname = staff.FullName; result.phone = staff.Phone; result.address = staff.HaiBranch.Name; result.area = staff.HaiBranch.HaiArea.Name; result.user = user; if (staff.BirthDay != null) { result.birthday = staff.BirthDay.Value.ToShortDateString(); } result.code = staff.Code; result.branch = staff.HaiBranch.Code; return(View(result)); } } return(View()); }
/// <summary> /// Adds the user to currently edited group. /// </summary> public void GroupAddUser(UserInfoData user) { if (!GroupUsers.Any(u => u.UserId == user.Id)) { GroupUsers.Add(user); } GroupSearch(); }
public UserInfo GetUserData(string username) { UserInfo user = new UserInfo(); UserInfoData userInfo = new UserInfoData(); user = userInfo.getUserData(username); return(user); }
/// <summary> /// Updates the user data (from the Settings page). /// </summary> public void UpdateUserInfo(UserInfoData user, int userId) { var entity = db.Users.Find(userId); UpdateUserInfoCore(user, entity, db); db.SaveChanges(); }
private void butApply_Click(object sender, EventArgs e) { try { UserInfoData adminUser = null; if (txtSurePwd.Text != txtPwd.Text) { MessageBox.Show("确认密码录入不一致,请重新录入。", "提示"); txtSurePwd.Focus(); return; } if (txtAdminName.Tag == null) { string userId = _um.GetUserIDWithAccountName(txtAdminName.Text); if (string.IsNullOrEmpty(userId) == false) { MessageBox.Show("账号名称已经存在。", "提示"); txtAdminName.Focus(); return; } adminUser = new UserInfoData(); adminUser.用户ID = UserModel.ADMIN_ID; adminUser.系统账号 = txtAdminName.Text; adminUser.用户名称 = "管理员"; adminUser.账号信息.密码 = UserModel.EncryPwd(txtPwd.Text); adminUser.账号信息.创建日期 = _um.GetServerDate(); _um.NewUser(adminUser, null); } else { string userId = _um.GetUserIDWithAccountName(txtAdminName.Text); if (string.IsNullOrEmpty(userId) == false && userId.Equals(UserModel.ADMIN_ID) == false) { MessageBox.Show("账号名称已经存在。", "提示"); txtAdminName.Focus(); return; } adminUser = txtAdminName.Tag as UserInfoData; adminUser.系统账号 = txtAdminName.Text; adminUser.账号信息.密码 = UserModel.EncryPwd(txtPwd.Text); _um.UpdateUserInfo(adminUser, null); } ButtonHint.Start(butApply, "OK"); } catch (Exception ex) { MsgBox.ShowException(ex, this); } }
public bool ContainsPassword(string password) { UserInfoData userInfo = new UserInfoData(); if (userInfo.getPassword().Contains(password)) { return(true); } return(false); }
public bool ContainsUsernameAndPassword(string username, string password) { UserInfoData userInfo = new UserInfoData(); if (userInfo.getUsernameAndPassword().ContainsKey(username) && userInfo.getUsernameAndPassword()[username].Equals(password)) { return(true); } return(false); }
DataSet Bind() { UserInfoData data = new UserInfoData(); data.Userid = txtUserid.Text; data.Userlevel = txtUserlevel.Text; Classes.UserInfoOperation op = new Classes.UserInfoOperation(); ds = op.GetUserInfo(data); return(ds); }
/// <summary> /// Updates the user data (from the Settings page). /// </summary> public static void UpdateUserInfo(UserInfoData user, int userId) { using (var db = new AppContext()) { var entity = db.Users.Find(userId); UpdateUserInfoCore(user, entity, db); db.SaveChanges(); } }
private void ProcessPowerHistoryData(int playerId, UserInfoData userInfoData, List <IPowerHistoryEntry> powerHistoryLast) { foreach (var historyEntry in powerHistoryLast) { userInfoData.Connection.Send(DataPacketBuilder.RequestServerGamePowerHistory(_id, _token, _gameId, playerId, historyEntry), Encoding.UTF8); //Log.Warn($"[_gameId:{_gameId}] should be stopped here, isn't implemented!!!"); Thread.Sleep(50); } //userInfoData.Connection.Send(DataPacketBuilder.RequestServerGamePowerHistoryX(_id, "matchgame", _gameId, playerId, powerHistoryLast), Encoding.UTF8); }
private IEnumerator CheckMailAddress() { inputHandleNameObj.SetActive(false); check.SetActive(false); textMessage.text = ""; var url = chkurl; WWWForm form = new WWWForm(); form.AddField("mail_address", inputMailAddress.text); UnityWebRequest request = UnityWebRequest.Post(url, form); yield return(request.SendWebRequest()); if (request.isNetworkError || request.isHttpError) { textMessage.text = request.error; } else { if (request.responseCode == 200) { string jsonText = request.downloadHandler.text; //Debug.Log("jsonText=" + jsonText); if (jsonText != null) { UserInfoData userInfoData = new UserInfoData(); var json = "{" + $"\"root\": {jsonText}" + "}"; //Debug.Log("json=" + json); JsonUtility.FromJsonOverwrite(json, userInfoData); inputHandleName.text = userInfoData.root.handle_name; inputHandleNameObj.SetActive(true); if (inputHandleName.text != "") { inputHandleName.readOnly = false; inputHandleName.interactable = false; } else { inputHandleName.readOnly = false; inputHandleName.interactable = true; } check.SetActive(true); } } else { textMessage.text = "request.responseCode: " + request.responseCode; } } }
private void TestUserInfoAssertion(int number, string guid, string message, UserInfoState state) { LoggedEvent evt = _logger.Events[number]; Assert.AreEqual(ExecutionLoggerEventType.UserInfo, evt.Type); Assert.IsInstanceOf(typeof(UserInfoData), evt.Data); UserInfoData data = (UserInfoData)evt.Data; Assert.AreEqual(guid, data.Guid); Assert.AreEqual(message, data.Message); Assert.AreEqual(state, data.State); }
public void Set(UserInfoData other) { if (other != null) { m_ApiVersion = UserInfoInterface.CopyuserinfoApiLatest; UserId = other.UserId; Country = other.Country; DisplayName = other.DisplayName; PreferredLanguage = other.PreferredLanguage; Nickname = other.Nickname; } }
private IEnumerator UserCreate(string handleName, string mailaddress) { var url = ""; #if UNITY_ANDROID || UNITY_IOS url = url_nm; #else url = url_ip; #endif //Debug.Log("UserCreate name=" + handleName + ",mail=" + mailaddress); WWWForm form = new WWWForm(); form.AddField("handle_name", handleName); form.AddField("mail_address", mailaddress); UnityWebRequest request = UnityWebRequest.Post(url, form); yield return(request.SendWebRequest()); if (request.isNetworkError || request.isHttpError) { textMessage.text = request.error; //Debug.Log("*** request ERROR " + request.error); } else { if (request.responseCode == 200) { string jsonText = request.downloadHandler.text; //Debug.Log("data=" + jsonText); UserInfoData userInfoData = new UserInfoData(); var json = "{" + $"\"root\": {jsonText}" + "}"; //Debug.Log("json=" + json); JsonUtility.FromJsonOverwrite(json, userInfoData); //Debug.Log("userInfoData=" + userInfoData.root._id + "," + userInfoData.root.handle_name + "," + userInfoData.root.mail_address + "," + userInfoData.root.message_board_count); PlayerPrefs.SetString("HandleName", userInfoData.root.handle_name); PlayerPrefs.SetString("MailAddress", userInfoData.root.mail_address); PlayerPrefs.SetInt("MessageBoardCount", userInfoData.root.message_board_count); PlayerPrefs.SetString("UserID", userInfoData.root._id); SceneManager.LoadScene("MenuScene"); } else { textMessage.text = "request.responseCode: " + request.responseCode; //Debug.Log("*** responseCode NOT 200 " + request.error); } } }
internal static bool CheckPassword(LoginModel loginInfo, out UserInfoData userInfoData) { if (loginInfo != null && !string.IsNullOrEmpty(loginInfo.Username) && !string.IsNullOrEmpty(loginInfo.Password)) { var userInfo = UserInfoManager.Instance.GetUserInfo(loginInfo.Username); if (userInfo != null && userInfo.Password == loginInfo.Password) { userInfoData = userInfo; return(true); } } userInfoData = null; return(false); }
public void RefreshSetting() { UserInfoData adminUser = _um.GetUserInfoByUserID(UserModel.ADMIN_ID); if (adminUser == null) { return; } txtAdminName.Text = adminUser.系统账号; txtAdminName.Tag = adminUser; txtPwd.Text = UserModel.DecryPwd(adminUser.账号信息.密码); }
//保存文件路径 /// <summary> /// 获取客户端保存的所有用户 /// </summary> private void GetClientUsers() { try { string FileInfo = string.Empty; if (File.Exists(FilePath)) { //打开流进行读取 using (FileStream fs = File.OpenRead(FilePath)) { //创建一个byte数组以读取数据 byte[] arr = new byte[fs.Length]; //继续读完文件中的所有数据 while (fs.Read(arr, 0, arr.Length) > 0) { FileInfo += Encoding.UTF8.GetString(arr); } } FileInfo = FileInfo.Replace('\0', ' ').Trim(); if (!string.IsNullOrEmpty(FileInfo)) { string fileinfo = RSAEncryption.Decrypt(FileInfo); string[] values = fileinfo.Split(';'); foreach (var item in values) { UserInfoData.Add(item); } } } string user = IniHelper.ProfileReadValue("ServerUser", "user", IniHelper.defaultUserData); if (UserInfoData.Count > 0) { if (UserInfoData.Contains(user)) { UserInfoSelectItem = user; IsSaveUserName = true; } else { UserInfoSelectItem = UserInfoData[0]; } } } catch (Exception ex) { LogHelper.Info(ex.Message); } }
public MatchGame(GameServer gameServer, int index, UserInfoData player1, UserInfoData player2) { _gameServer = gameServer; _random = new Random(); _gameId = index; _player1 = player1; _player1.PlayerState = PlayerState.None; _player2 = player2; _player2.PlayerState = PlayerState.None; _id = 2; _token = $"matchgame{_gameId}"; _game = null; }
/// <summary> /// Shows the user detail popup. /// </summary> public void ShowUserPopup(int?userId) { if (userId == null) { EditedUser = new UserInfoData() { UserRole = UserRole.User }; } else { EditedUser = UserService.GetUserInfo(userId.Value); } Context.ResourceManager.AddStartupScript("$('div[data-id=user-detail]').modal('show');"); }
List <string> m_UserInfo = new List <string>(); //리스트와 enum 기반의 유저 데이터 값 public UserData(List <Dictionary <string, object> > UserTable) { //유저 테이블과 캐릭터 테이블은 엑셀 UserInfoData Data = JSON.JsonUtil.LoadJson <UserInfoData>("UserInfoData"); m_UserInfo.Add(Data.NickName); //닉네임 int iLevel = Data.Level - 1; m_UserInfo.Add(Data.Level.ToString()); //레벨 m_UserInfo.Add(Data.CurEnergy.ToString()); //유저 현재 에너지 m_UserInfo.Add(UserTable[iLevel][USER_INFO.USER_INFO_MAX_ENERGY.ToString()].ToString()); //맥스 에너지 m_UserInfo.Add(Data.CurEXP.ToString()); //유저 현재 경험치 m_UserInfo.Add(UserTable[iLevel][USER_INFO.USER_INFO_MAX_EXP.ToString()].ToString()); //유저 전체 경험치 m_UserInfo.Add(Data.Gold.ToString()); //유저 현재 경험치 m_UserInfo.Add(Data.MainChar.ToString()); //유저 메인 캐릭터 }
//修改 private void button2_Click(object sender, EventArgs e) { UserInfoData data = new UserInfoData(); data.Userid = txtUserid1.Text; data.Userpwd = txtUserpwd1.Text; data.Userlevel = txtUserlevel1.Text; Classes.UserInfoOperation op = new Classes.UserInfoOperation(); if (op.UpdateUser(data)) { MessageBox.Show("成功"); } else { MessageBox.Show("失败了"); } dataGridView1.DataSource = Bind().Tables[0]; }
public void InitByUserInfoData(UserInfoData userInfoData) { chapterId = userInfoData.chapterId; money = userInfoData.money; summonLv = userInfoData.summonLv; fightChapterId = userInfoData.fightChapterId; foreach (var data in userInfoData.heroInfoData) { heroList.Add(new HeroInfoModel { id = data.id, lastHp = data.lastHp, characterId = data.characterId, lv = data.lv }); } }
/// <summary> /// <see cref="CopyUserInfo" /> is used to immediately retrieve a copy of user information based on an Epic Online Services Account ID, cached by a previous call to <see cref="QueryUserInfo" />. /// If the call returns an <see cref="Result.Success" /> result, the out parameter, OutUserInfo, must be passed to <see cref="Release" /> to release the memory associated with it. /// <seealso cref="UserInfoData" /> /// <seealso cref="CopyUserInfoOptions" /> /// <seealso cref="Release" /> /// </summary> /// <param name="options">structure containing the input parameters</param> /// <param name="outUserInfo">out parameter used to receive the <see cref="UserInfoData" /> structure.</param> /// <returns> /// <see cref="Result.Success" /> if the information is available and passed out in OutUserInfo /// <see cref="Result.InvalidParameters" /> if you pass a null pointer for the out parameter /// <see cref="Result.IncompatibleVersion" /> if the API version passed in is incorrect /// <see cref="Result.NotFound" /> if the user info is not locally cached. The information must have been previously cached by a call to <see cref="QueryUserInfo" /> /// </returns> public Result CopyUserInfo(CopyUserInfoOptions options, out UserInfoData outUserInfo) { System.IntPtr optionsAddress = new System.IntPtr(); Helper.TryMarshalSet <CopyUserInfoOptionsInternal, CopyUserInfoOptions>(ref optionsAddress, options); var outUserInfoAddress = System.IntPtr.Zero; var funcResult = EOS_UserInfo_CopyUserInfo(InnerHandle, optionsAddress, ref outUserInfoAddress); Helper.TryMarshalDispose(ref optionsAddress); if (Helper.TryMarshalGet <UserInfoDataInternal, UserInfoData>(outUserInfoAddress, out outUserInfo)) { EOS_UserInfo_Release(outUserInfoAddress); } return(funcResult); }
public IActionResult EditUserInfo([FromBody] EditUserInfoModel editUserInfoModel) { var auth = HttpContext.AuthenticateAsync(); var userIdstr = auth.Result.Principal.Claims.First(t => t.Type.Equals(ClaimTypes.NameIdentifier))?.Value; if (!uint.TryParse(userIdstr, out uint userId)) { return(BadRequest(new { messager = "权限查找失败,ID解析失败=" + userId })); } UserInfoData userInfo = UserInfoManager.Instance.GetUserInfo(userId); if (userInfo == null) { return(BadRequest(new { messager = "权限查找失败,找不到ID=" + userId + " 的用户" })); } if (userInfo.Password != editUserInfoModel.Password) { return(BadRequest(new { messager = "请输入正确的密码" })); } if (!string.IsNullOrEmpty(editUserInfoModel.NewNickName) && !string.IsNullOrWhiteSpace(editUserInfoModel.NewNickName)) { if (UserInfoManager.Instance.EditUserNickName(userId, editUserInfoModel.NewNickName, out userInfo)) { return(Ok(new { messager = "Ok", data = new { userInfo.UserId, userInfo.NickName } })); } else { return(BadRequest(new { messager = "昵称修改失败" })); } } if (UserInfoManager.Instance.EditUserPassword(userId, editUserInfoModel.NewPassword, out userInfo)) { return(Ok(new { messager = "Ok", data = new { userInfo.UserId, userInfo.Password } })); } else { return(BadRequest(new { messager = "密码修改失败,密码需由大写小写字母加数字组成的6-20位字符组成" })); } }
private void JSONExample() { UserInfoData data = new UserInfoData() { _ID = 0, _Email = "ahoj", }; //Tento radek prevede UserInfoData na typ string string s = JsonConvert.SerializeObject(data); Console.WriteLine(s); //Tento radek prevede string na typ UserInfoData UserInfoData newUserData = JsonConvert.DeserializeObject <UserInfoData>(s); Console.WriteLine(newUserData._ID.ToString()); Console.WriteLine(newUserData._Email.ToString()); }