Example #1
0
        private void buttonAddCar_Click(object sender, EventArgs e)
        {
            Car car = new Car(0, textBoxBrand.Text, textBoxModel.Text, textBoxColor.Text, textBoxEngine.Text, textBoxChassis.Text, Double.Parse(textBoxPrice.Text));

            sql.AddCar(car, equipments);
            sql.AddCarToStorage(car, (Storage)comboBoxStorage.SelectedItem);

            textBoxChassis.Text = "";
            textBoxBrand.Text   = "";
            textBoxColor.Text   = "";
            textBoxModel.Text   = "";
            textBoxEngine.Text  = "";
            textBoxPrice.Text   = "";


            textBoxNameOfEquipment.Text     = "";
            richTextBoxInfoOfEquipment.Text = "";

            listBoxEquipment.Items.Clear();

            this.Hide();

            if (EmployeeForm != null)
            {
                EmployeeForm.Show();
            }
        }
Example #2
0
 public CarForm(EmployeeForm employeeForm)
 {
     InitializeComponent();
     EmployeeForm = employeeForm;
     User         = employeeForm.getUser();
     WireUpLists();
 }
Example #3
0
        private void buttonBuy_Click(object sender, EventArgs e)
        {
            int rabate = 0;

            if (ValidateForm())
            {
                MessageBox.Show("uspjesno");
                //dodati u bazu pod.
                //poslati email
            }


            User = CheckUser(User);
            if (User.GetType == 0)
            {
                rabate = 0;
            }
            else if (User.GetType == 1)
            {
                rabate = 10;
            }
            else
            {
                rabate = 20;
            }

            Bill = sql.AddBill(Store, User, DateTime.Now, Car, rabate);
            if (radioButtonDelivery.Checked)
            {
                Order = sql.AddOrder(Bill, TypeOfDelivery.DELIVERY);
            }
            else
            {
                Order = sql.AddOrder(Bill, TypeOfDelivery.STORE);
            }

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

            //sendEmail(User, Car);


            sql.deleteCar(Car);
            this.Hide();

            if (logIn)
            {
                Form form = new EmployeeForm(this);
                form.Show();
            }
            else
            {
                Form form = new StartingForm();
                form.Show();
            }
        }
Example #4
0
        private void buttonAddStore_Click(object sender, EventArgs e)
        {
            sql.AddStore(textBoxName.Text, textBoxAddress.Text, employees, storages);

            Form form2 = new EmployeeForm();

            form2.Show();
            this.Hide();
        }
Example #5
0
        public AddUserForm(EmployeeForm employeeForm)
        {
            InitializeComponent();

            EmployeeForm = employeeForm;

            comboBoxType.Visible = true;
            labelType.Visible    = true;
            WireUp();
        }
Example #6
0
        public StartingForm(EmployeeForm employeeForm)
        {
            InitializeComponent();
            stores = sql.getAllStores();
            User   = employeeForm.getUser();

            linkLabelLogIn.Enabled    = false;
            linkLabelRegister.Enabled = false;

            comboBoxStore.DataSource    = stores;
            comboBoxStore.DisplayMember = "FullStoreName";
        }
Example #7
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();
            }
        }
Example #8
0
        private void buttonNext_Click(object sender, EventArgs e)
        {
            User = sql.getUserByUsernameAndPassword(textBoxUsername.Text, textBoxPassword.Text);

            int userType = sql.getUserType(User);

            User.GetType = userType;

            if (userType == 0 || userType == 1)
            {
                this.Close();
                StartingForm.setUser(User);

                StartingForm.Show();
            }
            else if (userType == 2 || userType == 3 || userType == 4)
            {
                Form form = new EmployeeForm(this);

                form.Show();

                this.Hide();
            }
        }
Example #9
0
 public AddStorageForm(EmployeeForm employeeForm)
 {
     InitializeComponent();
     EmployeeForm = employeeForm;
 }
Example #10
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);
            }
        }