示例#1
0
        private void ShowRoutes()
        {
            ShowBusesBtn.ForeColor   = Color.Black;
            ShowBusesBtn.BackColor   = Color.White;
            ShowRoutesBtn.ForeColor  = Color.White;
            ShowRoutesBtn.BackColor  = Color.Black;
            ShowDriversBtn.ForeColor = Color.Black;
            ShowDriversBtn.BackColor = Color.White;

            Table.Rows.Clear();
            Table.Columns.Clear();
            Table.Refresh();

            collectionName        = "routes";
            AddNewElementBtn.Text = "Новый маршрут";

            var documents = database.LoadAllDocuments <Route>("routes");

            Table.ColumnCount = 8;

            Table.Columns[0].Name    = "ID";
            Table.Columns[0].Visible = false;

            Table.Columns[1].Name = "Номер";
            Table.Columns[2].Name = "От";
            Table.Columns[3].Name = "До";
            Table.Columns[4].Name = "Со скольки";
            Table.Columns[5].Name = "До скольки";
            Table.Columns[6].Name = "Интервал";
            Table.Columns[7].Name = "Длинна";

            foreach (var doc in documents)
            {
                string ID = Convert.ToString(doc.Id);

                string number   = Convert.ToString(doc.Number);
                string stPoint  = Convert.ToString(doc.StPoint);
                string endPoint = Convert.ToString(doc.EndPoint);
                string stTime   = Convert.ToString(doc.StTime);
                string endTime  = Convert.ToString(doc.EndTime);
                string interval = Convert.ToString(doc.Interval);
                string lenght   = Convert.ToString(doc.Length) + " м.";

                string[] row = { ID, number, stPoint, endPoint, stTime, endTime, interval, lenght };

                Table.Rows.Add(row);
            }
        }
示例#2
0
        private void AddDriver_Load(object sender, EventArgs e)
        {
            var buses_doc  = database.LoadAllDocuments <Bus>("buses");
            var routes_doc = database.LoadAllDocuments <Route>("routes");

            List <string> buses_list  = new List <string>();
            List <string> routes_list = new List <string>();

            foreach (var bus in buses_doc)
            {
                buses_list.Add($"{bus.Type} {bus.Number}");
            }
            foreach (var route in routes_doc)
            {
                routes_list.Add($"{route.Number}: {route.StPoint} — {route.EndPoint}");
            }

            string[] buses_array  = buses_list.ToArray();
            string[] routes_array = routes_list.ToArray();

            BusInput.Items.AddRange(buses_array);
            RouteInput.Items.AddRange(routes_array);
        }