public DeliveryForm(Form parent, ShippingSystem sm, Package p) { InitializeComponent(); parentForm = parent as DeliverPackageForm; shippingSystem = sm; package = p; recepientNameTextBox.Text = p.Destination.Addressee; streetAddressTextBox.Text = p.Destination.StreetAddress; }
private void acceptButton_Click(object sender, EventArgs e) { idTextBox.Focus(); if (idTextBox.Text == "guest") { GuestForm g = new GuestForm(this, shippingSystem); Hide(); g.Show(); } else { Employee employee = shippingSystem.validateEmployeeLogin(idTextBox.Text, passwordTextBox.Text); if (employee == null) { MessageBox.Show("User ID or password is incorrect or does not exist."); } else { if (employee is AdminEmployee) { AdminForm af = new AdminForm(this, shippingSystem); this.Hide(); af.Show(); } else if (employee is AcceptanceEmployee) { StoreFrontForm sf = new StoreFrontForm(this, shippingSystem); this.Hide(); sf.Show(); } else if (employee is WarehouseEmployee) { WarehouseForm wf = new WarehouseForm(this, shippingSystem); this.Hide(); wf.Show(); } else//Employee is delivery { DeliverPackageForm dp = new DeliverPackageForm(this, shippingSystem); this.Hide(); dp.Show(); } } idTextBox.Clear(); passwordTextBox.Clear(); } }