예제 #1
0
        private bool addLocomotiv()
        {
            Locomotiva bs = new Locomotiva();

            bs.Type        = (comboBox1.SelectedItem as VihecalType).name;
            bs.LastCheck   = dateTimePicker1.Value;
            bs.CurrentCond = textBox1.Text;
            int psg;

            if (!int.TryParse(textBox4.Text, out psg))
            {
                return(false);
            }
            bs.MaximumPulingCapacity = psg;

            var trs = TransportModel.GetTransport(bs.Type);

            bs.Transport = new MongoDB.Driver.MongoDBRef("Transport", trs.Id);
            var id = VehicalModel.AddVehical(bs);



            for (int i = 0; i < listBox1.Items.Count; i++)
            {
                VehicalModel.AddVagon(id, (listBox1.Items[i] as Vagon).Id);
            }
            return(true);
        }
예제 #2
0
        private bool addVagon()
        {
            Vagon bs = new Vagon();

            bs.Type        = (comboBox1.SelectedItem as VihecalType).name;
            bs.LastCheck   = dateTimePicker1.Value;
            bs.CurrentCond = textBox1.Text;
            int psg;

            if (!int.TryParse(textBox2.Text, out psg))
            {
                return(false);
            }
            bs.NumOfPassengers = psg;
            var trs = TransportModel.GetTransport(bs.Type);

            bs.Transport = new MongoDB.Driver.MongoDBRef("Transport", trs.Id);

            VehicalModel.AddVehical(bs);
            return(true);
        }