Beispiel #1
0
        private void OKbutton_Click(object sender, EventArgs e)
        {
            ClientRegistr clientregistr = new ClientRegistr(clientList, startMenu);

            if (NameTextBox.TextLength != 0 && SurnameTextBox.TextLength != 0 &&
                FathernameTextBox.TextLength != 0)
            {
                // MessageBox.Show("Такой клиент уже зарегестрирован");
                // this.Close();
                clientregistr.setNameTextBox(NameTextBox);
                clientregistr.setSurnameTextBox(SurnameTextBox);
                clientregistr.setFathernameTextBox(FathernameTextBox);
                clientregistr.Show();
                this.Hide();
            }
            else
            {
                if (NameTextBox.TextLength == 0)
                {
                    NameTextBox.BackColor = Color.IndianRed;
                }
                if (SurnameTextBox.TextLength == 0)
                {
                    SurnameTextBox.BackColor = Color.IndianRed;
                }
                if (FathernameTextBox.TextLength == 0)
                {
                    FathernameTextBox.BackColor = Color.IndianRed;
                }
            }
        }
Beispiel #2
0
        private void OKbutton_Click(object sender, EventArgs e)
        {
            ClientRegistr clientregistr  = new ClientRegistr();
            Client        searchedClient = new Client();

            if (NameTextBox.TextLength != 0 && SurnameTextBox.TextLength != 0 &&
                FathernameTextBox.TextLength != 0 && PassportMaskedTextBox.MaskFull)
            {
                searchedClient = ClientListService.ClientSearchCheck(PassportMaskedTextBox.Text);
                if (searchedClient == null)
                {
                    clientregistr.setNameTextBoxes(NameTextBox.Text, SurnameTextBox.Text, FathernameTextBox.Text, PassportMaskedTextBox.Text);
                    clientregistr.Show();
                }
                else
                {
                    MessageBox.Show("Такой клиент уже зарегестрирован.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.Close();
                }
                this.Hide();
            }
            else
            {
                if (!PassportMaskedTextBox.MaskFull)
                {
                    PassportMaskedTextBox.BackColor = Color.IndianRed;
                }
                if (NameTextBox.TextLength == 0)
                {
                    NameTextBox.BackColor = Color.IndianRed;
                }
                if (SurnameTextBox.TextLength == 0)
                {
                    SurnameTextBox.BackColor = Color.IndianRed;
                }
                if (FathernameTextBox.TextLength == 0)
                {
                    FathernameTextBox.BackColor = Color.IndianRed;
                }
            }
        }