Beispiel #1
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxNom.Text) || string.IsNullOrEmpty(textBoxMot.Text))
            {
                MessageBox.Show("Le nom d'utilisateur et un mot de passe sont obligatoire.", "Attention", MessageBoxButtons.OK);
                textBoxNom.Focus();
            }
            else
            {
                MultiLocationsDAL dal = new MultiLocationsDAL();

                if (dal.ValidateUtilisateur(textBoxNom.Text.ToLower(), textBoxMot.Text))
                //if (textBoxNom.Text.ToUpper() == "ADMIN" && textBoxMot.Text == "admin")
                {
                    MainForm mainForm = new MainForm();
                    mainForm.Visible = true;
                    mainForm.Activate();

                    this.Visible = false;
                }
                else
                {
                    essaiLogin++;

                    if (essaiLogin > 3)
                    {
                        MessageBox.Show("Vous avez dépassé la limite de tentatives!", "Attention", MessageBoxButtons.OK);
                        Application.Exit();
                    }

                    MessageBox.Show("Le nom d'utilisateur et le mot de passe sont incorrects.", "Attention", MessageBoxButtons.OK);
                    textBoxNom.Focus();
                }
            }
        }
        private void buttonSauvergarder_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(textBoxIDLocation.Text))
            {
                MessageBox.Show("L'ID location est obligatoire.", "Attention", MessageBoxButtons.OK);
                textBoxIDLocation.Focus();

                return;
            }

            MultiLocationsDAL dal      = new MultiLocationsDAL();
            LocationModel     location = dal.GetLocation(Convert.ToInt32(textBoxIDLocation.Text));

            location.Id             = Convert.ToInt32(textBoxIDLocation.Text);
            location.DateLocation   = !string.IsNullOrWhiteSpace(textBoxDateLocation.Text) ? Convert.ToDateTime(textBoxDateLocation.Text) : DateTime.Now;
            location.DatePaiement   = !string.IsNullOrWhiteSpace(textBoxDatePaiement.Text) ? Convert.ToDateTime(textBoxDatePaiement.Text) : DateTime.MinValue;
            location.MontantMensuel = !string.IsNullOrWhiteSpace(textBoxMontantMensuel.Text) ? Convert.ToDecimal(textBoxMontantMensuel.Text) : 0;
            location.NombrePaiment  = !string.IsNullOrWhiteSpace(textBoxNombrePaiement.Text) ? Convert.ToInt32(textBoxNombrePaiement.Text) : 0;
            location.IDVehicule     = !string.IsNullOrWhiteSpace(textBoxIDVehicule.Text) ? Convert.ToInt32(textBoxIDVehicule.Text) : 0;
            location.IDClient       = !string.IsNullOrWhiteSpace(textBoxIDClient.Text) ? Convert.ToInt32(textBoxIDClient.Text) : 0;
            location.IDTerme        = !string.IsNullOrWhiteSpace(textBoxIDTerme.Text) ? Convert.ToInt32(textBoxIDTerme.Text) : 0;
            location.KmInitial      = !string.IsNullOrWhiteSpace(textBoxkmInitial.Text) ? Convert.ToDecimal(textBoxkmInitial.Text) : 0;
            location.KmFinal        = !string.IsNullOrWhiteSpace(textBoxKmFinal.Text) ? Convert.ToDecimal(textBoxKmFinal.Text) : 0;

            dal.ModifierLocation(location);

            MessageBox.Show(dal.message);
        }
        private void buttonRechercher_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(textBoxIDLocation.Text))
            {
                MessageBox.Show("L'ID location est obligatoire.", "Erreur", MessageBoxButtons.OK);
                textBoxIDLocation.Focus();
                return;
            }


            MultiLocationsDAL dal      = new MultiLocationsDAL();
            LocationModel     location = dal.GetLocation(Convert.ToInt32(textBoxIDLocation.Text));

            textBoxIDLocation.Text     = location.Id.ToString();
            textBoxDateLocation.Text   = location.DateLocation.ToString();
            textBoxDatePaiement.Text   = location.DatePaiement.ToString();
            textBoxMontantMensuel.Text = location.MontantMensuel.ToString();
            textBoxNombrePaiement.Text = location.NombrePaiment.ToString();
            textBoxIDVehicule.Text     = location.IDVehicule.ToString();
            textBoxIDClient.Text       = location.IDClient.ToString();
            textBoxIDTerme.Text        = location.IDTerme.ToString();
            textBoxkmInitial.Text      = location.KmInitial.ToString();
            textBoxKmFinal.Text        = location.KmFinal.ToString();

            if (!string.IsNullOrWhiteSpace(dal.message))
            {
                MessageBox.Show(dal.message);
            }
        }
        private void buttonSauvergarder_Click(object sender, EventArgs e)
        {
            MultiLocationsDAL dal = new MultiLocationsDAL();

            dal.EffectuerPaiement(Convert.ToDateTime(this.textBoxDateLocation.Text), Convert.ToDecimal(textBoxMontant.Text), Convert.ToInt32(textBoxIDLocation.Text));
            MessageBox.Show(dal.message);
        }
        private void buttonSauvergarder_Click(object sender, EventArgs e)
        {
            MultiLocationsDAL dal = new MultiLocationsDAL();

            dal.AnnulerPaiement(Convert.ToInt32(textBoxIDPaiement.Text), textBoxRaison.Text);

            MessageBox.Show(dal.message);
        }
Beispiel #6
0
        private void buttonSauvergarder_Click(object sender, EventArgs e)
        {
            LocationModel location = new LocationModel();

            location.DateLocation   = !string.IsNullOrWhiteSpace(textBoxDateLocation.Text) ? Convert.ToDateTime(textBoxDateLocation.Text): DateTime.Now;
            location.DatePaiement   = !string.IsNullOrWhiteSpace(textBoxDatePaiement.Text) ? Convert.ToDateTime(textBoxDatePaiement.Text) : DateTime.MinValue;
            location.MontantMensuel = !string.IsNullOrWhiteSpace(textBoxMontantMensuel.Text) ? Convert.ToDecimal(textBoxMontantMensuel.Text): 0;
            location.NombrePaiment  = !string.IsNullOrWhiteSpace(textBoxNombrePaiement.Text) ?  Convert.ToInt32(textBoxNombrePaiement.Text) : 0;
            location.IDVehicule     = !string.IsNullOrWhiteSpace(textBoxIDVehicule.Text) ? Convert.ToInt32(textBoxIDVehicule.Text) : 0;
            location.IDClient       = !string.IsNullOrWhiteSpace(textBoxIDClient.Text) ? Convert.ToInt32(textBoxIDClient.Text) : 0;
            location.IDTerme        = !string.IsNullOrWhiteSpace(textBoxIDTerme.Text) ? Convert.ToInt32(textBoxIDTerme.Text) : 0;
            location.KmInitial      = !string.IsNullOrWhiteSpace(textBoxkmInitial.Text) ? Convert.ToDecimal(textBoxkmInitial.Text) : 0;
            location.KmFinal        = !string.IsNullOrWhiteSpace(textBoxKmFinal.Text) ? Convert.ToDecimal(textBoxKmFinal.Text) : 0;

            MultiLocationsDAL dal = new MultiLocationsDAL();

            dal.AjouterLocation(location);

            if (!string.IsNullOrEmpty(dal.message))
            {
                MessageBox.Show(dal.message);
            }
        }