コード例 #1
0
        public BicycleDataInputForm(UpdateForm uf, int i, MainMenu mm)
        {
            InitializeComponent();

            myCaller = uf;
            mainMenu = mm;

            BicycleDataInputFormTitle.Text = "Modify Bicycle data";

            Object[] location = new Object[7];
            location[0] = "Benedict Hall";
            location[1] = "Harmon Hall";
            location[2] = "McFarlane Hall";
            location[3] = "Mortimer Hall";
            location[4] = "Student Union";
            location[5] = "Thompson Hall";
            location[6] = "Welcome Center";
            LocationComboBox.Items.AddRange(location);

            Object[] physical = new Object[2];
            physical[0] = "Good";
            physical[1] = "Damaged";
            PhysicalConditionComboBox.Items.AddRange(physical);

            Object[] status = new Object[2];
            status[0] = "Available";
            status[1] = "Unavailable";
            StatusComboBox.Items.AddRange(status);



            Vehicle existingVehicle = new Vehicle();

            existingVehicle.populate(i);
            BikeMakeBox.Text                        = existingVehicle.BikeMake;
            ModelNumberBox.Text                     = existingVehicle.ModelNumber;
            SerialNumberBox.Text                    = existingVehicle.SerialNumber;
            ColorBox.Text                           = existingVehicle.Color;
            DescriptionBox.Text                     = existingVehicle.Description;
            LocationComboBox.SelectedIndex          = LocationComboBox.FindStringExact(existingVehicle.Location);
            PhysicalConditionComboBox.SelectedIndex = PhysicalConditionComboBox.FindStringExact(existingVehicle.PhysicalCondition);
            NotesBox.Text                           = existingVehicle.Notes;
            StatusComboBox.SelectedIndex            = StatusComboBox.FindStringExact(existingVehicle.Status);

            FormAction = "update";
            id         = i;
        }