Пример #1
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            if (bodyFeatureId == 0)
            {
                MessageBox.Show("Lütfen Gövde Seçiniz");
                return;
            }
            else if (engineFeatureId == 0)
            {
                MessageBox.Show("Lütfen Motor Seçiniz");
                return;
            }
            else if (gearboxFeatureId == 0)
            {
                MessageBox.Show("Lütfen Vites Kutusu Seçiniz");
                return;
            }
            else if (colorFeatureId == 0)
            {
                MessageBox.Show("Lütfen Renk Seçiniz");
                return;
            }
            else if (floorFeatureId == 0)
            {
                MessageBox.Show("Lütfen Döşeme Seçiniz");
                return;
            }

            gridSecond.Visibility  = Visibility.Visible;
            gridSection.Visibility = Visibility.Collapsed;

            Cars car = generalOperation.GetCarById(StaticOrder.GetCarId());

            lblCarName.Content = car.CarName;
            lblYear.Content    = car.CarModel;
            string startupPath = System.IO.Directory.GetCurrentDirectory();

            imgCar.Source          = new BitmapImage(new Uri(startupPath + "/image/" + car.CarImagePath));
            lblTotalPrice.Content  = (totalPrice += car.Price).ToString() + "₺";
            lblPackageType.Content = StaticOrder.GetPackageTypeId() == 1 ? "Special Paket" : "Standart Paket";

            List <VehicleFeatures> optionFeatureList = generalOperation.GetAllVehicleFeaturesByPackageTypeAndVehicleFeaturesType(StaticOrder.GetPackageTypeId(), Helper.VehicleFeaturesTypeList.OptionList);

            foreach (var item in optionFeatureList.Where(s => optionList.Contains(s.VehicleFeaturesId)))
            {
                Label lblOption = new Label()
                {
                    Content = item.FeaturesName + " Fiyat: " + item.FeaturesPrice + "₺"
                };
                stackOption.Children.Add(lblOption);
            }
        }
Пример #2
0
        public CreateCarChoose()
        {
            InitializeComponent();
            btnSave.Click              += BtnSave_Click;
            btnContinue.Click          += BtnContinue_Click;
            btnOrder.Click             += BtnOrder_Click;
            cmbDealer.SelectionChanged += CmbDealer_SelectionChanged;
            generalOperation            = new GeneralOperation();
            string startupPath = System.IO.Directory.GetCurrentDirectory();

            int packageType = StaticOrder.GetPackageTypeId();

            #region Gövde listesini getiriyor
            List <VehicleFeatures> bodyList = generalOperation.GetAllVehicleFeaturesByPackageTypeAndVehicleFeaturesType(packageType, Helper.VehicleFeaturesTypeList.BodyList);

            Grid       bodyGrid       = new Grid();
            StackPanel stackBodyPanel = new StackPanel();


            foreach (var item in bodyList)
            {
                RadioButton radioButton = new RadioButton()
                {
                    Content     = item.FeaturesName,
                    DataContext = item
                };

                radioButton.Checked += RadioButton_Checked;

                #region Araç resimlerini getiriyoruz
                Image imageBody = new Image();
                imageBody.Source = new BitmapImage(new Uri(startupPath + "/image/body.jpg"));
                imageBody.HorizontalAlignment = HorizontalAlignment.Left;
                imageBody.Height            = 248;
                imageBody.Margin            = new Thickness(369, 0, 0, 0);
                imageBody.VerticalAlignment = VerticalAlignment.Top;
                imageBody.Width             = 373;

                bodyGrid.Children.Add(imageBody);

                #endregion Araç resimlerini getiriyoruz


                stackBodyPanel.Children.Add(radioButton);
            }


            bodyGrid.Children.Add(stackBodyPanel);
            tabBody.Content = bodyGrid;
            #endregion Gövde listesini getiriyor

            #region Motor listesini getiriyor
            List <VehicleFeatures> engineList = generalOperation.GetAllVehicleFeaturesByPackageTypeAndVehicleFeaturesType(packageType, Helper.VehicleFeaturesTypeList.EngineList);

            Grid       engineGrid       = new Grid();
            StackPanel stackEnginePanel = new StackPanel();


            foreach (var item in engineList)
            {
                RadioButton radioButton = new RadioButton()
                {
                    Content     = item.FeaturesName,
                    DataContext = item
                };
                radioButton.Checked   += RadioButton_Checked;
                radioButton.Unchecked += RadioButton_Unchecked;
                stackEnginePanel.Children.Add(radioButton);
            }

            Image imageEngine = new Image();
            imageEngine.Source = new BitmapImage(new Uri(startupPath + "/image/engine.jpg"));
            imageEngine.HorizontalAlignment = HorizontalAlignment.Left;
            imageEngine.Height            = 248;
            imageEngine.Margin            = new Thickness(369, 0, 0, 0);
            imageEngine.VerticalAlignment = VerticalAlignment.Top;
            imageEngine.Width             = 373;

            engineGrid.Children.Add(imageEngine);

            engineGrid.Children.Add(stackEnginePanel);
            tabEngine.Content = engineGrid;

            #endregion Motor listesini getiriyor

            #region Vites listesini getiriyor
            List <VehicleFeatures> gearboxList = generalOperation.GetAllVehicleFeaturesByPackageTypeAndVehicleFeaturesType(packageType, Helper.VehicleFeaturesTypeList.GearboxList);

            Grid       gearboxGrid       = new Grid();
            StackPanel stackGearboxPanel = new StackPanel();


            foreach (var item in gearboxList)
            {
                RadioButton radioButton = new RadioButton()
                {
                    Content     = item.FeaturesName,
                    DataContext = item
                };
                radioButton.Checked   += RadioButton_Checked;
                radioButton.Unchecked += RadioButton_Unchecked;
                stackGearboxPanel.Children.Add(radioButton);
            }

            Image imageGearbox = new Image();
            imageGearbox.Source = new BitmapImage(new Uri(startupPath + "/image/gearbox.jpg"));
            imageGearbox.HorizontalAlignment = HorizontalAlignment.Left;
            imageGearbox.Height            = 248;
            imageGearbox.Margin            = new Thickness(369, 0, 0, 0);
            imageGearbox.VerticalAlignment = VerticalAlignment.Top;
            imageGearbox.Width             = 373;

            gearboxGrid.Children.Add(imageGearbox);

            gearboxGrid.Children.Add(stackGearboxPanel);
            tabGearbox.Content = gearboxGrid;

            #endregion Vites listesini getiriyor

            #region Renk listesini getiriyor
            List <VehicleFeatures> colorList = generalOperation.GetAllVehicleFeaturesByPackageTypeAndVehicleFeaturesType(packageType, Helper.VehicleFeaturesTypeList.ColorList);

            Grid       colorGrid       = new Grid();
            StackPanel stackColorPanel = new StackPanel();


            foreach (var item in colorList)
            {
                RadioButton radioButton = new RadioButton()
                {
                    Content     = item.FeaturesName.Trim(),
                    DataContext = item
                };
                radioButton.Checked   += RadioButton_Checked;
                radioButton.Unchecked += RadioButton_Unchecked;
                stackColorPanel.Children.Add(radioButton);
            }


            Image imageColor = new Image();
            imageColor.Source = new BitmapImage(new Uri(startupPath + "/image/color.png"));
            imageColor.HorizontalAlignment = HorizontalAlignment.Left;
            imageColor.Height            = 248;
            imageColor.Margin            = new Thickness(369, 0, 0, 0);
            imageColor.VerticalAlignment = VerticalAlignment.Top;
            imageColor.Width             = 373;

            colorGrid.Children.Add(imageColor);

            colorGrid.Children.Add(stackColorPanel);
            tabColor.Content = colorGrid;

            #endregion Renk listesini getiriyor

            #region Döşeme listesini getiriyor
            List <VehicleFeatures> floorList = generalOperation.GetAllVehicleFeaturesByPackageTypeAndVehicleFeaturesType(packageType, Helper.VehicleFeaturesTypeList.FloorList);

            Grid       bodyFloorGrid   = new Grid();
            StackPanel stackFloorPanel = new StackPanel();


            foreach (var item in floorList)
            {
                RadioButton radioButton = new RadioButton()
                {
                    Content     = item.FeaturesName,
                    DataContext = item
                };
                radioButton.Checked   += RadioButton_Checked;
                radioButton.Unchecked += RadioButton_Unchecked;
                stackFloorPanel.Children.Add(radioButton);
            }


            Image imageFloor = new Image();
            imageFloor.Source = new BitmapImage(new Uri(startupPath + "/image/floor.jpg"));
            imageFloor.HorizontalAlignment = HorizontalAlignment.Left;
            imageFloor.Height            = 248;
            imageFloor.Margin            = new Thickness(369, 0, 0, 0);
            imageFloor.VerticalAlignment = VerticalAlignment.Top;
            imageFloor.Width             = 373;

            bodyFloorGrid.Children.Add(imageFloor);

            bodyFloorGrid.Children.Add(stackFloorPanel);
            tabFloor.Content = bodyFloorGrid;

            #endregion Döşeme listesini getiriyor

            #region Opsiyon listesini getiriyor
            List <VehicleFeatures> optionList = generalOperation.GetAllVehicleFeaturesByPackageTypeAndVehicleFeaturesType(packageType, Helper.VehicleFeaturesTypeList.OptionList);

            Grid       bodyOptionGrid   = new Grid();
            StackPanel stackOptionPanel = new StackPanel();


            foreach (var item in optionList)
            {
                CheckBox checkBox = new CheckBox()
                {
                    Content     = item.FeaturesName,
                    DataContext = item
                };
                checkBox.Checked   += CheckBox_Checked;
                checkBox.Unchecked += CheckBox_Unchecked;
                stackOptionPanel.Children.Add(checkBox);
            }



            Image imageOption = new Image();
            imageOption.Source = new BitmapImage(new Uri(startupPath + "/image/option.jpg"));
            imageOption.HorizontalAlignment = HorizontalAlignment.Left;
            imageOption.Height            = 248;
            imageOption.Margin            = new Thickness(369, 0, 0, 0);
            imageOption.VerticalAlignment = VerticalAlignment.Top;
            imageOption.Width             = 373;

            bodyOptionGrid.Children.Add(imageOption);

            bodyOptionGrid.Children.Add(stackOptionPanel);
            tabOption.Content = bodyOptionGrid;

            #endregion Opsiyon listesini getiriyor
        }