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 }
//Lookup //check if either or both fields are filled in call search methods public void SearchForCustomers(object sender, EventArgs e) { MessageUserControl.ShowInfo(CustomerEmailLookupTextbox.Text + " " + CustomerPhoneLookupTextbox.Text); if (string.IsNullOrEmpty(CustomerEmailLookupTextbox.Text) && string.IsNullOrEmpty(CustomerPhoneLookupTextbox.Text)) { MessageUserControl.ShowInfo("Enter Search Data", "You must enter at least a partial phone number and or email address to search for a customer"); } else { //GetCustomersByPhoneAndEmail(CustomerPhoneLookupTextbox.Text, CustomerEmailLookupTextbox.Text); MessageUserControl.TryRun(() => { CustomerController sysmgr = new CustomerController(); List <Customer> results = sysmgr.List_CustomersByPhoneAndEmail(CustomerEmailLookupTextbox.Text, CustomerPhoneLookupTextbox.Text); if (results.Count() == 0) { MessageUserControl.ShowInfo("No results, check your search criteria"); } CustomerList.DataSource = results; CustomerList.DataBind(); }); } }
private void LoadCustomers() { CustomerController customerController = new CustomerController(); List <CustomerModel> customers = customerController.GetAllCustomers(); CustomerList.DataSource = customers; CustomerList.DataBind(); }
protected void CustomerList_PageIndexChanging(object sender, GridViewPageEventArgs e) { try { CustomerList.PageIndex = e.NewPageIndex; CustomerList.DataBind(); } catch (Exception ex) { lbl_forMsg.Text = ex.Message; } }
void BuildAll() { string sqlstr; sqlstr = "SELECT CustomerID, CompanyName FROM Customers"; CustomerList.DataSource = mydb.BuildDataTable(sqlstr); CustomerList.DataBind(); sqlstr = "SELECT ProductID, ProductName FROM Products"; ProductList.DataSource = mydb.BuildDataTable(sqlstr); ProductList.DataBind(); }
private void LoadList() { WarehouseList.Items.Clear(); CustomerList.Items.Clear(); WarehouseList.DataSource = db.Warehouses.ToList(); WarehouseList.DataTextField = "WarehouseDescription"; WarehouseList.DataValueField = "WarehouseID"; WarehouseList.DataBind(); CustomerList.DataSource = db.Customers.ToList(); CustomerList.DataTextField = "CustomerName"; CustomerList.DataValueField = "CustomerID"; CustomerList.DataBind(); }
protected void RentalSelected_Click(object sender, ListViewCommandEventArgs e) { int rentalID = int.Parse(e.CommandArgument.ToString()); RentalID.Text = rentalID.ToString(); MessageUserControl.TryRun(() => { RentalController rntlmgr = new RentalController(); List <RentalDetail> rentals = rntlmgr.Get_RentalDetailsByRentalID(rentalID); RentalListListview.DataSource = rentals; RentalListListview.DataBind(); }, "Customer Selected", "Please select a rental by this customer"); CustomerList.DataBind(); //list rentals and display them same as did customers }
protected void Page_PreRender(object sender, EventArgs e) { FilterText.Text = "My filter"; CustomerList.DataSource = new List <CustomerDTO>() { new CustomerDTO() { Name = "Customer 1" }, new CustomerDTO() { Name = "Customer 2" } }; CustomerList.DataBind(); }
public void BindCustomerList() { try { CustomerController sysmgr = new CustomerController(); List <Customer> info = sysmgr.Customer_List(); info.Sort((x, y) => x.FullName.CompareTo(y.FullName)); CustomerList.DataSource = info; CustomerList.DataTextField = nameof(Customer.FullName); CustomerList.DataValueField = nameof(Customer.CustomerID); CustomerList.DataBind(); CustomerList.Items.Insert(0, "select ..."); } catch (Exception ex) { errormsgs.Add("File Error: " + GetInnerException(ex).Message); LoadMessageDisplay(errormsgs, "alert alert-warning"); } }
public void SearchListView() { nameKeyword = Session["SearchName"].ToString(); CsFilteredCustomerList nfcustomerlist = new CsFilteredCustomerList(nameKeyword, emailKeyword, CustomerTable); try { ConnectionClass.SearchCustomerByName(nfcustomerlist); CustomerList.DataSource = nfcustomerlist.fCustomerList; CustomerList.DataBind(); } catch { ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('error');</script>"); } finally { } }
private void LoadList() { var w = (from yt in db.UserLogins where yt.UserID.ToString() == User.Identity.Name select new { yt.WorkStationID }).FirstOrDefault(); var wn = db.Warehouses.Where(t => t.WarehouseID == w.WorkStationID).FirstOrDefault(); WarehouseList.Items.Clear(); CustomerList.Items.Clear(); WarehouseList.DataSource = db.Warehouses.ToList(); WarehouseList.DataTextField = "WarehouseDescription"; WarehouseList.DataValueField = "WarehouseID"; WarehouseList.DataBind(); //CustomerList.DataSource = db.Customers.OrderBy(x => x.CustomerName).ToList(); int wID = wn.WarehouseID;//Convert.ToInt32(WarehouseList.SelectedItem.Value); CustomerList.DataSource = db.Customers.Where(a => a.WarehouseID == wID).OrderBy(x => x.CustomerName).ToList(); CustomerList.DataTextField = "CustomerName"; CustomerList.DataValueField = "CustomerID"; CustomerList.DataBind(); }
protected void bindData() { CustomerList.DataSource = CustomerManager.getAllCustomers(); CustomerList.DataBind(); }