Example #1
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            if (ContactTextBox.Text.Length == 0)
            {
                lblError.Visible = true;

                ContactTextBox.Focus();
                return;
            }
            else if (MessageTextBox.Text.Length == 0)
            {
                lblError.Visible = true;

                MessageTextBox.Focus();
                return;
            }
            else
            {
                Mirembajtja obj = new Mirembajtja();
                int         id  = (int)Session["ID"];

                obj.DataMirembajtjes = DateTime.Now;
                obj.Pershkrimi       = MessageTextBox.Text;
                obj.ProduktiID       = id;
                obj.PunetoriID       = PunetoriID(ContactTextBox.Text);

                MirembajtjaMapper objm = new MirembajtjaMapper(obj);
                objm.Insert();
                Response.Redirect("Index.aspx");
            }
        }
        private bool ValidateForm()
        {
            if (!Regex.Match(TitleTextBox.Text, @"^\D{1,50}$").Success)
            {
                MessageBox.Show("Title must consist of at least 1 character and not exceed 50 characters!");
                TitleTextBox.Focus();
                return(false);
            }

            if (!Regex.Match(ContactTextBox.Text, @"^\D{1,50}$").Success)
            {
                MessageBox.Show("Contact person must consist of at least 1 character and not exceed 50 characters!");
                ContactTextBox.Focus();
                return(false);
            }

            if (!Regex.Match(PhoneTextBox.Text, @"^\d{10}$").Success)
            {
                MessageBox.Show("Phone number must consist of 10 digits!");
                PhoneTextBox.Focus();
                return(false);
            }

            if (!Regex.Match(AddressTextBox.Text, @"^(Вул\.\s\D{1,40}\,\s\d{1,3})$").Success)
            {
                MessageBox.Show("Address must consist of at least 1 character and not exceed 50 characters!");
                AddressTextBox.Focus();
                return(false);
            }

            return(true);
        }
Example #3
0
        private void Input()
        {
            if (CusNameTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Customer Name");
                CusNameTextBox.Focus();
                return;
            }
            else
            {
                customerIndex = CusNameTextBox.Text;
            }

            if (ContactTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Contact No.");
                ContactTextBox.Focus();
                return;
            }
            else
            {
                contacts = Convert.ToInt32(ContactTextBox.Text);
            }
            if (AdressTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Your Address");
                AdressTextBox.Focus();
                return;
            }
            else
            {
                addressIndex = AdressTextBox.Text;
            }
            if (PriceComboBox.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Your Info");
                PriceComboBox.Focus();
                return;
            }
            else
            {
                priceIndex = PriceComboBox.Text;
            }

            if (String.IsNullOrEmpty(OrderComboBox.Text) || String.IsNullOrEmpty(QuantityNumericUpDown.Text))
            {
                MessageBox.Show("Order Item and Order Quantity Field Required");
            }
        }
        private bool verifier()
        {
            if (NomTextBox.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Nom est Obligatoire", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NomTextBox.Focus();
            }
            if (PrenomTextBox.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Prenom est Obligatoire", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                PrenomTextBox.Focus();
            }
            if (ContactTextBox.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Contact est Obligatoire", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ContactTextBox.Focus();
            }
            else
            {
                int  tempContact;
                bool isNumeric = int.TryParse(ContactTextBox.Text.Trim(), out tempContact);

                if (!isNumeric)
                {
                    MessageBox.Show("Le Numéro de Telephone doit être une valeur Numerique", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    ContactTextBox.Clear();
                    ContactTextBox.Focus();
                    return(false);
                }
            }
            if (ContactTextBox.Text.Length != 8)
            {
                MessageBox.Show("Veuillez vérifier le numero de telephone", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ContactTextBox.Focus();
            }
            if (FonctionComboBox.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Fonction est Obligatoire", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                FonctionComboBox.Focus();
            }
            if (SalaireTextBox.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Salaire est Obligatoire", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                SalaireTextBox.Focus();
            }

            return(true);
        }