Beispiel #1
0
 private void btnAddServiceFormSaveChanges_Click(object sender, EventArgs e)
 {
     service.ServiceName        = serviceNameTextBox.Text;
     service.ServiceDescription = serviceDescriptionTextBox.Text;
     service.ServiceCostPerHour = Convert.ToDecimal(serviceCostPerHourTextBox.Text);
     addServiceDb.Services.Add(service);
     addServiceDb.SaveChanges();
     servicesListForm = new ServicesListForm();
     servicesListForm.Show();
     this.Close();
 }
Beispiel #2
0
        private void btnSaveInvoice_Click(object sender, EventArgs e)
        {
            if (invoiceIDTextBox.Text == "")
            {
                MessageBox.Show("No invoice selected. Please select an invoice to edit.", "Edit Error");
            }
            else
            {
                int currentInv = Convert.ToInt32(invoiceIDTextBox.Text);
                var editedInv  = (from invoice in invoicesDb.Invoices
                                  where invoice.InvoiceID == currentInv
                                  select invoice).Single();

                editedInv.InvoiceDate = invoiceDateDateTimePicker.Value;
                editedInv.CustomerID  = Convert.ToInt32(customerIDComboBox.SelectedValue);
                invoicesDb.SaveChanges();
                EnableInvoiceEdit();
                PopulateCustomInvoiceDataGridViewColumns();
            }
        }
Beispiel #3
0
        private void btnAddInvoiceFormSaveChanges_Click(object sender, EventArgs e)
        {
            invoice.InvoiceDate = invoiceDateDateTimePicker.Value;
            invoice.CustomerID  = Convert.ToInt32(customerIDComboBox.SelectedValue);
            addInvDb.Invoices.Add(invoice);
            addInvDb.SaveChanges();
            this.Close();
            MessageBox.Show("Invoice added successfully.", "Invoice Added");
            InvoiceListForm invoiceListForm = new InvoiceListForm();

            invoiceListForm.Show();
        }
 private void btnAddCustomerFormSaveChanges_Click(object sender, EventArgs e)
 {
     customer.CustomerFName    = customerFNameTextBox.Text;
     customer.CustomerLName    = customerLNameTextBox.Text;
     customer.CustomerPhoneNum = customerPhoneNumTextBox.Text;
     customer.CustomerAddress  = customerAddressTextBox.Text;
     customer.CustomerCity     = customerCityTextBox.Text;
     customer.CustomerState    = customerStateComboBox.SelectedValue.ToString();
     customer.CustomerZipCode  = customerZipCodeTextBox.Text;
     Db.Customers.Add(customer);
     Db.SaveChanges();
     CustomersListForm = new CustomersListForm();
     CustomersListForm.Show();
     this.Close();
 }
Beispiel #5
0
 private void btnAddEmployeeFormSaveChanges_Click(object sender, EventArgs e)
 {
     employee.EmployeeFName      = employeeFNameTextBox.Text;
     employee.EmployeeLName      = employeeLNameTextBox.Text;
     employee.EmployeePhoneNum   = employeePhoneNumTextBox.Text;
     employee.EmployeeAddress    = employeeAddressTextBox.Text;
     employee.EmployeeCity       = employeeCityTextBox.Text;
     employee.EmployeeState      = employeeStateComboBox.SelectedValue.ToString();
     employee.EmployeeZipCode    = employeeZipCodeTextBox.Text;
     employee.EmployeeCurrentPay = Convert.ToDecimal(employeeCurrentPayTextBox.Text);
     AddEmpDb.Employees.Add(employee);
     AddEmpDb.SaveChanges();
     EmployeesListForm = new EmployeesListForm();
     EmployeesListForm.Show();
     this.Close();
 }
Beispiel #6
0
        private void btnAddVendorFormSaveChanges_Click(object sender, EventArgs e)
        {
            vendor.VendorName     = vendorNameTextBox.Text;
            vendor.VendorPhoneNum = vendorPhoneNumTextBox.Text;
            vendor.VendorAddress  = vendorAddressTextBox.Text;
            vendor.VendorCity     = vendorCityTextBox.Text;
            vendor.VendorState    = vendorStateComboBox.SelectedValue.ToString();
            vendor.VendorZipCode  = vendorZipCodeTextBox.Text;
            AddVendorDb.Vendors.Add(vendor);
            AddVendorDb.SaveChanges();

            VendorsListForm vendorsListForm = new VendorsListForm();

            vendorsListForm.Show();
            this.Close();
        }
 private void btnVendorFormSaveChanges_Click(object sender, EventArgs e)
 {
     //TODO: Catch concurrency error
     VendorDb.SaveChanges();
     EnableOrDisableEdit();
 }
Beispiel #8
0
 private void btnServicesFormSaveChanges_Click(object sender, EventArgs e)
 {
     //TODO: Catch Concurrency error
     ServiceDb.SaveChanges();
     EnableOrDisableEdit();
 }
 private void btnEmployeeFormSaveChanges_Click(object sender, EventArgs e)
 {
     //TODO: catch concurrency error
     EmpDb.SaveChanges();
     EnableOrDisableEdit();
 }