public void clearAll()
 {
     formBay.Source = birthCertificate.Source = studentImage.Source = null;
     totalKids.Text = "";
     StudentNameText.Clear();
     PlaceOfBirthText.Clear();
     FirstLanguageText.Clear();
     FatherNameText.Clear();
     FatherCNICText.Clear();
     MotherNameText.Clear();
     MotherCNICText.Clear();
     HomeAddressText.Clear();
     PhoneText.Clear();
     EmergencyText.Clear();
     MobileText.Clear();
     FatherOccupationText.Clear();
     FatherDesignation.Clear();
     FatherAdress.Clear();
     MotherOccupationText.Clear();
     MotherDesignation.Clear();
     MotherAddress.Clear();
     GuardianNameText.Clear();
     RelationText.Clear();
     GuardianAddress.Clear();
     PreviousSchoolText.Clear();
     FromToText.Clear();
     ReasonText.Clear();
 }
Beispiel #2
0
 //Validating Phone number with regex
 private void PhoneText_Validating(object sender, CancelEventArgs e)
 {
     if (!Regex.Match(PhoneText.Text, "^[0-9-()/]*$").Success)
     {
         MessageBox.Show("Not a valid phone number!");
         PhoneText.Focus();
     }
     ;
 }
Beispiel #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     NameText.Clear();
     PhoneText.Clear();
     EmailText.Clear();
     INNText.Clear();
     ScoreText.Clear();
     AddressText.Clear();
     Close();
 }
Beispiel #4
0
 private void EditClientForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     NameText.Clear();
     PhoneText.Clear();
     EmailText.Clear();
     INNText.Clear();
     ScoreText.Clear();
     AddressText.Clear();
     bsToShow = null;
 }
Beispiel #5
0
        private void AddCustomerSubmit_Click(object sender, RoutedEventArgs e)
        {
            string[] Data = new string[7];
            Data[0] = IDText.GetLineText(0);
            Data[1] = NameText.GetLineText(0);
            Data[2] = PhoneText.GetLineText(0);
            Data[3] = AddressText.GetLineText(0);
            Data[4] = SexText.GetLineText(0);
            Data[5] = Data[0];
            Data[6] = TypeText.GetLineText(0);

            acc.createCustomer(Data).ShowDialog();

            this.Close();
        }
Beispiel #6
0
        private async void Button_update_user_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (WorkClass.role == 1)
                {
                    person.personid = WorkClass.trener.trenerid;
                }
                else if (WorkClass.role == 0)
                {
                    person.personid = WorkClass.sportsman.sportsmanid;
                }
                else
                {
                    throw new Exception("Не выбрана роль");
                }
                if (!string.IsNullOrEmpty(NameText.Text) && !string.IsNullOrEmpty(SnameText.Text) &&
                    !string.IsNullOrEmpty(PhoneText.Text) && !string.IsNullOrEmpty(AgeText.Text))
                {
                    person.name  = NameText.Text;
                    person.sname = SnameText.Text;
                    person.phone = Convert.ToInt32(PhoneText.Text);
                    person.age   = Convert.ToInt32(AgeText.Text);

                    await UpdateInfoAsync();

                    NameText.Clear();
                    SnameText.Clear();
                    PhoneText.Clear();
                    AgeText.Clear();
                    Name.Text  = String.Empty;
                    Sname.Text = String.Empty;
                    Age.Text   = String.Empty;
                    Phone.Text = String.Empty;

                    await ReadInfoAsync();
                }
                else
                {
                    throw new Exception("Поля не заполнены");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void AddEmployeeSubmit_Click(object sender, RoutedEventArgs e)
        {
            string[] Data = new string[5];
            Data[0] = IDText.GetLineText(0);
            Data[1] = NameText.GetLineText(0);
            Data[2] = PhoneText.GetLineText(0);
            Data[3] = AddressText.GetLineText(0);
            Data[4] = SexText.GetLineText(0);
            string EID       = Data[0];
            string Salary    = SalaryText.GetLineText(0);
            string StartDate = StartDateText.GetLineText(0);
            string ManagerID = ManagerText.GetLineText(0);

            MakePerson   P = new MakePerson(Data, cn);
            MakeEmployee E = new MakeEmployee(EID, Salary, StartDate, ManagerID, cn);

            try
            {
                P.CreatePerson();
            }
            catch (OleDbException ex)
            {
                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
                return;
            }

            try
            {
                E.CreateEmployee();
            }
            catch (OleDbException ex)
            {
                try
                {
                    P.DeletePerson();
                }
                catch (OleDbException ex2) { }

                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
                return;
            }

            this.Close();
        }
        private void AddEmployeeSubmit_Click(object sender, RoutedEventArgs e)
        {
            string[] Data = new string[9];
            Data[0] = IDText.GetLineText(0);
            Data[1] = NameText.GetLineText(0);
            Data[2] = PhoneText.GetLineText(0);
            Data[3] = AddressText.GetLineText(0);
            Data[4] = SexText.GetLineText(0);
            Data[5] = Data[0];
            Data[6] = SalaryText.GetLineText(0);
            Data[7] = StartDateText.GetLineText(0);
            Data[8] = ManagerText.GetLineText(0);

            aec.createEmployee(Data).ShowDialog();

            this.Close();
        }
        private void AddCustomerSubmit_Click(object sender, RoutedEventArgs e)
        {
            string[] Data = new string[5];
            Data[0] = IDText.GetLineText(0);
            Data[1] = NameText.GetLineText(0);
            Data[2] = PhoneText.GetLineText(0);
            Data[3] = AddressText.GetLineText(0);
            Data[4] = SexText.GetLineText(0);
            string EID  = Data[0];
            string Type = TypeText.GetLineText(0);

            MakePerson   P = new MakePerson(Data, cn);
            MakeCustomer E = new MakeCustomer(EID, Type, cn);

            try
            {
                P.CreatePerson();
            }
            catch (OleDbException ex)
            {
                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
                return;
            }

            try
            {
                E.CreateCustomer();
            }
            catch (OleDbException ex)
            {
                try
                {
                    P.DeletePerson();
                }
                catch (OleDbException ex2) { }

                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
                return;
            }

            this.Close();
        }
Beispiel #10
0
 private void Number_reg_TextChanged(object sender, TextChangedEventArgs e)
 {
     try
     {
         if (!(Regex.IsMatch(PhoneText.Text, @"^\d*$")))
         {
             PhoneText.Clear();
             throw new Exception("Error!!! Неправильные символы");
         }
         else if (!(Regex.IsMatch(AgeText.Text, @"^\d*$")))
         {
             AgeText.Clear();
             throw new Exception("Error!!! Неправильные символы");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        void ReleaseDesignerOutlets()
        {
            if (CallButton != null)
            {
                CallButton.Dispose();
                CallButton = null;
            }

            if (DeleteButton != null)
            {
                DeleteButton.Dispose();
                DeleteButton = null;
            }

            if (MessageButton != null)
            {
                MessageButton.Dispose();
                MessageButton = null;
            }

            if (NameText != null)
            {
                NameText.Dispose();
                NameText = null;
            }

            if (PhoneText != null)
            {
                PhoneText.Dispose();
                PhoneText = null;
            }

            if (SaveButton != null)
            {
                SaveButton.Dispose();
                SaveButton = null;
            }
        }
Beispiel #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            password = ConfirmPassword.Text;
            //string encryptedPassword = Encrypt(password);
            int    phoneNumber = PhoneText.Text.Length;
            int    passLength  = PasswordText.Text.Length;
            string gender      = "";

            if (MaleButton.Checked)
            {
                gender = MaleButton.Text;
            }
            if (FemaleButton.Checked)
            {
                gender = FemaleButton.Text;
            }
            //this.Hide();
            //Home ss = new Home();
            // ss.Show();

            //check field empty or not
            if (string.IsNullOrEmpty(NameTextBox.Text) == true)
            {
                MessageBox.Show("Please enter First Name");
                NameTextBox.Focus();
            }
            else if (string.IsNullOrEmpty(LastNameTextBox.Text) == true)
            {
                MessageBox.Show("Please enter Last Name");
                LastNameTextBox.Focus();
            }
            else if (string.IsNullOrEmpty(EmailTextBox.Text) == true)
            {
                MessageBox.Show("Please enter Email");
                EmailTextBox.Focus();
            }
            else if (Regex.IsMatch(EmailTextBox.Text, emailValStr) == false)
            {
                MessageBox.Show("Invalid email!!");
                EmailTextBox.Focus();
            }

            else if (string.IsNullOrEmpty(StudentIDTextBox.Text) == true)
            {
                MessageBox.Show("Please enter your ID");
                StudentIDTextBox.Focus();
            }
            else if (string.IsNullOrEmpty(PhoneText.Text) == true)
            {
                MessageBox.Show("Please enter Phone Number");
                PhoneText.Focus();
            }

            else if (phoneNumber != 11)
            {
                MessageBox.Show("Please enter valid phone number");
                PhoneText.Focus();
            }
            else if (string.IsNullOrEmpty(gender) == true)
            {
                MessageBox.Show("Please select gender");
                ConfirmPassword.Focus();
            }
            else if (string.IsNullOrEmpty(PasswordText.Text) == true)
            {
                MessageBox.Show("Please type Password");
                PasswordText.Focus();
            }
            else if (passLength <= 8)
            {
                MessageBox.Show(Convert.ToString(passLength));
                MessageBox.Show("Your password should contain minimum 8 characters or numbers");
                PasswordText.Focus();
            }
            else if (string.IsNullOrEmpty(ConfirmPassword.Text) == true)
            {
                MessageBox.Show("Please type Password again");
                ConfirmPassword.Focus();
            }
            else if (PasswordText.Text != ConfirmPassword.Text)
            {
                MessageBox.Show("You typed the wrond password");
                PasswordText.Focus();
            }

            else
            {
                // conn.ConnectionString = @"Data Source=LAPTOP-UDPCMQEF;Initial Catalog=LibraryManagementSystem;Integrated Security=True";
                //  conn.Open();


                SqlCommand cmd = new SqlCommand("insert into Person" + "(first_name,last_name,password,email,student_id,gender,contact_no) values (@first_name,@last_name,aes_encrypt(@password, 'key'),@email,@student_id,@gender,@contact_no)", connDB.getConn());
                cmd.Parameters.AddWithValue("@first_name", NameTextBox.Text);
                cmd.Parameters.AddWithValue("@last_name", LastNameTextBox.Text);
                cmd.Parameters.AddWithValue("@email", EmailTextBox.Text);
                cmd.Parameters.AddWithValue("@student_id", StudentIDTextBox.Text);
                cmd.Parameters.AddWithValue("@gender", gender);
                cmd.Parameters.AddWithValue("@contact_no", PhoneText.Text);
                cmd.Parameters.AddWithValue("@password", password);
                cmd.ExecuteNonQuery();
                MessageBox.Show("You are registered now");
            }
        }