コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var dc = new ClassSRMDataContext(Config.connection);

            if (txtPass.Text != txtPass2.Text)
            {
                XtraMessageBox.Show("رمز عبور وارد شده همخوانی ندارد لطفا دوباره وارد کنید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                byte1 = UTF8Encoding.UTF8.GetBytes(txtPass.Text);
                byte2 = sha.ComputeHash(byte1);
                Hash  = BitConverter.ToString(byte2);
                dc.InsertUser(txtUserName.Text, Hash);
                XtraMessageBox.Show("حساب کاربری با موفقیت افزوده شد", "توجه", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtUserName.Text = string.Empty;
                txtPass.Text     = string.Empty;
                txtPass2.Text    = string.Empty;
                txtUserName.Select();
            }
        }