private void CustomerList_SelectedIndexChanged(object sender, EventArgs e) { string custname = this.CustomerList.SelectedItem.ToString(); list = new List <Customer>(); list = CustomerCL.GetAll(); foreach (Customer cust in list) { if (custname.Equals(cust.name)) { this.CustIDLabel.Text = cust.customerId.ToString(); this.NameLabel.Text = cust.name.ToString(); this.AddressLabel.Text = cust.address.ToString(); this.MobileLabel.Text = cust.mobile.ToString(); this.CreditAmtLabel.Text = cust.creditAmount.ToString(); lists = new List <Vehicle>(); lists = VehicleCL.GetALL(); foreach (Vehicle veh in lists) { if (cust.customerId.Equals(veh.customerId)) { this.VehicleList.Items.Add(veh.vehicleNumber); } } } } }
private void ExistingCustomer_Load(object sender, EventArgs e) { list = new List <Customer>(); list = CustomerCL.GetAll(); foreach (Customer cust in list) { this.CustomerList.Items.Add(cust.name); } }
private void CustomerList_SelectedIndexChanged(object sender, EventArgs e) { string custname = this.CustomerList.SelectedItem.ToString(); list = new List <Customer>(); list = CustomerCL.GetAll(); foreach (Customer cust in list) { if (custname.Equals(cust.name)) { lists = new List <Vehicle>(); lists = VehicleCL.GetALL(); foreach (Vehicle veh in lists) { if (cust.customerId.Equals(veh.customerId)) { this.VehicleList.Items.Add(veh.vehicleNumber); } } } } }