Example #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);
            }
        }
        public ChoosePackage()
        {
            InitializeComponent();

            generalOperation        = new GeneralOperation();
            btnChoosePackage.Click += BtnChoosePackage_Click;
            imgNormal.Source        = new BitmapImage(new Uri("pack://application:,,,/image/standart.png"));
            imgSpecial.Source       = new BitmapImage(new Uri("pack://application:,,,/image/special.png"));

            int carId = StaticOrder.GetCarId();

            Cars car = generalOperation.GetCarById(carId);

            lblModelName.Content = car.CarName;
        }
Example #3
0
        private void BtnOrder_Click(object sender, RoutedEventArgs e)
        {
            if (deallerId == 0)
            {
                MessageBox.Show("Lütfen Bayi Seçiniz");
                return;
            }
            else if (string.IsNullOrEmpty(tbxemail.Text))
            {
                MessageBox.Show("Lütfen Mail Giriniz");
                return;
            }
            else if (string.IsNullOrEmpty(tbxFullName.Text))
            {
                MessageBox.Show("Lütfen Ad Soyad Giriniz");
                return;
            }
            else if (string.IsNullOrEmpty(tbxPhone.Text))
            {
                MessageBox.Show("Lütfen Telefon Giriniz");
                return;
            }
            Dealer dealer = generalOperation.GetDealerById(deallerId);

            Orders orders = new Orders()
            {
                AppUserId         = StaticUser.GetUser().AppUserId,
                CarsId            = StaticOrder.GetCarId(),
                IsActive          = true,
                CreateDate        = DateTime.Now,
                IsDeleted         = false,
                IsStandartPackage = StaticOrder.GetPackageTypeId() == 1?true:false,
                StatusType        = (int)OrderStatus.Draft,
                DealerId          = deallerId
            };

            orders.OrderDetails.Add(new OrderDetails
            {
                IsActive          = true,
                CreateDate        = DateTime.Now,
                IsDeleted         = false,
                VehicleFeaturesId = bodyFeatureId
            });
            orders.OrderDetails.Add(new OrderDetails
            {
                IsActive          = true,
                CreateDate        = DateTime.Now,
                IsDeleted         = false,
                VehicleFeaturesId = colorFeatureId
            });
            orders.OrderDetails.Add(new OrderDetails
            {
                IsActive          = true,
                CreateDate        = DateTime.Now,
                IsDeleted         = false,
                VehicleFeaturesId = engineFeatureId
            });
            orders.OrderDetails.Add(new OrderDetails
            {
                IsActive          = true,
                CreateDate        = DateTime.Now,
                IsDeleted         = false,
                VehicleFeaturesId = floorFeatureId
            });
            orders.OrderDetails.Add(new OrderDetails
            {
                IsActive          = true,
                CreateDate        = DateTime.Now,
                IsDeleted         = false,
                VehicleFeaturesId = gearboxFeatureId
            });
            string optionTextList = string.Empty;

            foreach (var item in optionList)
            {
                orders.OrderDetails.Add(new OrderDetails
                {
                    IsActive          = true,
                    CreateDate        = DateTime.Now,
                    IsDeleted         = false,
                    VehicleFeaturesId = item
                });

                VehicleFeatures vehicleFeatures = generalOperation.GetByIdVehicleFeatures(item);

                if (string.IsNullOrEmpty(optionTextList))
                {
                    optionTextList = vehicleFeatures.FeaturesName;
                }
                else
                {
                    optionTextList += "</br>" + vehicleFeatures.FeaturesName;
                }
            }
            generalOperation.InsertOrders(orders);

            AppUser appUser = generalOperation.GetAppUserById(orders.AppUserId);

            EmailHelper.Mail(tbxemail.Text, "Talebini Aldık", "Merhaba, " + appUser.Username + "<br>" + "Araç Sipariş Talebini Aldık Yakında Sana Geri Dönüş Yapacağız");

            EmailHelper.Mail(dealer.DealerEmail, "Yeni Sipariş Talebi", "Merhaba , <br>" +
                             "Müşteri Adı:" + appUser.Username + "<br>" +
                             "Telefon Numarası:" + tbxPhone.Text + "<br>" +
                             "Email:" + tbxemail.Text + "<br>" +
                             "</hr>" +
                             "<h1>Araç Bilgileri </h1>" +
                             "<br>" +
                             "Araç Modeli:" + lblCarName.Content + "<br>" +
                             "Araç Paketi:" + lblPackageType.Content + "<br>" +
                             "Araç Gövde Seçimi:" + lblBody.Content + "<br>" +
                             "Araç Motor Seçimi:" + lblEngine.Content + "<br>" +
                             "Araç Şanzıman Seçimi:" + lblGearbox.Content + "<br>" +
                             "Araç Döşeme Seçimi:" + lblFloor.Content + "<br>" +
                             "Araç Opsiyon Seçimleri:" + optionTextList + "<br>" +
                             "İyi Çalışmalar Teklif Olarak Müşteriye Dönüş Yapınız");

            Home home = new Home();

            this.Close();
            home.Show();
        }