Example #1
0
        private void cancelButton_Click(object sender, EventArgs e)
        {
            this.Hide();
            MainScreen mainScr = new MainScreen(currentUser);

            mainScr.Show();
        }
Example #2
0
        private void signInButton_Click(object sender, EventArgs e)
        {
            DataProcedures data     = new DataProcedures();
            User           userInfo = new User(usernameTextbox.Text, passwordTextbox.Text);

            userInfo.userId = data.verifyUser(userInfo);

            if (userInfo.userId != -1)
            {
                DateTime dateTime = DateTime.Now;
                data.logUserActivity("Username: '******'. UserID: " + userInfo.userId + ". Logged in at " + dateTime);
                this.Hide();
                MainScreen mainScr = new MainScreen(userInfo);
                mainScr.Show();
                //Show upcoming appts when user signs in.
                List <Appointment> upcomingAppts = data.checkUserReminders(userInfo.userId);
                if (upcomingAppts.Count > 0)
                {
                    foreach (var appt in upcomingAppts)
                    {
                        Reminder apptReminder = new Reminder(appt);
                        apptReminder.Show();
                    }
                }
            }
            else
            {
                errorLabel.Show();
            }
        }
Example #3
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            bool textBoxesNotEmpty;

            if (string.IsNullOrWhiteSpace(titleTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(descriptionTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(locationTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(contactTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(typeTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(urlTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else
            {
                textBoxesNotEmpty = true;
            }

            if (textBoxesNotEmpty && validAppt)
            {
                int         custSelected = Convert.ToInt32(customerDataGridView.Rows[customerDataGridView.CurrentCell.RowIndex].Cells[0].Value);
                Appointment appt         = new Appointment();
                appt.customerId  = custSelected;
                appt.userId      = currentUser.userId;
                appt.title       = titleTextBox.Text;
                appt.description = descriptionTextBox.Text;
                appt.location    = locationTextBox.Text;
                appt.contact     = contactTextBox.Text;
                appt.type        = typeTextBox.Text;
                appt.url         = urlTextBox.Text;
                appt.start       = startDateTimePicker.Value.ToUniversalTime();//all times are stored and compared as UTC, and displayed to the user in their local time.
                appt.end         = endDateTimePicker.Value.ToUniversalTime();

                DataProcedures data = new DataProcedures();

                if (data.addAppointment(appt) != -1)
                {
                    MainScreen mainScreen = new MainScreen(currentUser);
                    this.Hide();
                    mainScreen.Show();
                }
            }
            else
            {
                fillFieldsLabel.Visible = true;
            }
        }
Example #4
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            bool textBoxesNotEmpty;

            if (string.IsNullOrWhiteSpace(titleTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(descriptionTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(locationTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(contactTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(typeTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(urlTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else
            {
                textBoxesNotEmpty = true;
            }

            if (textBoxesNotEmpty)
            {
                if (validAppt)
                {
                    int         custSelected = Convert.ToInt32(customerDataGridView.Rows[customerDataGridView.CurrentCell.RowIndex].Cells[0].Value);
                    Appointment appt         = new Appointment();
                    appt.appointmentId = apptId;
                    appt.customerId    = custSelected;
                    appt.userId        = currentUser.userId;
                    appt.title         = titleTextBox.Text;
                    appt.description   = descriptionTextBox.Text;
                    appt.location      = locationTextBox.Text;
                    appt.contact       = contactTextBox.Text;
                    appt.type          = typeTextBox.Text;
                    appt.url           = urlTextBox.Text;
                    appt.start         = startDateTimePicker.Value.ToUniversalTime();
                    appt.end           = endDateTimePicker.Value.ToUniversalTime();

                    DataProcedures data = new DataProcedures();

                    if (data.updateAppointment(appt))
                    {
                        MainScreen mainScreen = new MainScreen(currentUser);
                        this.Hide();
                        mainScreen.Show();
                    }
                }
                else
                {
                    dateTimeErrorlabel.Text    = "Please enter valid times.";
                    dateTimeErrorlabel.Left    = 72;
                    dateTimeErrorlabel.Visible = true;
                }
            }
            else
            {
                fillFieldsLabel.Visible = true;
            }
        }
Example #5
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            bool textBoxesNotEmpty;

            if (string.IsNullOrWhiteSpace(nameTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(phNumberTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(addressTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(address2TextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(cityTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(postalCodeTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(countryTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else
            {
                textBoxesNotEmpty = true;
            }

            if (textBoxesNotEmpty)
            {
                DataProcedures dbProcedure = new DataProcedures();

                CustomerInformation custInfo = new CustomerInformation();
                custInfo.customerID   = custId;
                custInfo.customerName = nameTextBox.Text;
                custInfo.phone        = phNumberTextBox.Text;
                custInfo.address      = addressTextBox.Text;
                custInfo.address2     = address2TextBox.Text;
                custInfo.city         = cityTextBox.Text;
                custInfo.postalCode   = postalCodeTextBox.Text;
                custInfo.country      = countryTextBox.Text;

                bool insertCustomerInfo = dbProcedure.saveCustomerInformaion(custInfo);

                if (insertCustomerInfo)
                {
                    MainScreen mainScreen = new MainScreen(currentUser);
                    this.Hide();
                    mainScreen.Show();
                }
            }
            else
            {
                fillFieldsLabel.Visible = true;
            }
        }
        private void saveButton_Click(object sender, EventArgs e)
        {
            bool textBoxesNotEmpty;

            if (string.IsNullOrWhiteSpace(nameTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(phNumberTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(addressTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(address2TextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(cityTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(postalCodeTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else if (string.IsNullOrWhiteSpace(countryTextBox.Text))
            {
                textBoxesNotEmpty = false;
            }
            else
            {
                textBoxesNotEmpty = true;
            }

            if (textBoxesNotEmpty)
            {
                DataProcedures data = new DataProcedures();

                Customer customer = new Customer();
                Address  address  = new Address();
                City     city     = new City();
                Country  country  = new Country();

                customer.customerName = nameTextBox.Text;

                customer.createdBy = currentUser.username;
                address.createdBy  = currentUser.username;
                city.createdBy     = currentUser.username;
                country.createdBy  = currentUser.username;

                address.address    = addressTextBox.Text;
                address.address2   = address2TextBox.Text;
                address.postalCode = postalCodeTextBox.Text;
                address.phone      = phNumberTextBox.Text;

                city.city = cityTextBox.Text;

                country.country = countryTextBox.Text;

                city.countryId     = data.addCountry(country);
                address.cityId     = data.addCity(city);
                customer.addressId = data.addAddress(address);

                if (data.addCustomer(customer))
                {
                    MainScreen mainScreen = new MainScreen(currentUser);
                    this.Hide();
                    mainScreen.Show();
                }
            }
            else
            {
                fillFieldsLabel.Visible = true;
            }
        }