Exemple #1
0
        public void LoadEntries()
        {
            this.tableLayoutPanel1.Controls.Clear();
            DbConnector          db        = DbConnector.GetInstance();
            List <EmployeeModel> staffList = new List <EmployeeModel>();

            staffList = db.GetStaffList();
            this.tableLayoutPanel1.AutoSize = true;
            this.tableLayoutPanel1.RowCount = staffList.Count;
            this.tableLayoutPanel1.Update();
            for (int i = 0; i < staffList.Count; i++)
            {
                LinkLabel    lb  = new LinkLabel(); lb.Font = new Font("Calibri", 12);  lb.Text = staffList[i].Name; lb.Show();
                Label        lb1 = new Label(); lb1.Font = new Font("Calibri", 12); lb1.Text = staffList[i].Specialty; lb1.Show();
                DeleteButton b   = new DeleteButton(staffList[i].id, "employee"); b.Show();
                lb.Click += lb_Click;
                b.Click  += b_Click;
                this.tableLayoutPanel1.Controls.Add(lb, 0, i);
                this.tableLayoutPanel1.Controls.Add(lb1, 1, i);
                this.tableLayoutPanel1.Controls.Add(b, 2, i);
            }
        }