Exemple #1
0
        private bool Validar()
        {
            bool paso = true;

            ErrorProvider1.Clear();

            if (string.IsNullOrWhiteSpace(EstudianteTextBox.Text))
            {
                ErrorProvider1.SetError(EstudianteTextBox, "El campo  no puede estar vacio");
                EstudianteTextBox.Focus();
                paso = false;
            }

            if (ValorTextbox.Text == string.Empty)
            {
                ErrorProvider1.SetError(, "El campo  no puede estar vacio");
                ValorTextbox.Focus();
                paso = false;
            }

            if (ApellidoTextbox.Text == string.Empty)
            {
                MyerrorProvider.SetError(ApellidoTextbox, "El campo no puede estar vacio");
                ApellidoTextbox.Focus();
                paso = false;
            }

            return(paso);
        }
Exemple #2
0
        /// <summary>
        /// Méthode pour la validation du TxtBox2
        /// </summary>
        /// <returns></returns>
        private bool Validation_TxtBox2()
        {
            ErrorProvider1.SetError(TxtBox2, "");
            bool estValide = true;

            TxtBox2.Text = TxtBox2.Text.Trim();

            if (String.IsNullOrEmpty(TxtBox2.Text))
            {
                estValide = false;
                ErrorProvider1.SetError(TxtBox2, "Le champ ne peut être vide");
            }

            foreach (char c in TxtBox2.Text)
            {
                if (!Char.IsDigit(c))
                {
                    estValide = false;
                    ErrorProvider1.SetError(TxtBox2, "Le numéro est composé de chiffres.");
                }
            }

            if (estValide)
            {
                if (int.Parse(TxtBox2.Text) > 809)
                {
                    estValide = false;
                    ErrorProvider1.SetError(TxtBox2, "Le maximum est de 809");
                }
            }

            return(estValide);
        }
Exemple #3
0
        /// <summary>
        /// Méthode pour la validation du TxtBox3
        /// </summary>
        /// <returns></returns>
        private bool Validation_TxtBox3()
        {
            ErrorProvider1.SetError(TxtBox3, "");
            bool estValide = true;

            TxtBox3.Text = TxtBox3.Text.Trim();

            if (TxtBox3.Enabled)/// Si le pokémon est attrapé
            {
                if (String.IsNullOrEmpty(TxtBox3.Text))
                {
                    estValide = false;
                    ErrorProvider1.SetError(TxtBox3, "Le champ ne peut être vide");
                }

                //Code défectueux
                //foreach (char c in TxtBox3.Text)
                //{
                //    if (!Char.IsLetter(c))
                //    {
                //        estValide = false;
                //        ErrorProvider1.SetError(TxtBox3, "Le nom du propriétaire est composé seuleument de lettres.");
                //    }
                //}
            }

            return(estValide);
        }
Exemple #4
0
        private void calcButton_Click(object sender, EventArgs e)
        {
            // Variables for hours, pay rate, and gross pay
            decimal hours, payRate, grossPay;

            // Clear any existing errors.
            ErrorProvider1.SetError(hoursTextBox, "");
            ErrorProvider1.SetError(payRateTextBox, "");

            // Get values and calculate gross pay.
            if (decimal.TryParse(hoursTextBox.Text, out hours))
            {
                if (decimal.TryParse(payRateTextBox.Text, out payRate))
                {
                    // Calculate the gross pay.
                    grossPay = hours * payRate;

                    // Display the gross pay.
                    grossPayLabel.Text = grossPay.ToString("c");
                }
                else
                {
                    // Invalid pay rate
                    ErrorProvider1.SetError(payRateTextBox,
                                            "Pay rate must be numeric.");
                }
            }
            else
            {
                // Invalid hours
                ErrorProvider1.SetError(hoursTextBox,
                                        "Hours must be numeric.");
            }
        }
Exemple #5
0
        private void Button6_Click(object sender, EventArgs e)
        {
            yeni = true;
            if (yeni == true)
            {
                ErrorProvider1.SetError(Button3, "");
            }

            if (yeni == false)
            {
                MessageBox.Show("Yeni Kayıt Modundasınız .", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (TextBox1.Text != "")
            {
                Form17 frm17 = new Form17();
                frm17.TextBox1.Text = TextBox1.Text;
                frm17.TextBox2.Text = TextBox2.Text;
                frm17.ShowDialog();
            }
            else
            {
                MessageBox.Show("Barkod Tanımlayabilmek İçin Stok Kodu Girmelisiniz.", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 private void TestRegExp()
 {
     ErrorProvider1.Clear();
     ErrorProvider1.Tag = 0;
     if (TxtInput.Text == "")
     {
         ErrorProvider1.SetError(TxtInput, "Empty String");
         ErrorProvider1.Tag = 1;
         TxtStatus.Text     = "Failed";
     }
     if (TxtRegExp.Text == "")
     {
         ErrorProvider1.SetError(TxtRegExp, "Empty String");
         ErrorProvider1.Tag = 1;
         TxtStatus.Text     = "Failed";
     }
     else if ((int)ErrorProvider1.Tag == 1)
     {
         return;
     }
     _regEx   = new Regex(TxtRegExp.Text);
     _match   = _regEx.Match(TxtInput.Text);
     _length  = _match.Length;
     _index   = _match.Index;
     _value   = _match.Value;
     _success = _match.Success;
     if (!_success)
     {
         ErrorProvider1.SetError(TxtStatus, "No match occurred!");
     }
     TxtStatus.Text = "Success: " + _success + " Length: " + _length + " index: " + _index;
     TxtResult.Text = "" + _value;
 }
Exemple #7
0
 private void txtlname_Validating(object sender, CancelEventArgs e)
 {
     if (txtlname.Text.Length > 0)
     {
         ErrorProvider1.SetError(txtlname, requiredValidate);
     }
     else
     {
         ErrorProvider1.SetError(txtlname, required);
     }
 }
Exemple #8
0
 private void TextBox6_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (!(e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar)))
     {
         ErrorProvider1.SetError(TextBox4, "");
     }
     else
     {
         ErrorProvider1.SetError(TextBox4, "Çıkış miktarı sadece rakamlardan oluşmalıdır.");
     }
 }
Exemple #9
0
 private void ClearForm()
 {
     BiayaIDText.Clear();
     TglText.Value = DateTime.Now;
     JamText.Text  = DateTime.Now.ToString("HH:mm:ss");
     PihakKeduaCombo.SelectedIndex = -1;
     JenisBayarCombo.SelectedIndex = -1;
     KeteranganText.Clear();
     NilIText.Value = 0;
     _listBrg       = null;
     ErrorProvider1.Clear();
 }
 private void TextBoxCustomerName_Validating(object sender, CancelEventArgs e)
 {
     if (TextBoxCustomerName.Text == string.Empty)
     {
         e.Cancel = true;
         ErrorProvider1.SetError(TextBoxCustomerName, @"Please enter a valid name.");
     }
     else
     {
         ErrorProvider1.SetError(TextBoxCustomerName, "");
     }
 }
 private void DateTimePickerOrderDate_Validating(object sender, CancelEventArgs e)
 {
     if (DateTimePickerOrderDate.Value > DateTime.Now)
     {
         e.Cancel = true;
         ErrorProvider1.SetError(DateTimePickerOrderDate, @"Please do not select a future date.");
     }
     else
     {
         ErrorProvider1.SetError(DateTimePickerOrderDate, "");
     }
 }
 private void ComboBoxRushOrder_Validating(object sender, CancelEventArgs e)
 {
     if (ComboBoxRushOrder.Text == string.Empty)
     {
         e.Cancel = true;
         ErrorProvider1.SetError(ComboBoxRushOrder, @"Please select the order rush speed.");
     }
     else
     {
         ErrorProvider1.SetError(ComboBoxRushOrder, "");
     }
 }
 private void ComboBoxDesktopMaterial_Validating(object sender, CancelEventArgs e)
 {
     if (ComboBoxDesktopMaterial.Text == string.Empty)
     {
         e.Cancel = true;
         ErrorProvider1.SetError(ComboBoxDesktopMaterial, @"Please select the desk surface material.");
     }
     else
     {
         ErrorProvider1.SetError(ComboBoxDesktopMaterial, null);
     }
 }
Exemple #14
0
        /// <summary>
        /// Méthode pour la validation du Pnl1, contenant les radio buttons
        /// </summary>
        /// <returns></returns>
        private bool Validation_Pnl1()
        {
            ErrorProvider1.SetError(Pnl1, "");
            bool estValide = true;

            if (!RadioBtn1.Checked && !RadioBtn2.Checked)
            {
                estValide = false;
                ErrorProvider1.SetError(Pnl1, "Veuillez sélectionner un genre");
            }

            return(estValide);
        }
Exemple #15
0
        /// <summary>
        /// Méthode pour la validation du ComboBox1
        /// </summary>
        /// <returns></returns>
        private bool Validation_ComboBox1()
        {
            ErrorProvider1.SetError(ComboBox1, "");
            bool estValide = true;

            if (ComboBox1.SelectedIndex == -1)
            {
                estValide = false;
                ErrorProvider1.SetError(ComboBox1, "Veuillez sélectionner un élement");
            }

            return(estValide);
        }
Exemple #16
0
        private void Button6_Click(object sender, EventArgs e)
        {
            yeni = true;
            if (yeni == true)
            {
                ErrorProvider1.SetError(Button3, "");
            }

            if (yeni == false)
            {
                MessageBox.Show("Yeni Kayıt Modundasınız .", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
        }
        private void TextBoxNumberOfDrawers_Validating(object sender, CancelEventArgs e)
        {
            int  TempWidth = 0;
            bool IntValue  = int.TryParse(TextBoxNumberOfDrawers.Text, out TempWidth);

            if ((TextBoxNumberOfDrawers.Text == string.Empty) || !IntValue || (TempWidth < Desk.MINDRAWERS) || (TempWidth > Desk.MAXDRAWERS))
            {
                e.Cancel = true;
                ErrorProvider1.SetError(TextBoxNumberOfDrawers, @"Please enter number of drawers between " + Desk.MINDRAWERS.ToString() + " and " + Desk.MAXDRAWERS.ToString() + ".");
            }
            else
            {
                ErrorProvider1.SetError(TextBoxNumberOfDrawers, "");
            }
        }
        private void TextBoxDeskWidth_Validating(object sender, CancelEventArgs e)
        {
            int  TempWidth = 0;
            bool IntValue  = int.TryParse(TextBoxDeskWidth.Text, out TempWidth);

            if ((TextBoxDeskWidth.Text == string.Empty) || !IntValue || (TempWidth < Desk.MINWIDTH) || (TempWidth > Desk.MAXWIDTH))
            {
                e.Cancel = true;
                ErrorProvider1.SetError(TextBoxDeskWidth, @"Please enter width between " + Desk.MINWIDTH.ToString() + " and " + Desk.MAXWIDTH.ToString() + " inches.");
            }
            else
            {
                ErrorProvider1.SetError(TextBoxDeskWidth, "");
            }
        }
Exemple #19
0
        private void btnBreuk_Click(object sender, EventArgs e)
        {
            double getal = 0;
            double breuk = 0;

            try {
                ErrorProvider1.SetError(txbGetal, "");
                getal = double.Parse(txbGetal.Text);
                breuk = 1 / getal;
                MessageBox.Show("De breuk van " + getal.ToString() + " is: " + breuk.ToString(), "Bereken breuk");
            } catch (Exception exception) {
                ErrorProvider1.SetError(txbGetal, exception.Message);
                MessageBox.Show("Er is een fout opgetreden", "Error: " + exception.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private double ControleerVeld(TextBox tekstBox, ref bool fout)
        {
            double getal = 0;

            try
            {
                getal = double.Parse(tekstBox.Text);
            }
            catch (FormatException exceptionObject)
            {
                fout = true;
                ErrorProvider1.SetError(tekstBox, exceptionObject.Message);
            }

            return(getal);
        }
Exemple #21
0
        private void Eliminarbutton2_Click(object sender, EventArgs e)
        {
            ErrorProvider1.Clear();
            int id;

            int.TryParse(ID.Text, out id);
            limpiar();
            if (EvaluacionBLL.Eliminar(id))
            {
                MessageBox.Show("Eliminado");
            }
            else
            {
                ErrorProvider.SetError(ID, "No se puede eliminar una persona que no existe");
            }
        }
        private void oplButton_Click(object sender, EventArgs e)
        {
            try
            {
                double a     = 0;
                double b     = 0;
                double c     = 0;
                double opl1  = 0;
                double opl2  = 0;
                bool   foutA = false;
                bool   foutB = false;
                bool   foutC = false;

                //oude resultaten verwijderen
                opl1Label.Text = "";
                opl2Label.Text = "";

                //oude errors verwijderen
                ErrorProvider1.SetError(aTextBox, "");
                ErrorProvider1.SetError(bTextBox, "");
                ErrorProvider1.SetError(cTextBox, "");

                foutA = false;
                foutB = false;
                foutC = false;

                if (aTextBox.Text == Convert.ToString(0))
                {
                    throw new ArithmeticException("a mag niet nul zijn; anders heb je een eerste graadsvergelijking!");
                }

                a = ControleerVeld(aTextBox, ref foutA);
                b = ControleerVeld(bTextBox, ref foutB);
                c = ControleerVeld(cTextBox, ref foutC);

                if ((!foutA) && (!foutB) && (!foutC))
                {
                    LosOp(a, b, c, ref opl1, ref opl2);
                }
            }
            catch (ArithmeticException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        /// <summary>
        ///     The validate.
        /// </summary>
        /// <returns>
        ///     The <see cref="List" />.
        /// </returns>
        public List <Validation> Validate()
        {
            Logger.Trace("Started Validation()");

            List <Validation> result = new List <Validation>();

            if (string.IsNullOrEmpty(TxtName.Text))
            {
                Validation validation = new Validation(
                    ValidationType.ModelErrorName,
                    "The model name may not be empty");
                result.Add(validation);
                ErrorProvider1.SetError(TxtName, validation.Description);
            }

            Logger.Trace("Completed Validation()");
            return(result);
        }
Exemple #24
0
        /// <summary>
        /// Méthode pour la validation du CheckedListBox (élements)
        /// </summary>
        /// <returns></returns>
        private bool Validation_CheckedListBox1()
        {
            ErrorProvider1.SetError(CheckedListBox1, "");
            bool estValide = true;

            if (CheckedListBox1.CheckedItems.Count > 2)
            {
                estValide = false;
                ErrorProvider1.SetError(CheckedListBox1, "Le maximum est de 2");
            }

            if (CheckedListBox1.CheckedItems.Count < 1)
            {
                estValide = false;
                ErrorProvider1.SetError(CheckedListBox1, "Veuillez sélectionner au minimum 1 élement");
            }

            return(estValide);
        }
Exemple #25
0
        private void txtupd_Leave(object sender, System.EventArgs e)
        {
            if ((txtupd.Text == TextBox1.Text))
            {
                ErrorProvider1.Clear();
                ErrorProvider2.SetError(txtupd, "Done! ");
            }
            else
            {
                ErrorProvider2.Clear();
                ErrorProvider1.SetError(txtupd, "passwords should be same ");
            }

            if ((txtupd.Text == TextBox1.Text))
            {
                Button5.Enabled = true;
                Button4.Enabled = true;
            }
        }
Exemple #26
0
        private void button2_Click(object sender, EventArgs e)
        {
            bool err = false;

            foreach (UTextBox t in TextBoxList)
            {
                if (t.Text.Length == 0)
                {
                    ErrorProvider1.SetError(t, required);
                    err = true;
                }
            }
            if (err)
            {
                MessageBox.Show("צריך למלאות את כל השדות");
                return;
            }
            MultipileCheck();
        }
Exemple #27
0
        private void Save()
        {
            ErrorProvider1.Clear();
            if (PihakKeduaCombo.SelectedValue == null)
            {
                ErrorProvider1.SetError(LabelPihakKedua, "Pilih Pihak Kedua");
                return;
            }
            if (JenisBayarCombo.SelectedValue == null)
            {
                ErrorProvider1.SetError(JenisBayarLabel, "Pilih Jenis Bayar");
                return;
            }
            if (BuyerNameTextBox.Text == "")
            {
                ErrorProvider1.SetError(BuyerNameLabel, "Isi Contact Person Customer");
                return;
            }

            var deposit = new DepositModel
            {
                DepositID    = BiayaIDText.Text,
                Tgl          = TglText.Value.ToString("dd-MM-yyyy"),
                Jam          = JamText.Text,
                PihakKeduaID = PihakKeduaCombo.SelectedValue.ToString(),
                BuyerName    = BuyerNameTextBox.Text,
                JenisBayarID = JenisBayarCombo.SelectedValue.ToString(),
                Keterangan   = KeteranganText.Text,
                NilaiDeposit = NilIText.Value,
                ListBrg      = _listBrg
            };

            using (var trans = TransHelper.NewScope())
            {
                var result = _depositBL.Save(deposit);
                _bpKasBL.Generate(result);
                _bpHutangBL.GenHutang(result);
                trans.Complete();
            }
            ClearForm();
            TglText.Focus();
        }
 private void TextBoxDeskDepth_KeyPress(object sender, KeyPressEventArgs e)
 {
     ErrorProvider1.SetError(TextBoxDeskDepth, "");
     if (!char.IsControl(e.KeyChar))
     {
         if (!char.IsDigit(e.KeyChar))
         {
             ErrorProvider1.SetError(TextBoxDeskDepth, @"Please enter depth between " + Desk.MINDEPTH.ToString() + " and " + Desk.MAXDEPTH.ToString() + " inches.");
         }
     }
     else
     {
         int  TempDepth = 0;
         bool IntValue  = int.TryParse(TextBoxDeskDepth.Text, out TempDepth);
         if ((TextBoxDeskDepth.Text == string.Empty) || !IntValue || (TempDepth < Desk.MINDEPTH) || (TempDepth > Desk.MAXDEPTH))
         {
             ErrorProvider1.SetError(TextBoxDeskDepth, @"Please enter depth between " + Desk.MINDEPTH.ToString() + " and " + Desk.MAXDEPTH.ToString() + " inches.");
         }
     }
 }
        private void saldoButton_Click(System.Object sender, System.EventArgs e)
        {
            int bedrag = 0;

            bedrag = Convert.ToInt32(stortingOpnameTextBox.Text);
            ErrorProvider1.SetError(stortingOpnameTextBox, "");
            try
            {
                if (bedrag < 0)
                {
                    myBankrekening.Opname(-bedrag);
                }
                else
                {
                    myBankrekening.Storting(bedrag);
                }
                saldoLabel.Text = Convert.ToString(myBankrekening.Saldo);
            }
            catch (BankException ex)
            {
                ErrorProvider1.SetError(stortingOpnameTextBox, ex.Message);
            }
        }
Exemple #30
0
        /// <summary>
        /// Méthode pour la validation du TxtBox1
        /// </summary>
        /// <returns></returns>
        private bool Validation_TxtBox1()
        {
            ErrorProvider1.SetError(TxtBox1, "");
            bool estValide = true;

            TxtBox1.Text = TxtBox1.Text.Trim();
            if (String.IsNullOrEmpty(TxtBox1.Text))
            {
                estValide = false;
                ErrorProvider1.SetError(TxtBox1, "Le champ ne peut être vide");
            }


            foreach (char c in TxtBox1.Text)
            {
                if (!char.IsLetter(c))
                {
                    estValide = false;
                    ErrorProvider1.SetError(TxtBox1, "Le nom est composé seuleument de lettres.");
                }
            }
            return(estValide);
        }