Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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
            }
        }