Ejemplo n.º 1
0
        private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            try
            {
                if (bunifuMetroTextbox3.Text.Length < 11 || bunifuMetroTextbox3.Text.Length > 13)
                {
                    MessageBox.Show("Enter Full Phnone Number");
                    double Number = int.Parse(bunifuMetroTextbox3.Text);
                }

                else
                {
                    if (bunifuMetroTextbox4.Text.Contains("@") && bunifuMetroTextbox4.Text.Contains(".com"))
                    {
                        int cc = 0, ac = 0;
                        foreach (Match m in Regex.Matches(bunifuMetroTextbox4.Text, ".com"))
                        {
                            cc++;
                        }
                        foreach (Match m in Regex.Matches(bunifuMetroTextbox4.Text, "@"))
                        {
                            ac++;
                        }
                        if (cc == 1 && ac == 1)
                        {
                            bool accepetName = true;

                            string name = bunifuMetroTextbox1.Text;
                            foreach (char c in name)
                            {
                                if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '.'))
                                {
                                    accepetName = false;
                                    break;
                                }
                            }
                            if (accepetName == true)
                            {
                                try
                                {
                                    bool g;
                                    if (radioButton1.Checked == true)
                                    {
                                        g = true;
                                    }
                                    else
                                    {
                                        g = false;
                                    }
                                    string result = emp.UpdateEmployee(this.emp_Id, bunifuMetroTextbox1.Text, bunifuMetroTextbox3.Text, bunifuMetroTextbox4.Text, richTextBox1.Text, g, richTextBox2.Text, img);
                                    MessageBox.Show(result);
                                    refreshAll();
                                    // bunifuThinButton21.Enabled = false;
                                }
                                catch (Exception)
                                {
                                    MessageBox.Show("Error !");
                                }
                            }
                            else
                            {
                                MessageBox.Show("Only letters and '.' are accepted");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Enter Correct Email Address");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Enter A valid Email ASddress");
                    }
                }
            }
            catch (FormatException)
            {
                MessageBox.Show("Enter A valid Phone Number");
            }
        }