protected void CustomerSelected_Click(object sender, ListViewCommandEventArgs e) { int customerID = int.Parse(e.CommandArgument.ToString()); string EmoployeeUsername = User.Identity.Name; ApplicationUserManager secmgr = new ApplicationUserManager( new UserStore <ApplicationUser>(new ApplicationDbContext())); EmployeeInfo info = secmgr.User_GetEmployee(EmoployeeUsername); EmployeeID.Text = info.EmployeeID.ToString(); MessageUserControl.TryRun(() => { CustomerController sysmgr = new CustomerController(); List <Customer> results = sysmgr.List_CustomersByID(customerID); CustomerInfoGridview.DataSource = results; CustomerInfoGridview.DataBind(); RentalController rntlmgr = new RentalController(); List <Rental> rentals = rntlmgr.Get_RentalsByCusomterSearch(customerID); RentalListListview.DataSource = rentals; RentalListListview.DataBind(); }, "Customer Selected", "Please select a rental by this customer"); CustomerList.DataBind(); CustomerID.Text = customerID.ToString(); //list rentals and display them same as did customers }
//Select customer clicked //CustomerSelected_Click public void CustomerSelected_Click(object sender, ListViewCommandEventArgs e) { int customerID = int.Parse(e.CommandArgument.ToString()); string EmoployeeUsername = User.Identity.Name; ApplicationUserManager secmgr = new ApplicationUserManager( new UserStore <ApplicationUser>(new ApplicationDbContext())); EmployeeInfo info = secmgr.User_GetEmployee(EmoployeeUsername); EmployeeID.Text = info.EmployeeID.ToString(); MessageUserControl.TryRun(() => { CustomerController sysmgr = new CustomerController(); List <Customer> results = sysmgr.List_CustomersByID(customerID); CustomerInfoGridview.DataSource = results; CustomerInfoGridview.DataBind(); }, "Customer Selected", "Selected customer for new rental"); //CustomerList.DataBind(); CustomerID.Text = customerID.ToString(); }