Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            TimetablesConnector tc = new TimetablesConnector();
            var     timetable      = tc.get(int.Parse(dlJourney.SelectedValue));
            Failure f = new Failure();

            f.created   = DateTime.Now;
            f.message   = txtMessage.Text;
            f.place     = txtPlace.Text;
            f.severity  = int.Parse(txtSeverity.Text);
            f.resolved  = null;
            f.timetable = timetable;
            f.type      = (FailureType)Enum.Parse(typeof(FailureType), dlType.SelectedValue);

            FailuresConnector fc = new FailuresConnector();
            var result           = fc.send(f);

            if (result == "\"OK\"")
            {
                Response.Redirect(Request.RawUrl);
            }
            else
            {
            }
        }
Пример #2
0
        public FormTimetableEdit(int timetable_id)
        {
            InitializeComponent();
            VehiclesConnector   vc = new VehiclesConnector();
            DriversConnector    dc = new DriversConnector();
            TimetablesConnector tc = new TimetablesConnector();

            allVehicles       = vc.get();
            allDrivers        = dc.get();
            availibleVehicles = new List <Vehicle>();
            availibleDrivers  = new List <Driver>();
            timetables        = tc.get();
            timetable         = timetables.Where(t => t.id == timetable_id).FirstOrDefault();
            tbName.Text       = timetable.name;
            tbRoute.Text      = timetable.route.start + " - " + timetable.route.finish;
            dtDeparture.Text  = timetable.departure.ToString("HH:mm");
            drArrival.Text    = timetable.arrival.ToString("HH:mm");

            availibleVehicles.Add(timetable.vehicle);
            availibleDrivers.Add(timetable.driver);
            cbVehicle.DataSource    = availibleVehicles;
            cbVehicle.DisplayMember = "detail";
            cbVehicle.ValueMember   = "id";

            cbDriver.DataSource    = availibleDrivers;
            cbDriver.DisplayMember = "fullName";
            cbDriver.ValueMember   = "id";
            calculateAvailableResources();
            cbVehicle.SelectedItem = timetable.vehicle;
            cbDriver.SelectedItem  = timetable.driver;
            init = false;
        }
Пример #3
0
        public void LoadTimetable()
        {
            this.button2.Enabled = false;
            this.button3.Enabled = false;
            this.button2.Visible = true;
            this.button3.Visible = false;
            this.selectedIndex   = 3;
            this.Text            = "Cestovný poriadok - Dopravný podnik";
            this.Cursor          = Cursors.WaitCursor;
            this.listView1.Clear();
            listView1.Columns.Add("Id");
            listView1.Columns.Add("Názov linky");
            listView1.Columns.Add("Trasa");
            listView1.Columns.Add("Vozidlo");
            listView1.Columns.Add("Vodič");
            listView1.Columns.Add("Odchod");
            listView1.Columns.Add("Príchod");

            listView1.Columns[0].Width = listView1.Width / 6 - 50;
            listView1.Columns[1].Width = listView1.Width / 6;
            listView1.Columns[2].Width = listView1.Width / 6;
            listView1.Columns[3].Width = listView1.Width / 6;
            listView1.Columns[4].Width = listView1.Width / 6;
            listView1.Columns[5].Width = listView1.Width / 6 - 40;
            listView1.Columns[6].Width = listView1.Width / 6 - 40;
            try
            {
                TimetablesConnector tc = new TimetablesConnector();
                var journeys           = tc.get();

                foreach (var j in journeys)
                {
                    ListViewItem item = new ListViewItem();
                    item.Text = j.id.ToString();
                    item.SubItems.Add(j.name.ToString());
                    item.SubItems.Add(j.route.start + " - " + j.route.finish);
                    item.SubItems.Add(j.vehicle.name);
                    item.SubItems.Add(j.driver.fullName);
                    item.SubItems.Add(j.departure.ToLongTimeString());
                    item.SubItems.Add(j.arrival.ToLongTimeString());

                    this.listView1.Items.Add(item);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Vyskytla sa chyba", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
        }