Esempio n. 1
0
        public override void ShowUserInterface(out DialogResult dialogResult)
        {
            FormClient formClient = new FormClient();

            formClient.ShowDialog();
            dialogResult = formClient.DialogResult;
        }
Esempio n. 2
0
        private void metroLink16_Click(object sender, EventArgs e)
        {
            FormClient form = new FormClient();

            form.User = User;
            this.Hide();
            form.ShowDialog();
            this.Close();
        }
Esempio n. 3
0
        private void clientToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormClient formClient = new FormClient(this);

            formClient.tbId.Text        = dgv1.CurrentRow.Cells[1].Value.ToString();
            formClient.tbId.Enabled     = false;
            formClient.tbNom.Text       = dgv1.CurrentRow.Cells[2].Value.ToString();
            formClient.tbNom.Enabled    = false;
            formClient.tbPrenom.Text    = dgv1.CurrentRow.Cells[3].Value.ToString();
            formClient.tbPrenom.Enabled = false;
            formClient.tbAdr.Text       = dgv1.CurrentRow.Cells[4].Value.ToString();
            formClient.ShowDialog();
        }
Esempio n. 4
0
 private void metroLabel8_Click(object sender, EventArgs e)
 {
     if (User.isAdmin)
     {
         FormMain form = new FormMain();
         form.User = User;
         this.Hide();
         form.ShowDialog();
         this.Close();
     }
     else
     {
         FormClient form = new FormClient();
         form.User = User;
         this.Hide();
         form.ShowDialog();
         this.Close();
     }
 }
Esempio n. 5
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            var username = metroTextBox1.Text;
            var password = metroTextBox2.Text;

            if (username == "")
            {
                error.SetError(metroTextBox1, "Campo Obrigatório");
            }
            if (password == "")
            {
                error.SetError(metroTextBox2, "Campo Obrigatório");
            }
            if (password != "" && username != "")
            {
                var user = _appUser.GetUser(userName: username, password: password);
                if (user.Id != 0)
                {
                    if (user.isAdmin)
                    {
                        FormMain admin = new FormMain();
                        admin.User = user;
                        this.Hide();
                        admin.ShowDialog();
                        this.Close();
                    }
                    else
                    {
                        FormClient client = new FormClient();
                        client.User = user;
                        this.Hide();
                        client.ShowDialog();
                        this.Close();
                    }
                }
                else
                {
                    MetroMessageBox.Show(this, "Usuário não encontrado", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error, 100);
                }
            }
        }
Esempio n. 6
0
        private void confirmButton_Click(object sender, EventArgs e)
        {
            if (drop_offDate.Value < pick_upDate.Value)
            {
                MetroMessageBox.Show(this, "A data de devolução não deve ser menor que a data de retirada", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning, 100);
            }
            else
            {
                MetroRadioButton payment = new MetroRadioButton();
                PaymentTypeEnum  paymentType;
                if (billet.Checked)
                {
                    payment     = billet;
                    paymentType = PaymentTypeEnum.Billet;
                }
                else if (money.Checked)
                {
                    payment     = money;
                    paymentType = PaymentTypeEnum.Money;
                }
                else
                {
                    payment     = Card.OfType <MetroRadioButton>().Where(x => x.Checked == true).FirstOrDefault();
                    paymentType = PaymentTypeEnum.Card;
                }

                var hourPickUp = metroComboBox1.SelectedItem.ToString().Split(':');
                pick_upDate.Value = pick_upDate.Value.Add(new TimeSpan(-pick_upDate.Value.Hour, -pick_upDate.Value.Minute, -pick_upDate.Value.Second));
                DateTime pickUp = pick_upDate.Value.Add(new TimeSpan(int.Parse(hourPickUp[0]), int.Parse(hourPickUp[1]), 0));


                var hourDropOff = metroComboBox2.SelectedItem.ToString().Split(':');
                drop_offDate.Value = drop_offDate.Value.Add(new TimeSpan(-drop_offDate.Value.Hour, -drop_offDate.Value.Minute, -drop_offDate.Value.Second));
                DateTime dropOff = drop_offDate.Value.Add(new TimeSpan(int.Parse(hourDropOff[0]), int.Parse(hourDropOff[1]), 0));

                Domain.Entities.Rent rent = new Domain.Entities.Rent()
                {
                    idCar       = Car.Id,
                    idClient    = FullClient.Client.Id,
                    PickUpDate  = pickUp,
                    DropOffDate = dropOff,
                    Value       = double.Parse(value.Text.Replace("R$", "")),
                    PaymentType = paymentType,
                };

                if (rent.PaymentType == PaymentTypeEnum.Card)
                {
                    rent.idCard = payment.TabIndex;
                }

                if (User.isAdmin)
                {
                    var employee = _appEmployee.GetEmployee(User.Id);
                    rent.idEmployee = employee.Id;
                }

                try
                {
                    _appRent.Insert(rent);
                    MetroMessageBox.Show(this, "Aluguel registrado.", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Question, 100);
                    if (User.isAdmin)
                    {
                        FormMain form = new FormMain();
                        form.User = User;
                        this.Hide();
                        form.ShowDialog();
                        this.Close();
                    }
                    else
                    {
                        FormClient form = new FormClient();
                        form.User = User;
                        this.Hide();
                        form.ShowDialog();
                        this.Close();
                    }
                }
                catch
                {
                    MetroMessageBox.Show(this, "Erro Inesperado. Por favor entre em contato com seu administrador", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error, 100);
                }
            }
        }