Beispiel #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
            BUS.PODControl podCtr      = new BUS.PODControl();
            DTO.PODInfo    podInf      = podCtr.Get(_user, ref _sErr);
            string         infpass     = podInf.PASS;
            string         oldpass     = Convert.ToBase64String(new System.Security.Cryptography.SHA1CryptoServiceProvider().ComputeHash(Encoding.ASCII.GetBytes(txtOld.Text)));
            string         newpass     = Convert.ToBase64String(new System.Security.Cryptography.SHA1CryptoServiceProvider().ComputeHash(Encoding.ASCII.GetBytes(txtNew.Text)));
            string         confirmpass = Convert.ToBase64String(new System.Security.Cryptography.SHA1CryptoServiceProvider().ComputeHash(Encoding.ASCII.GetBytes(txtConfirm.Text)));

            if (infpass != oldpass)
            {
                MessageBox.Show("Wrong password");
            }
            else if (newpass != confirmpass)
            {
                MessageBox.Show("Confirm password is not correct");
            }
            else
            {
                podInf.PASS = newpass;
                _sErr       = podCtr.Update(podInf);
                Close();
            }
        }
Beispiel #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //string sErr = "";

            DTO.PODInfo inf = new DTO.PODInfo();

            if (_processStatus == "C")
            {
                if (!ctr.IsExist(txtCode.Text))
                {
                    inf.PASS = Convert.ToBase64String(new System.Security.Cryptography.SHA1CryptoServiceProvider().ComputeHash(Encoding.ASCII.GetBytes("")));
                    ctr.Add(GetDataFromForm(inf), ref _sErr);
                }
                else
                {
                    _sErr = txtCode.Text.Trim() + " is exist!";
                }
            }
            else if (_processStatus == "A")
            {
                inf = ctr.Get(txtCode.Text, ref _sErr);
                if (flagPass)
                {
                    inf.PASS = Convert.ToBase64String(new System.Security.Cryptography.SHA1CryptoServiceProvider().ComputeHash(Encoding.ASCII.GetBytes("")));
                }
                _sErr = ctr.Update(GetDataFromForm(inf));
            }
            if (_sErr == "")
            {
                _processStatus = "V";
                EnabledForm(false);
            }
            else
            {
                lbErr.Text = _sErr;
            }
        }