Ejemplo n.º 1
0
    public ArrayList GetCarFeatures(string sCarId, string AuthenticationID, string CustomerID)
    {
        DataSet     ds             = new DataSet();
        CarFeatures objCarFeatures = new CarFeatures();
        ArrayList   arr            = new ArrayList();
        MobileBL    objMobileBL    = new MobileBL();

        if (CustomerID.Trim() != "")
        {
            DataSet dsSaveCustInfo = objMobileBL.SaveMobileCustomerInfo("GetCarFeatures", CustomerID, AuthenticationID, sCarId);
        }


        if (AuthenticationID == ConfigurationManager.AppSettings["AppleID"].ToString())
        {
            ds = objCarFeatures.GetCarFeatures(sCarId);

            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    arr.Add(ds.Tables[0].Rows[i]["FeatureTypeName"].ToString() + "," + ds.Tables[0].Rows[i]["FeatureName"].ToString());
                }
            }
        }
        return(arr);
    }
Ejemplo n.º 2
0
        private async Task LoadCarFeaturesAsync()
        {
            Collection <CarFeature> carFeatures = await _carRepository.GetAllCarFeatures();

            Collection <CarFeature> currentFeatures   = Car.CarFeatures;
            Collection <int>        currentFeaturesId = new Collection <int>();

            foreach (CarFeature carfeature in currentFeatures)
            {
                currentFeaturesId.Add(carfeature.Id);
            }


            foreach (CarFeature carFeature in carFeatures)
            {
                if (currentFeaturesId.Contains(carFeature.Id))
                {
                    CarFeatures.Add(new CarFeatureModelView(carFeature)
                    {
                        IsChecked = true
                    });
                }
                else
                {
                    CarFeatures.Add(new CarFeatureModelView(carFeature)
                    {
                        IsChecked = false
                    });
                }
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DAO db = new DAO();

            Car car = new Car();

            car.BodyType         = bodyTypeTextBox.Text;
            car.Colour           = colourTextBox.Text;
            car.DateImported     = dateImportedDatePicker.SelectedDate.Value;
            car.CurrentMileage   = currentMileageTextBox.Text;
            car.Status           = statusTextBox.Text;
            car.Transmission     = transmissionTextBox.Text;
            car.ManufacturerYear = int.Parse(manufacturerYearTextBox.Text);
            car.CarModelId       = int.Parse(modelComboBox.SelectedValue.ToString());

            int featureID = int.Parse(featureComboBox.SelectedValue.ToString());

            //Bridging table carFetures
            CarFeatures junction = new CarFeatures();

            junction.CarFeatureId = featureID;
            junction.Car          = car;

            car.CarFeatures.Add(junction);
            db.addNewCarNewModel(car);
            MessageBox.Show("new car model added successfully");
        }
Ejemplo n.º 4
0
        private void ShowCarFeatures()
        {
            List <CarFeature> carFeatures = Car.CarFeatures.ToList();

            foreach (CarFeature carFeature in carFeatures)
            {
                CarFeatures.Add(carFeature.Feature);
            }
        }
Ejemplo n.º 5
0
    static void Main(string[] args)
    {
        //Set the features that you require for car. Consider it as checked in the UI.
        CarFeatures carFeatures = CarFeatures.AC | CarFeatures.Autopilot | CarFeatures.Sunroof;

        //Do the backend logic
        if (carFeatures.HasFlag(CarFeatures.Autopilot))
        {
            //Show Autopilot cars
        }
        //See the what carfeatures are required
        Console.WriteLine(carFeatures);
        //See the integer value of the carfeatures
        Console.WriteLine((int)carFeatures);
        Console.ReadLine();
    }
Ejemplo n.º 6
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            string output1 = Utility.emptyInputValidation(grid1);
            string output2 = Utility.emptyInputValidation(grid2);
            string output3 = Utility.emptyInputValidation(grid3);
            string output4 = Utility.emptyInputValidation(grid4);
            string result  = output1 + output2 + output3 + output4;

            if (result != null)
            {
                MessageBox.Show(result);
            }
            else
            {
                DAO      db    = new DAO();
                CarModel model = new CarModel();
                model.Manufacturer = manufacturerTextBox.Text;
                model.Seats        = int.Parse(seatsTextBox.Text);
                model.EngineSize   = engineSizeTextBox.Text;
                model.Model        = modelTextBox.Text;
                Car car = new Car();
                car.BodyType         = bodyTypeTextBox.Text;
                car.Colour           = colourTextBox.Text;
                car.DateImported     = dateImportedDatePicker.SelectedDate.Value;
                car.CurrentMileage   = currentMileageTextBox.Text;
                car.Status           = statusTextBox.Text;
                car.Transmission     = transmissionTextBox.Text;
                car.ManufacturerYear = int.Parse(manufacturerYearTextBox.Text);
                car.CarModel         = model;
                int featureID = int.Parse(featureComboBox.SelectedValue.ToString());
                //Bridging table carFetures
                CarFeatures junction = new CarFeatures();
                junction.CarFeatureId = featureID;
                junction.Car          = car;

                car.CarFeatures.Add(junction);
                db.addNewCarNewModel(car);
                MessageBox.Show("new car model added successfully");
            }
        }