public ReservationForm(Customer cust, string flightCode, TripInfo ti)
 {
     reservationConn = new OleDbConnection(connString);
     customer = cust;
     this.ti = ti;
     this.flightCode = flightCode;
     drawPanel();
     drawPlan();
     InitializeComponent();
 }
 public Reservation(Customer customer, string code, string from, string to, string seat,
                    DateTime depart, DateTime arrive, double price)
 {
     this.customer = customer;
     this.code = code;
     this.from = from;
     this.to = to;
     this.seat = seat;
     this.depart = depart;
     this.arrive = arrive;
     this.price = price;
 }
        public UserProfile(Customer customer)
        {
            profileConn = new OleDbConnection(connString);
            this.customer = customer;
            InitializeComponent();

            id = customer.getLoginID();
            txtPassword.Text = customer.getPassword();
            txtName.Text = customer.getCustomerName();
            txtIC.Text = customer.getIC();
            txtContactNum.Text = customer.getContactNum();
            customerType = customer.getCustomerType();
        }
        private void updateButton_Click(object sender, EventArgs e)
        {
            cmd.Connection = profileConn;
            cmd.CommandText =
                "UPDATE CustomerDetail SET [Password] = '" + txtPassword.Text +
                "' ,[Name] = '" + txtName.Text +
                "' ,[IC] = '" + txtIC.Text +
                "' ,[contactNum] = '" + txtContactNum.Text +
                "' WHERE [LoginID] = '" + id + "'";
            try
            {
                profileConn.Open();

                cmd.Parameters.AddWithValue("", txtPassword.Text);
                cmd.Parameters.AddWithValue("", txtName.Text);
                cmd.Parameters.AddWithValue("", txtIC.Text);
                cmd.Parameters.AddWithValue("", txtContactNum.Text);

                /* Update customer class */
                Customer c = new Customer(id, txtPassword.Text, customerType,
                                        txtName.Text, txtIC.Text, txtContactNum.Text);

                int temp = cmd.ExecuteNonQuery();

                if (temp > 0)
                {
                    MessageBox.Show("Update Successfully!");
                }
                else
                {
                    MessageBox.Show("Updata failed!");
                }

                profileConn.Close();

                this.Hide();
                MainMenu m = new MainMenu(c);
                m.ShowDialog();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                profileConn.Close();
            }
        }
Ejemplo n.º 5
0
        private void loginButton_Click_1(object sender, EventArgs e)
        {
            try
            {
                loginConn.Open();
                string selectString =
                    "Select * from CustomerDetail where LoginID = '" + txtID.Text +
                                                    "' and Password = '******'";

                OleDbDataAdapter da = new OleDbDataAdapter(selectString, loginConn);
                OleDbCommandBuilder cBuilder = new OleDbCommandBuilder(da);

                DataTable dataTable = new DataTable();
                da.Fill(dataTable);

                if (dataTable.Rows.Count > 0)
                {
                    MessageBox.Show("Welcome! " + txtID.Text);

                    string loginID = dataTable.Rows[0][0].ToString();
                    string password = dataTable.Rows[0][1].ToString();
                    string name = dataTable.Rows[0][2].ToString();
                    string ic = dataTable.Rows[0][3].ToString();
                    string contactNum = dataTable.Rows[0][4].ToString();
                    string customerType = dataTable.Rows[0][5].ToString();

                    Customer customer = new Customer(loginID, password, customerType, name, ic, contactNum);

                    this.Hide();
                    MainMenu mainMenu = new MainMenu(customer);
                    mainMenu.ShowDialog();
                }
                else
                {
                    MessageBox.Show("ID or Password is incorrect! Please try again");

                }
                loginConn.Close();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                loginConn.Close();
            }
        }
 private void formCustClass(string name, string id, string contact, string memberShip)
 {
     if (memberShip.Equals("Member"))
         theCust = new Member(name, id, contact, memberShip);
     else
         theCust = new Regular(name, id, contact, memberShip);
 }
 public Reservation(Customer customer, TripInfo tripInfo, string seat)
 {
     this.customer = customer;
     this.tripInfo = tripInfo;
     this.seat = seat;
 }
 public SelectTrip(Customer customer)
 {
     this.customer = customer;
     reservationConn = new OleDbConnection(connString);
     InitializeComponent();
 }
 public void setCust(Customer cust)
 {
     customer = cust;
 }
 public Reservation(Trips t, Customer cust, string type)
 {
     setTrip(t);
     setCust(cust);
     setTripType(type);
 }
Ejemplo n.º 11
0
 public MainMenu(Customer cust)
 {
     customer = cust;
     InitializeComponent();
     lblCustomerID.Text = "Welcome! " + customer.getLoginID();
 }