Пример #1
0
        public void RemoveById(int id)
        {
            CarWash result = GetCarWashById(id);

            db.Car_Wash.Remove(result);
            db.SaveChanges();
        }
Пример #2
0
        private void OnCadastrarNew(object sender, EventArgs e)
        {
            var carWash = new CarWash();

            carWash.Nome     = nomeEntry.Text;
            carWash.CPF      = cpfEntry.Text;
            carWash.Endereço = endereçoEntry.Text;
            carWash.Email    = emailEntry.Text;
            carWash.Senha    = senhaEntry.Text;

            CarWashDAO dao = new CarWashDAO();

            dao.Adicionar(carWash);


            Navigation.PushAsync(new MainPage(null));

            if (string.IsNullOrEmpty(nomeEntry.Text))
            {
                DisplayAlert("Erro", "É necessário digitar um nome", "OK");

                Navigation.PushAsync(new CadastroPage(false, null));

                return;
            }

            if (string.IsNullOrEmpty(cpfEntry.Text))
            {
                DisplayAlert("Erro", "Digite seu CPF", "OK");

                Navigation.PushAsync(new CadastroPage(false, null));

                return;
            }

            if (string.IsNullOrEmpty(emailEntry.Text))
            {
                DisplayAlert("Erro", "É necessário digitar um endereço", "OK");

                Navigation.PushAsync(new CadastroPage(false, null));

                return;
            }
            if (string.IsNullOrEmpty(senhaEntry.Text))
            {
                DisplayAlert("Erro", "É necessário digitar um endereço", "OK");

                Navigation.PushAsync(new CadastroPage(false, null));

                return;
            }
            if (string.IsNullOrEmpty(endereçoEntry.Text))
            {
                DisplayAlert("Erro", "É necessário digitar um endereço", "OK");

                Navigation.PushAsync(new CadastroPage(false, null));

                return;
            }
        }
Пример #3
0
 public CarWashTest()
 {
     logger                = new FakeLogger();
     detailsSource         = new FakeDetailsSource();
     detailsSerializer     = new FakeDetailsSerializer();
     detailsPricingFactory = new DetailsPricingFactory(logger);
     carWash               = new CarWash(logger, detailsSource, detailsSerializer, detailsPricingFactory);
 }
Пример #4
0
        public void AddCarWash(CarWash carWash)
        {
            using (var db = new CarWashBookingDbContext(_context))
            {
                db.CarWashes.Add(carWash);

                db.SaveChanges();
            }
        }
Пример #5
0
        public async Task   DeleteCarWash(CarWash carWash)
        {
            using (var db = new CarWashBookingDbContext(_context))
            {
                var result = await Task.FromResult(db.CarWashes.Remove(carWash));

                var saved = await Task.FromResult(db.SaveChanges());
            }
        }
Пример #6
0
        public static void A_ChildObjectsCanBeUsedAsBase()
        {
            Vehicle tractor = new Tractor(50, 2015, 4);
            Vehicle bicycle = new Bicycle(30);

            var washer = new CarWash();

            washer.Wash(tractor);
            washer.Wash(bicycle);
        }
Пример #7
0
 public CarWashWindow(ProjectDBContext db, CarWash cw = null)
 {
     this.cw = cw;
     if (this.cw == null)
     {
         this.cw = new CarWash();
     }
     this.db = db;
     InitializeComponent();
 }
Пример #8
0
        public static void Main(string[] args)
        {
            Garage garage = new Garage();

            foreach (var car in garage)
            {
                CarWash wash = Washer.Wash;
                wash(car);
                Console.WriteLine("Car " + car.name + " is " + car.station);
            }
        }
Пример #9
0
        public MainPage(CarWash carWash)
        {
            InitializeComponent();

            if (carWash != null)
            {
                this.carWash    = carWash;
                nomeEntry.Text  = carWash.Nome;
                senhaEntry.Text = carWash.Senha;
            }
        }
Пример #10
0
        void Delete(int n, System.Collections.IList items)
        {
            switch (n)
            {
            case 0:
                Bill[] bills = new Bill[items.Count];
                items.CopyTo(bills, 0);
                db.Bill.RemoveRange(bills);
                break;

            case 1:
                Entry[] entries = new Entry[items.Count];
                items.CopyTo(entries, 0);
                db.Entry.RemoveRange(entries);
                break;

            case 2:
                Product[] products = new Product[items.Count];
                items.CopyTo(products, 0);
                db.Product.RemoveRange(products);
                break;

            case 3:
                Service[] services = new Service[items.Count];
                items.CopyTo(services, 0);
                db.Service.RemoveRange(services);
                break;

            case 4:
                Client[] clients = new Client[items.Count];
                items.CopyTo(clients, 0);
                db.Client.RemoveRange(clients);
                break;

            case 5:
                CarWash[] cws = new CarWash[items.Count];
                items.CopyTo(cws, 0);
                db.CarWash.RemoveRange(cws);
                break;
            }
            try
            {
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            Refresh(n);
        }
Пример #11
0
        void ChangeEntries(CarWash carWash)
        {
            if (carWash == null)
            {
                return;
            }
            var entries = db.Entry.Where(x => x.Bill == null && x.CarWash == carWash.Id).ToList();

            if (bill.Id != 0 && bill.Entry != null && bill.Entry.CarWash == carWash.Id)
            {
                entries.Add(bill.Entry);
            }
            entry_cb.ItemsSource = entries;
        }
Пример #12
0
        public CadastroPage(bool isEdit, CarWash carWash)
        {
            InitializeComponent();

            CadastrarButton.IsVisible = !isEdit;
            if (carWash != null)
            {
                this.carWash       = carWash;
                nomeEntry.Text     = carWash.Nome;
                cpfEntry.Text      = carWash.CPF;
                endereçoEntry.Text = carWash.Endereço;
                emailEntry.Text    = carWash.Email;
                senhaEntry.Text    = carWash.Senha;
            }
        }
Пример #13
0
        public async Task SaveCarWash(CarWash carWash)
        {
            using (var db = new CarWashBookingDbContext(_context))
            {
                var result = await Task.FromResult(db.CarWashes.Where(w => w.ID == carWash.ID).FirstOrDefault());

                if (result != null)
                {
                    result.Adresse = carWash.Adresse;
                    result.Name    = carWash.Name;
                    result.Image   = carWash.Image;
                    db.SaveChanges();
                }
            }
        }
Пример #14
0
        public IActionResult AddCarWash(NewCarWashViewModel carWashModel)
        {
            string base64;

            using (var ms = new MemoryStream())
            {
                carWashModel.UploadFile.CopyTo(ms);
                var fileBytes = ms.ToArray();
                base64 = $"data:image/png;base64,{Convert.ToBase64String(fileBytes)}";
            }
            var carWash = new CarWash {
                Adresse = carWashModel.Adresse, Image = base64, Name = carWashModel.Name
            };

            _carWashBookingService.AddCarWash(carWash);
            return(RedirectToAction("Index", "Admin"));
        }
Пример #15
0
 public CarWashUpdater(CarWash carWash)
 {
     _carWash = carWash;
 }
Пример #16
0
 public void Create(CarWash carWash)
 {
     db.Car_Wash.Add(carWash);
     db.SaveChanges();
 }
Пример #17
0
 public void Edit(CarWash carWash)
 {
     db.Entry(carWash).State = EntityState.Modified;
     db.SaveChanges();
 }
Пример #18
0
 public IActionResult DeleteCarWash(CarWash carWash)
 {
     _carWashBookingService.DeleteCarWash(carWash);
     return(RedirectToAction("Index", "Admin"));
 }
Пример #19
0
 public void Adicionar(CarWash carWash)
 {
     conexao.Insert(carWash);
 }
Пример #20
0
 public void Encontrar(CarWash carWash)
 {
     conexao.Get <CarWash>(carWash);
 }
Пример #21
0
 public CarWashController(CarWash carWash)
 {
     _carWash = carWash;
 }