Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form form = new AddStoreForm();

            form.Show();

            this.Hide();
        }
Esempio n. 2
0
        public AddUserForm(AddStoreForm addStoreForm)
        {
            InitializeComponent();

            AddStoreForm = addStoreForm;
            types.Remove("VIP");
            types.Remove("REGULAR");
            comboBoxType.Visible = true;
            labelType.Visible    = true;
            WireUp();
        }
Esempio n. 3
0
        private void buttonAddStorage_Click(object sender, EventArgs e)
        {
            if (User == null)
            {
                MessageBox.Show("Need to add manager of storage!!!", "Error");
                return;
            }

            sql.addStorage(textBoxName.Text, textBoxAddress.Text, User);
            this.Hide();
            if (AddStoreForm != null)
            {
                AddStoreForm.Show();
                AddStoreForm.WireUp();
            }
            else
            {
                EmployeeForm.Show();
            }
        }
Esempio n. 4
0
 public AddStorageForm(AddStoreForm addStoreForm)
 {
     InitializeComponent();
     AddStoreForm = addStoreForm;
 }
Esempio n. 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            User newUser = null;

            if (!ValidateFields(textBoxUsername.Text, textBoxEmail.Text, textBoxPhoneNumber.Text))
            {
                MessageBox.Show("Wrong data!!! \nPlease try again.", "Wrong data!!!");
            }
            else if (sql.isThereUser(textBoxFirstName.Text, textBoxLastName.Text, textBoxEmail.Text, textBoxAddress.Text, textBoxPhoneNumber.Text))
            {
                newUser = sql.updateUser(textBoxFirstName.Text, textBoxLastName.Text, textBoxEmail.Text, textBoxAddress.Text, textBoxPhoneNumber.Text, textBoxUsername.Text, textBoxPassword.Text, comboBoxType.Text);
            }
            else
            {
                switch (comboBoxType.Text)
                {
                case "ADMINISTRATION":
                    newUser = new Employee(0, textBoxFirstName.Text, textBoxLastName.Text, textBoxPhoneNumber.Text, textBoxAddress.Text, textBoxUsername.Text, textBoxPassword.Text, textBoxEmail.Text, EmployeeType.ADMINISTRATION);
                    break;

                case "VIP":
                    newUser = new Customer(0, textBoxFirstName.Text, textBoxLastName.Text, textBoxPhoneNumber.Text, textBoxAddress.Text, textBoxUsername.Text, textBoxPassword.Text, textBoxEmail.Text, CustomersType.VIP);
                    break;

                case "SALESMAN":
                    newUser = new Employee(0, textBoxFirstName.Text, textBoxLastName.Text, textBoxPhoneNumber.Text, textBoxAddress.Text, textBoxUsername.Text, textBoxPassword.Text, textBoxEmail.Text, EmployeeType.SALESMAN);
                    break;

                case "DIRECTOR":
                    newUser = new Employee(0, textBoxFirstName.Text, textBoxLastName.Text, textBoxPhoneNumber.Text, textBoxAddress.Text, textBoxUsername.Text, textBoxPassword.Text, textBoxEmail.Text, EmployeeType.DIRECTOR);
                    break;

                default:
                    newUser = new Customer(0, textBoxFirstName.Text, textBoxLastName.Text, textBoxPhoneNumber.Text, textBoxAddress.Text, textBoxUsername.Text, textBoxPassword.Text, textBoxEmail.Text, CustomersType.REGULAR);
                    break;
                }
                sql.AddUser(newUser);
            }

            textBoxFirstName.Text   = "";
            textBoxLastName.Text    = "";
            textBoxEmail.Text       = "";
            textBoxAddress.Text     = "";
            textBoxPassword.Text    = "";
            textBoxPhoneNumber.Text = "";
            textBoxUsername.Text    = "";

            this.Hide();

            if (StartingForm != null)
            {
                StartingForm.setUser(newUser);
                StartingForm.Show();
            }
            else if (EmployeeForm != null)
            {
                EmployeeForm.Show();
            }
            else if (AddStoreForm != null)
            {
                AddStoreForm.Show();
                AddStoreForm.WireUp();
            }
            else
            {
                AddStorageForm.Show();
                AddStorageForm.setUser(newUser);
            }
        }