Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using Oracle.ManagedDataAccess.Client;
- using PaymentClasses;
- using Databases;
- namespace Lab_6
- {
- public partial class frmCustomer : Form
- {
- frmPayment payForm;
- public static Payment payment;
- CustomerTable table;
- public frmCustomer()
- {
- InitializeComponent();
- payForm = new frmPayment();
- payment = new Payment();
- txtFName.Enabled = false;
- txtAdd.Enabled = false;
- table = new CustomerTable();
- //cmbManufacturer.DataSource = manufacturers;
- }
- private void btnPayment_Click(object sender, EventArgs e)
- {
- payment.Customer = new Customer(txtFName.Text, txtLName.Text, txtAdd.Text);
- try
- {
- Customer custt = table.GetCustomer(Convert.ToString(txtLName.Text));
- txtFName.Text = custt.FirstName;
- txtAdd.Text = custt.Address;
- }
- catch (OracleException objException)
- {
- MessageBox.Show("A problem occurred with the database: " + objException.Message + " Please contact the programmer");
- Close();
- }
- catch (Exception objException)
- {
- if (objException.Message == "Sorry, that record id doesn't exist on the database")
- {
- MessageBox.Show(objException.Message);
- }
- else
- {
- MessageBox.Show(objException.Message, objException.GetType().ToString());
- }
- }
- }
- private void btnClear_Click(object sender, EventArgs e)
- {
- DialogResult dialogResult = MessageBox.Show("Do you want to start a new customer and payment?", "New?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
- switch (dialogResult)
- {
- case System.Windows.Forms.DialogResult.Yes:
- //payForm = new frmPayment();
- txtAdd.Text = string.Empty;
- txtFName.Text = string.Empty;
- txtLName.Text = string.Empty;
- break;
- }
- }
- private void btnExit_Click(object sender, EventArgs e)
- {
- Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement