示例#1
0
        public void LoadEmployees()
        {
            this.button2.Visible = false;
            this.button3.Visible = false;
            this.selectedIndex   = 0;
            this.Text            = "Zamestnanci - Dopravný podnik";
            this.Cursor          = Cursors.WaitCursor;
            this.listView1.Clear();
            listView1.Columns.Add("Funkcia");
            listView1.Columns.Add("Meno");
            listView1.Columns.Add("Priezvisko");
            listView1.Columns.Add("Telefon");
            listView1.Columns.Add("Email");
            this.listView1.AccessibleName = "employees";
            listView1.Columns[0].Width    = listView1.Width / 5 - 20;
            listView1.Columns[1].Width    = listView1.Width / 5;
            listView1.Columns[2].Width    = listView1.Width / 5;
            listView1.Columns[3].Width    = listView1.Width / 5;
            listView1.Columns[4].Width    = listView1.Width / 5;
            try
            {
                DriversConnector     driConn = new DriversConnector();
                DispatchersConnector disConn = new DispatchersConnector();
                ManagersConnector    manConn = new ManagersConnector();

                // var employees = EmployeeTable.Select();
                var drivers     = driConn.get();
                var dispatchers = disConn.get();


                foreach (var u in drivers)
                {
                    ListViewItem item = new ListViewItem();
                    item.Text = "Vodič";
                    item.SubItems.Add(u.name.ToString());
                    item.SubItems.Add(u.surname.ToString());
                    item.SubItems.Add(u.phone);
                    item.SubItems.Add(u.email.ToString());
                    this.listView1.Items.Add(item);
                }

                foreach (var u in dispatchers)
                {
                    ListViewItem item = new ListViewItem();
                    item.Text = "Dispečer";
                    item.SubItems.Add(u.name.ToString());
                    item.SubItems.Add(u.surname.ToString());
                    item.SubItems.Add(u.phone);
                    item.SubItems.Add(u.email.ToString());
                    this.listView1.Items.Add(item);
                }
                var datum = DateTime.Now.ToLongTimeString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Vyskytla sa chyba", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckAccess();

            DriversConnector dc = new DriversConnector();
            var list            = dc.get();

            foreach (var item in list)
            {
                TableRow  tr  = new TableRow();
                TableCell tc1 = new TableCell();
                TableCell tc2 = new TableCell();
                TableCell tc3 = new TableCell();
                TableCell tc4 = new TableCell();
                TableCell tc5 = new TableCell();
                TableCell tc6 = new TableCell();
                tc1.Text = "Vodič";
                tc2.Text = item.name;
                tc3.Text = item.surname;
                tc4.Text = item.email;
                tc5.Text = item.phone;
                tc6.Text = item.salary.ToString();
                tr.Cells.Add(tc1);
                tr.Cells.Add(tc2);
                tr.Cells.Add(tc3);
                tr.Cells.Add(tc4);
                tr.Cells.Add(tc5);
                tr.Cells.Add(tc6);
                tableEmployees.Rows.Add(tr);
            }


            DispatchersConnector disc = new DispatchersConnector();
            var listDis = disc.get();

            foreach (var item in listDis)
            {
                TableRow  tr  = new TableRow();
                TableCell tc1 = new TableCell();
                TableCell tc2 = new TableCell();
                TableCell tc3 = new TableCell();
                TableCell tc4 = new TableCell();
                TableCell tc5 = new TableCell();
                TableCell tc6 = new TableCell();
                tc1.Text = "Dispečer";
                tc2.Text = item.name;
                tc3.Text = item.surname;
                tc4.Text = item.email;
                tc5.Text = item.phone;
                tc6.Text = item.salary.ToString();
                tr.Cells.Add(tc1);
                tr.Cells.Add(tc2);
                tr.Cells.Add(tc3);
                tr.Cells.Add(tc4);
                tr.Cells.Add(tc5);
                tr.Cells.Add(tc6);
                tableEmployees.Rows.Add(tr);
            }
        }