public void UpdateData()
 {
     account_data.Retrieve_Data();
     Account_NoLabel.Text   = account_data.Get_Account_No().ToString();
     Account_TypeLabel.Text = account_data.Get_Account_Type();
     NameLabel.Text         = account_data.Get_Name();
     EmailLabel.Text        = account_data.Get_Email();
     CreditLabel.Text       = account_data.Get_Credit().ToString();
     DebitLabel.Text        = account_data.Get_Debit().ToString();
     BalanceLabel.Text      = (account_data.Get_Credit() - account_data.Get_Debit()).ToString();
 }
Exemple #2
0
        public void UpdateData()
        {
            account_data.Retrieve_Data();
            SentTranscationSlots.Clear();
            ReceivedTransactionSlots.Clear();
            ReceivedList.Controls.Clear();
            SentList.Controls.Clear();
            SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=D:\Programming\VisualStudio\C#\Banking-System\BankingSystem\BankingDatabase.mdf;Integrated Security=True");

            con.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection = con;
            SqlDataReader reader;

            TranscationSlotForm slot;

            cmd.CommandText = "SELECT * FROM TransactionsTable WHERE Sender_No = '" + account_data.Get_Account_No() + "'";
            reader          = cmd.ExecuteReader();
            while (reader.Read())
            {
                slot = new TranscationSlotForm(reader["Transaction_Id"].ToString(), reader["Amount"].ToString());
                SentTranscationSlots.Add(slot);
                SentList.Controls.Add(slot);
                slot.Show();
                slot.Dock = DockStyle.Top;
            }
            reader.Close();

            cmd.CommandText = "SELECT * FROM TransactionsTable WHERE Reciever_No = '" + account_data.Get_Account_No() + "'";
            reader          = cmd.ExecuteReader();
            while (reader.Read())
            {
                slot = new TranscationSlotForm(reader["Transaction_Id"].ToString(), reader["Amount"].ToString());
                ReceivedTransactionSlots.Add(slot);
                ReceivedList.Controls.Add(slot);
                slot.Show();
                slot.Dock = DockStyle.Top;
            }
            reader.Close();

            con.Close();
        }