using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace QueueSys
{
    public partial class frmCustomerView : Form
    {
        public frmCustomerView()
        {
            InitializeComponent();
        }

        private void frmCustomerView_Load(object sender, EventArgs e)
        {
            timer1.Start();
            RefreshCustomerView();
        }

        // Triggered by Employee View form add buttom as a delegate.
        public void MessageReceived(object sender, EventArgs e)
        {
            RefreshCustomerView();
        }

        private void RefreshCustomerView()
        {
            SqliteDataAccess sdaCxView = new SqliteDataAccess();
            List<CustomerView> cvList = new List<CustomerView>();

            cvList = sdaCxView.LoadCustomerView();

            dgvCustomerView.DataSource = cvList;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            RefreshCustomerView();
        }
    }
}
