示例#1
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            try
            {
                database = new CustomerDatabase();
                database.LoadDatabaseFromCsvDecrypted(txbFilenameLoad.Text, txbPasswordLoad.Text);

                //Print

                dgvDisplay.Rows.Clear();
                foreach (var elem in database.Customers)
                {
                    dgvDisplay.Rows.Add(elem.CustomerNumber.ToString(), elem.LastName.ToString(), elem.FirstName.ToString(), elem.Mail.ToString(), elem.LastChange.ToString(), elem.BankBalance.ToString());
                }
                txbFilenameLoad.Text    = "";
                txbPasswordLoad.Text    = "";
                btnEdit.Enabled         = true;
                btnPay.Enabled          = true;
                groupBox3.Enabled       = true;
                groupBox2.Enabled       = true;
                btnLoad.Enabled         = false;
                txbPasswordLoad.Enabled = false;
                MessageBox.Show(LangResources.MassegeBoxLoad);
            }
            catch (Exception er)
            {
                MessageBox.Show(Localization.getString(er.Message));
                txbFilenameLoad.Text = "";
                txbPasswordLoad.Text = "";
            }
        }
示例#2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            try
            {
                startpressed = true;
                if (rdbLoad.Checked == true)
                {
                    database.LoadDatabaseFromCsvDecrypted(txbFilename.Text, txbPassword.Text);
                    databaseOut = database;
                    this.Close();
                }
                else
                {
                    databaseOut = database;
                    this.Close();
                }

                //Store selected language
                StreamWriter strmWriter = new StreamWriter("LastLanguage.csv");
                if (rdbEnglish.Checked == true)
                {
                    strmWriter.WriteLine("ENG");
                }
                if (rdbGerman.Checked == true)
                {
                    strmWriter.WriteLine("GER");
                }
                strmWriter.Close();
            }
            catch (Exception er)
            {
                MessageBox.Show(Localization.getString(er.Message));
                startpressed     = false;
                txbFilename.Text = "";
                txbPassword.Text = "";
            }
        }