private new void Update() { if (String.IsNullOrEmpty(txtOldPassword.Text)) { MessageForm.Error(this, MsgE.ErrorEmptyOldPassword); return; } else if (UCrypto.Encrypt(txtOldPassword.Text) != Ap.CurrentUser.Password) { MessageForm.Error(this, MsgE.ErrorWrongOldPassword); return; } DataSet ds = SocketClient.ChangePassword(txtPassword.Text, txtPasswordHint.Text); bool update = false; if (ds != null && ds.Tables.Count > 0) { Kv kv = new Kv(ds.Tables[0]); update = kv.GetBool("Updated"); } if (update) { MessageForm.Show(this, MsgE.InfoUpdatePassword); Ap.CurrentUser.Password = UCrypto.Encrypt(txtPassword.Text); Ap.CurrentUser.PasswordHint = txtPasswordHint.Text; } else { MessageForm.Error(this, MsgE.ErrorUpdatePassword); } this.Close(); }
private void GetDataByRoomID(Kv kv) { if (RoomUc.InvokeRequired) { GetDataByRoom d = new GetDataByRoom(GetDataByRoomID); this.Invoke(d, new object[] { kv }); } else { RoomUc.SetDataByRoomId(kv.GetDataSet("AppData"), kv.GetBool("IsFromTimer")); timer1.Start(); } }
private void btnOk_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtTo.Text)) { return; } DataSet ds = SocketClient.CheckUserId(txtTo.Text); if (ds != null && ds.Tables.Count > 0) { Kv kv1 = new Kv(); kv1 = new Kv(ds.Tables[0]); bool isExist = kv1.GetBool("IsExist"); if (!isExist) { MessageForm.Error(this, MsgE.ErrorUserNotExist, txtTo.Text); return; } } else { MessageForm.Error(this, MsgE.ErrorServerConnection); return; } UserMessageDataKv messageKv = new UserMessageDataKv(); messageKv.UserIDFrom = Ap.CurrentUserID; messageKv.UserIDTo = 0; messageKv.UserNameTo = txtTo.Text; messageKv.Subject = txtSubject.Text; messageKv.Text = editor1.BodyHtml; messageKv.EmailTime = DateTime.Now; messageKv.Size = UStr.ToBytes(editor1.BodyHtml).Length; messageKv.StatusIDFromE = StatusE.Active; messageKv.StatusIDToE = StatusE.Active; SocketClient.SendEmail(messageKv); MessageForm.Show(this, MsgE.InfoEmailSend); this.Close(); }
private void ResetGameAccepted(Kv kv) { NewGame(); Ap.Game.Flags.IsReady = true; if (kv.GetBool("IsResetFromLastMove") && !string.IsNullOrEmpty(kv.Get("GameXml"))) { SetGamePrameters(kv.Get("GameXml"), true); } if (kv.GetInt32("TournamentDirectorID") > 0) { ChatClient.Write(ChatTypeE.GameWindow, ChatMessageTypeE.Info, ChatTypeE.GameWindow, MsgE.InfoRestartTournamentMatch, base.Game.DbGame.GameID); } else { ChatClient.Write(ChatTypeE.GameWindow, ChatMessageTypeE.Info, ChatTypeE.GameWindow, MsgE.InfoTournamentMatchStarted, base.Game.DbGame.GameID); } }
private void btnForgotPassword_Click(object sender, EventArgs e) { DataSet ds = SocketClient.ForgotPassword(txtUserName.Text); bool update = false; if (ds != null && ds.Tables.Count > 0) { Kv kv = new Kv(ds.Tables[0]); update = kv.GetBool("Updated"); } if (update) { MessageForm.Show(this, MsgE.InfoCheckEmail); } else { //MessageForm.Show(""); } this.Close(); }
private void Save() { if (!String.IsNullOrEmpty(txtLoginId.Text)) { if (txtLoginId.Text.Length < 3) { MessageForm.Error(this, MsgE.ErrorLoginIdRange); return; } else if (txtLoginId.Text.Contains(" ")) { MessageForm.Error(this, MsgE.ErrorSpacing); return; } else { //Regex reg = new Regex(@"^(([a-zA-Z])(\.)?([a-zA-Z0-9_]?)(\.)?)+$"); Regex reg = new Regex(@"^[a-zA-Z]+[a-zA-Z0-9_\.]+$"); Match mt = reg.Match(txtLoginId.Text); if (!mt.Success) { MessageForm.Show(this, MsgE.InfoLoginRule); return; } DataSet ds = SocketClient.CheckUserId(txtLoginId.Text); if (ds != null && ds.Tables.Count > 0) { Kv kv1 = new Kv(); kv1 = new Kv(ds.Tables[0]); bool isExist = kv1.GetBool("IsExist"); if (isExist) { MessageForm.Error(this, MsgE.ErrorUserExsist); return; } } else { MessageForm.Error(this, MsgE.ErrorServerConnection); return; } } } else { MessageForm.Error(this, MsgE.ErrorEnterUser); return; } Kv.UserName = txtLoginId.Text; Kv.Email = txtEmail.Text; Kv.FirstName = txtFirstName.Text; Kv.LastName = txtLastName.Text; Kv.NearestCityID = Convert.ToInt32(cbNearestCity.SelectedValue); if (cbCountry.SelectedIndex != 0) { Kv.CountryID = Convert.ToInt32(cbCountry.SelectedValue); } if (rbMr.Checked) { Kv.GenderIDE = GenderE.Mr; } else if (rbMrs.Checked) { Kv.GenderIDE = GenderE.Mrs; } else { Kv.GenderIDE = GenderE.Comp; } if (chkFIDE.Checked) { if (rbFM.Checked) { Kv.FideTitleIDE = FideTitleE.FM; } else if (rbIM.Checked) { Kv.FideTitleIDE = FideTitleE.IM; } else { Kv.FideTitleIDE = FideTitleE.GM; } } else { Kv.FideTitleIDE = FideTitleE.None; } if (chkICCF.Checked) { if (rbIccfIM.Checked) { Kv.IccfTitleIDE = IccfTitleE.IM; } else if (rbIccfSIM.Checked) { Kv.IccfTitleIDE = IccfTitleE.SIM; } else { Kv.IccfTitleIDE = IccfTitleE.GM; } } else { Kv.IccfTitleIDE = IccfTitleE.None; } Kv.PersonalNotes = txtNotes.Text; Kv.DateOfBirth = dtpDateOfBirth.Value.ToString("MM/dd/yyyy"); //Kv.DateOfBirth = UData.GetChessDate(dtpDateOfBirth.Value.ToString("", System.Globalization.CultureInfo.CreateSpecificCulture("en-US"))); Kv.DateLastLogin = DateTime.Now.ToString("MM/dd/yyyy"); Kv.Url = txtURL.Text; if (UserImage != null) { GeUserImageBytes(); } if (IsNew) { this.Visible = false; this.DialogResult = DialogResult.OK; this.Close(); ChangePassword frm = new ChangePassword(); frm.ShowDialog(); } else { //Call Update User Method } }
private void RestartGameResetAsked(Kv kv) { Ap.Game.Pause(); Ap.MsgQueue.Clear(this.Game.DbGame.GameID); Ap.Game.Flags.IsReady = false; //send back with Done SocketClient.RestartGame(kv.GetInt32("TournamentID"), kv.Get("GameID"), 0, kv.GetInt32("SenderUserID"), kv.GetInt32("ReceiverUserID"), ResetGameE.ResetDone, kv.GetBool("IsResetFromLastMove"), kv.Get("GameXml")); }
private void ResetGameAsked(Kv kv) { Ap.Game.Pause(); ResetGameE reset = ResetGameE.Decline; if (MessageForm.Confirm(this, MsgE.ConfirmRestartTournamentMatch) == DialogResult.Yes) { reset = ResetGameE.Accepted; } else { Ap.Game.Resume(); } SocketClient.RestartGame(kv.GetInt32("TournamentID"), kv.Get("MatchIDs"), kv.GetInt32("TournamentDirectorID"), kv.GetInt32("SenderUserID"), kv.GetInt32("ReceiverUserID"), reset, kv.GetBool("IsResetFromLastMove"), kv.Get("GameXml")); }