daily pastebin goal
44%
SHARE
TWEET

Branch Filtering

CryptoJones Mar 17th, 2016 (edited) 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Protected Sub RadGrid1_NeedDataSource1(source As Object, e As GridNeedDataSourceEventArgs) _
  2.         Handles RadGrid1.NeedDataSource
  3.         If (searchInput.Text <> "") Then
  4.  
  5.             If (MyFunctions.userSeeAllBranch()) Then
  6.  
  7.                 Using db As New DbClassDataContext
  8.  
  9.                     Dim Leads = From l In db.LeadsLists Where (l.fullName.Contains(searchInput.Text)) _
  10.                                                         Or (l.business.Contains(searchInput.Text)) _
  11.                                                         Or (l.ContactPhone.Contains(searchInput.Text)) _
  12.                                                         Or (l.Phone.Contains(searchInput.Text)) _
  13.                                                         Or (l.CellPhone.Contains(searchInput.Text))
  14.  
  15.                 RadGrid1.DataSource = Leads ' Am I doing this correctly?
  16.  
  17.                 End Using
  18.             Else
  19.                 Dim userBranch As String = MyFunctions.getUserBranch().ToString()
  20.  
  21.                 Using db As New DbClassDataContext
  22.  
  23.                     Dim Leads = From l In db.LeadsLists Where (l.fullName.Contains(searchInput.Text)) And l.Branch.Equals(userBranch) _
  24.                                                         Or (l.business.Contains(searchInput.Text)) And l.Branch.Equals(userBranch) _
  25.                                                         Or (l.ContactPhone.Contains(searchInput.Text)) And l.Branch.Equals(userBranch) _
  26.                                                         Or (l.Phone.Contains(searchInput.Text)) And l.Branch.Equals(userBranch) _
  27.                                                         Or (l.CellPhone.Contains(searchInput.Text)) And l.Branch.Equals(userBranch)
  28.  
  29.                 RadGrid1.DataSource = Leads ' Am I doing this correctly?
  30.                 End Using
  31.             End If 'if searchInput
  32.         Else
  33.             If (MyFunctions.userSeeAllBranch()) Then
  34.                 Using db As New DbClassDataContext
  35.  
  36.                     Dim Leads = From l In db.LeadsLists
  37.  
  38.                 RadGrid1.DataSource = Leads ' Am I doing this correctly?
  39.                 End Using
  40.             Else
  41.                 Using db As New DbClassDataContext
  42.                     Dim userBranch As String = MyFunctions.getUserBranch().ToString()
  43.  
  44.                     Dim Leads = From l In db.LeadsLists Where l.Branch.Equals(userBranch)
  45.  
  46.                 RadGrid1.DataSource = Leads ' Am I doing this correctly?
  47.                 End Using
  48.             End If
  49.         End If
  50.     End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top