Ejemplo n.º 1
0
        public MetroPanel addCard(Domain.Entities.Car car, int i, int x, int y)
        {
            MetroPanel newCard = new MetroPanel();

            newCard.Size     = card.Size;
            newCard.Theme    = card.Theme;
            newCard.Name     = "Card" + i;
            newCard.TabIndex = i + 1;
            newCard.Location = new Point(x, y);
            newCard.Controls.Add(addPictureBox(car.Id));
            newCard.Controls.Add(addTitle(car));
            newCard.Controls.Add(addSubscription(car));
            newCard.Controls.Add(addCifrao(car));
            newCard.Controls.Add(addButton(car.Id));
            newCard.Controls.Add(addRentButton(car.Id));
            if (User.Id != 0 && !User.isAdmin || Client.Id != 0)
            {
                var rentButton = newCard.Controls.OfType <MetroLink>().Where(btn => btn.Text == "Alugar");
                foreach (var item in rentButton)
                {
                    item.Visible = true;
                }
            }
            return(newCard);
        }
Ejemplo n.º 2
0
 public void Update(Domain.Entities.Car car)
 {
     query = $@"Update Car 
             set Color = '{car.Color}', Board = '{car.Board}', Model = '{car.Model}', Fuel = '{car.Fuel}', Doors = {car.Doors}, Year = {car.Year}, Branch = '{car.Branch}'  
             WHERE idCar = {car.Id}";
     _context.CommandWithoutReturn(query);
 }
Ejemplo n.º 3
0
 public EditCar()
 {
     InitializeComponent();
     _appCar   = new DBCar();
     _appImage = new DBImage();
     Car       = new Domain.Entities.Car();
 }
Ejemplo n.º 4
0
 public Create()
 {
     InitializeComponent();
     _appCar   = new DBCar();
     _appImage = new DBImage();
     Images    = new List <PictureBox>();
     Car       = new Domain.Entities.Car();
 }
Ejemplo n.º 5
0
 public int Insert(Domain.Entities.Car car)
 {
     query = $@"INSERT INTO 
                 Car
                 (Color,Board,Model,Fuel,Doors,Year,Branch,Available)
                 output inserted.idCar
             VALUES ('{car.Color}', '{car.Board}' , '{car.Model}', '{car.Fuel}', {car.Doors}, {car.Year}, '{car.Branch}', 0 )";
     return _context.CommandWithReturnId(query);
 }
Ejemplo n.º 6
0
 public CarDetails(int carId, MetroStyleManager manager)
 {
     InitializeComponent();
     this.StyleManager = manager;
     Load_Page();
     Car        = _appCar.GetCar(id: carId);
     Images     = _appImage.GetImages(Car.Id);
     imageCount = Images.Count;
 }
Ejemplo n.º 7
0
        public MetroPanel addCard(Domain.Entities.Car car, int i, int x, int y)
        {
            MetroPanel newCard = new MetroPanel();

            newCard.Size     = card.Size;
            newCard.Name     = "Card" + i;
            newCard.TabIndex = i + 1;
            newCard.Location = new Point(x, y);
            newCard.Controls.Add(addPictureBox(car.Id));
            newCard.Controls.Add(addTitle(car));
            newCard.Controls.Add(addSubscription(car));
            newCard.Controls.Add(addCifrao(car));
            newCard.Controls.Add(addButton(car.Id));

            return(newCard);
        }
Ejemplo n.º 8
0
        private void DetalheAluguel_Load(object sender, EventArgs e)
        {
            Images = Load_Image();
            Domain.Entities.Car    car    = Load_Car();
            Domain.Entities.Client client = Load_Client();
            if (Rent.idEmployee != 0)
            {
                Domain.Entities.Employee employee = Load_Employee();
                this.employee.Text    = employee.Name;
                this.employee.Visible = true;
                employeeTitle.Visible = true;
            }
            this.client.Text = client.Name;
            email.Text       = client.Email;
            pickUp.Text      = Rent.PickUpDate.ToString("dd/MM/yyyy HH:mm");
            dropOff.Text     = Rent.DropOffDate.ToString("dd/MM/yyyy HH:mm");
            status.Text      = car.Status == true ? "Disponível" : "Indisponível";
            amount.Text      = Rent.Value.ToString("C2", CultureInfo.CurrentCulture);

            if (Rent.PaymentType == Domain.Entities.PaymentTypeEnum.Billet)
            {
                payment.Text = "Boleto";
            }
            else if (Rent.PaymentType == Domain.Entities.PaymentTypeEnum.Card)
            {
                payment.Text = "Cartão";
            }
            else
            {
                payment.Text = "Dinheiro";
            }

            branch.Text = car.Branch;
            model.Text  = car.Model;
            board.Text  = car.Board;
            doors.Text  = car.Doors.ToString();
            board.Text  = car.Board;
            fuel.Text   = car.Fuel;
            color.Text  = car.Color;
            year.Text   = car.Year.ToString();
            if (Images.Any())
            {
                image.Image = Image.FromFile(Servers.path + Images.Select(x => x.Path).FirstOrDefault() + Images.Select(x => x.Name).FirstOrDefault());
            }
        }
Ejemplo n.º 9
0
        private void metroLink3_Click(object sender, EventArgs e)
        {
            SetValueCar form = new SetValueCar(this.StyleManager);

            Domain.Entities.Car car = _appCar.GetCar(id: int.Parse(RowView["idCar"].ToString()));
            form.Car = car;
            var isNew = _appAmount.GetAmount(car.Id);

            if (isNew.idCar != 0)
            {
                form.isNew = false;
            }
            else
            {
                form.isNew = true;
            }

            form.ShowDialog();
        }
Ejemplo n.º 10
0
        public Rent(Domain.Entities.Car car, AmountCar amount, User user, MetroStyleManager manager, Domain.Entities.Client client = null)
        {
            InitializeComponent();
            this.StyleManager = manager;
            Load_Page();
            Images     = new List <Image>();
            User       = new User();
            FullClient = new Domain.Entities.ClientCardCNH();
            Car        = new Domain.Entities.Car();

            Car  = car;
            User = user;

            Images = _appImage.GetImages(car.Id);
            if (User.isAdmin)
            {
                FullClient = _appClient.GetClientCNHByUser(client.User_Id);
            }
            else
            {
                FullClient = _appClient.GetClientCNHByUser(User.Id);
            }

            imageCount = Images.Count;

            List <Card> cards = new List <Card>();

            cards = _appCard.GetCard(FullClient.Client.Id);

            FullClient.Card.AddRange(cards);

            drop_offDate.MinDate = DateTime.Today.AddDays(1).AddSeconds(-10);
            drop_offDate.Value   = DateTime.Now.AddDays(1);

            pick_upDate.MinDate = DateTime.Today.AddSeconds(-10);
            pick_upDate.Value   = DateTime.Now;

            DateTime time = DateTime.Today;

            for (DateTime _time = time.AddHours(00); _time < time.AddHours(24); _time = _time.AddMinutes(30)) //from 16h to 18h hours
            {
                metroComboBox1.Items.Add(_time.ToShortTimeString());
                metroComboBox2.Items.Add(_time.ToShortTimeString());
            }

            AmountPerDay.Text = amount.Amount.ToString("C2", CultureInfo.CurrentCulture);

            fillFieldsCar();
            Load_Images();
            Load_Cards();
            Set_date(this, new EventArgs());

            Money  = money;
            Billet = billet;
            if (panelMoney.Controls.OfType <RadioButton>().Any())
            {
                Card = panelCard.Controls.OfType <RadioButton>();
                foreach (var item in Card)
                {
                    item.Checked = false;
                }
            }

            Money.Checked  = true;
            Billet.Checked = false;
        }