示例#1
0
        private void LogonForm_Load(object sender, EventArgs e)
        {
            try
            {
                // read key file
                myDataset.ReadXml(LoadEncrytedKeyFile());
            }
            catch (Exception ex)
            {
                MessageBox.Show("用户数据库损坏,请用默认管理员帐户密码登录");
                // restore default admin user
                myDataset.Account.Rows.Clear();
                myDataset.Account.Rows.Add("Admin", "Admin", "0");
                WriteEncryptedKeyFile(myDataset);
            }


            // fill account dictionary and select box
            foreach (UserPassDateSetCLS.AccountRow row in myDataset.Account.Rows)
            {
                this.comboBox1.Items.Add(row.UserName);
                userInformationDict.Add(row.UserName, new UserInfo(row.Password, row.Level));
            }
            if (this.comboBox1.Items.Count != 0)
            {
                this.comboBox1.SelectedIndex = 0;
            }
            else
            {
                this.comboBox1.Text = "";
            }
        }
示例#2
0
 private void PasswordChangeForm_Load(object sender, EventArgs e)
 {
     try
     {
         // read key file
         myDataset.ReadXml(LoadEncrytedKeyFile());
     }
     catch (Exception ex)
     {
         MessageBox.Show("用户数据库文件损坏,无法修改密码");
         DialogResult = System.Windows.Forms.DialogResult.Abort;
     }
 }
示例#3
0
        private void UserMgmtForm_Load(object sender, EventArgs e)
        {
            try
            {
                // read key file
                myDataset.ReadXml(LoadEncrytedKeyFile());
            }
            catch (Exception ex)
            {
                MessageBox.Show("用户数据库文件损坏,无法执行用户管理");
                DialogResult = System.Windows.Forms.DialogResult.Abort;
            }

            // fill account dictionary and select box
            refreshUserList();
        }