/// <summary> /// Bind grid /// </summary> public void Bind() { AccountService accountService = new AccountService(); AccountQuery filters = new AccountQuery(); //check Login id if (UserID.Text.Trim().Length > 0) { MembershipUser user = Membership.GetUser(UserID.Text.Trim()); if (user != null) { filters.AppendEquals(AccountColumn.UserID, user.ProviderUserKey.ToString()); } else { filters.AppendEquals(AccountColumn.UserID, UserID.Text.Trim()); } } //check OrderID if (OrderID.Text.Trim().Length > 0) { int orderID = int.Parse(OrderID.Text.Trim()); OrderService _orderService = new OrderService(); Order entity = _orderService.GetByOrderID(orderID); if (entity != null) { filters.AppendEquals(AccountColumn.AccountID, entity.AccountID.Value.ToString()); } else { filters.AppendEquals(AccountColumn.AccountID, "0"); } } //Filter query filters.Append(AccountColumn.BillingFirstName,"%" + FirstName.Text.Trim() + "%"); filters.Append(AccountColumn.BillingLastName, "%" + LastName.Text.Trim() + "%"); filters.Append(AccountColumn.BillingPostalCode, "%" + ZipCode.Text.Trim() + "%"); filters.Append(AccountColumn.BillingCompanyName, "%" + CompanyName.Text.Trim() + "%"); //get account list TList<Account> accountList = accountService.Find(filters.GetParameters()); if (accountList != null) { if (accountList.Count == 0) { lblSearhError.Text = "No users found."; } } else { lblSearhError.Text = "No users found."; } //Bind account list grid ui_FoundUsers.DataSource = accountList; ui_FoundUsers.DataBind(); }