Ejemplo n.º 1
0
        public ClientOrg[] ClientOrgSearch()
        {
            IList <ClientOrg> query = new List <ClientOrg>();

            if (string.IsNullOrEmpty(Search))
            {
                query = DataSession.Query <ClientOrg>().ToList();
            }
            else
            {
                if (GetSingle <ClientOrg>("co", query))
                {
                    return(query.ToArray());
                }
                else if (GetMultiple <ClientOrg>("client", query, id => x => x.Client.ClientID == id))
                {
                    return(query.ToArray());
                }
                else if (GetMultiple <ClientOrg>("org", query, id => x => x.Org.OrgID == id))
                {
                    return(query.ToArray());
                }
                else
                {
                    query = DataSession.Query <ClientOrg>().Where(x =>
                                                                  x.ClientOrgID.ToString() == Search ||
                                                                  x.Client.UserName.ToLower().Contains(Search.ToLower()) ||
                                                                  x.Client.LName.ToLower().Contains(Search.ToLower()) ||
                                                                  x.Client.FName.ToLower().Contains(Search.ToLower()) ||
                                                                  (x.Client.LName + ", " + x.Client.FName).ToLower().Contains(Search.ToLower()) ||
                                                                  (x.Client.FName + " " + x.Client.LName).ToLower().Contains(Search.ToLower()) ||
                                                                  x.Email.ToLower().Contains(Search.ToLower()) ||
                                                                  x.Org.OrgName.ToLower().Contains(Search.ToLower())).ToList();
                }
            }

            return(query.ToArray());
        }
Ejemplo n.º 2
0
        public IEnumerable <Client> ClientSearch()
        {
            IList <Client> query;

            if (string.IsNullOrEmpty(Search))
            {
                query = DataSession.Query <Client>().ToList();
            }
            else
            {
                query = new List <Client>();
                if (GetSingle <Client>("client", query))
                {
                    return(query.ToArray());
                }
                else
                {
                    query = DataSession.Query <Client>().Where(x =>
                                                               x.ClientID.ToString() == Search ||
                                                               x.UserName.ToLower().Contains(Search.ToLower()) ||
                                                               x.LName.ToLower().Contains(Search.ToLower()) ||
                                                               x.FName.ToLower().Contains(Search.ToLower()) ||
                                                               (x.LName + ", " + x.FName).ToLower().Contains(Search.ToLower()) ||
                                                               (x.FName + " " + x.LName).ToLower().Contains(Search.ToLower())).ToList();
                }
            }

            return(query.ToArray());
        }
Ejemplo n.º 3
0
        public Account[] AccountSearch()
        {
            IList <Account> query = new List <Account>();

            if (string.IsNullOrEmpty(Search))
            {
                query = DataSession.Query <Account>().ToList();
            }
            else
            {
                if (GetSingle("acct", query))
                {
                    return(query.ToArray());
                }
                else if (GetMultiple("org", query, id => x => x.Org.OrgID == id))
                {
                    return(query.ToArray());
                }
                else
                {
                    query = DataSession.Query <Account>().Where(x =>
                                                                x.AccountID.ToString() == Search ||
                                                                x.Name.ToLower().Contains(Search.ToLower()) ||
                                                                x.Number.ToLower().Contains(Search.ToLower()) ||
                                                                x.ShortCode.ToLower().Contains(Search.ToLower()) ||
                                                                x.AccountType.AccountTypeName.ToLower().Contains(Search.ToLower())).ToArray();
                }
            }

            return(query.ToArray());
        }
Ejemplo n.º 4
0
        public Org[] OrgSearch()
        {
            IList <Org> query = new List <Org>();

            if (string.IsNullOrEmpty(Search))
            {
                query = DataSession.Query <Org>().ToList();
            }
            else
            {
                if (GetSingle("org", query))
                {
                    return(query.ToArray());
                }
                else
                {
                    query = DataSession.Query <Org>().Where(x =>
                                                            x.OrgID.ToString() == Search ||
                                                            x.OrgName.ToLower().Contains(Search.ToLower()) ||
                                                            x.OrgType.OrgTypeName.ToLower().Contains(Search.ToLower())).ToArray();
                }
            }

            return(query.ToArray());
        }
Ejemplo n.º 5
0
        public ClientManager[] ClientManagerSearch()
        {
            var query = new List <ClientManager>();

            if (string.IsNullOrEmpty(Search))
            {
                query = DataSession.Query <ClientManager>().ToList();
            }
            else
            {
                if (GetSingle("cm", query))
                {
                    return(query.ToArray());
                }
                else if (GetMultiple("co", query, id => x => x.ClientOrg.ClientOrgID == id))
                {
                    return(query.ToArray());
                }
                else if (GetMultiple("mo", query, id => x => x.ManagerOrg.ClientOrgID == id))
                {
                    return(query.ToArray());
                }
                else
                {
                    query = DataSession.Query <ClientManager>().Where(x =>
                                                                      x.ClientManagerID.ToString() == Search ||
                                                                      x.ClientOrg.Client.UserName.ToLower().Contains(Search.ToLower()) ||
                                                                      x.ClientOrg.Client.LName.ToLower().Contains(Search.ToLower()) ||
                                                                      x.ClientOrg.Client.FName.ToLower().Contains(Search.ToLower()) ||
                                                                      (x.ClientOrg.Client.LName + ", " + x.ClientOrg.Client.FName).ToLower().Contains(Search.ToLower()) ||
                                                                      (x.ClientOrg.Client.FName + " " + x.ClientOrg.Client.LName).ToLower().Contains(Search.ToLower()) ||
                                                                      x.ClientOrg.Email.ToLower().Contains(Search.ToLower()) ||
                                                                      x.ManagerOrg.Client.UserName.ToLower().Contains(Search.ToLower()) ||
                                                                      x.ManagerOrg.Client.LName.ToLower().Contains(Search.ToLower()) ||
                                                                      x.ManagerOrg.Client.FName.ToLower().Contains(Search.ToLower()) ||
                                                                      (x.ManagerOrg.Client.LName + ", " + x.ManagerOrg.Client.FName).ToLower().Contains(Search.ToLower()) ||
                                                                      (x.ManagerOrg.Client.FName + " " + x.ManagerOrg.Client.LName).ToLower().Contains(Search.ToLower()) ||
                                                                      x.ManagerOrg.Email.ToLower().Contains(Search.ToLower())).ToList();
                }
            }

            return(query.ToArray());
        }
Ejemplo n.º 6
0
        public ClientAccount[] ClientAccountSearch()
        {
            IList <ClientAccount> query = new List <ClientAccount>();

            if (string.IsNullOrEmpty(Search))
            {
                query = DataSession.Query <ClientAccount>().ToList();
            }
            else
            {
                if (GetSingle("ca", query))
                {
                    return(query.ToArray());
                }
                else if (GetMultiple("co", query, id => x => x.ClientOrg.ClientOrgID == id))
                {
                    return(query.ToArray());
                }
                else if (GetMultiple("acct", query, id => x => x.Account.AccountID == id))
                {
                    return(query.ToArray());
                }
                else
                {
                    query = DataSession.Query <ClientAccount>().Where(x =>
                                                                      x.ClientAccountID.ToString() == Search ||
                                                                      x.ClientOrg.Client.UserName.ToLower().Contains(Search.ToLower()) ||
                                                                      x.ClientOrg.Client.LName.ToLower().Contains(Search.ToLower()) ||
                                                                      x.ClientOrg.Client.FName.ToLower().Contains(Search.ToLower()) ||
                                                                      (x.ClientOrg.Client.LName + ", " + x.ClientOrg.Client.FName).ToLower().Contains(Search.ToLower()) ||
                                                                      (x.ClientOrg.Client.FName + " " + x.ClientOrg.Client.LName).ToLower().Contains(Search.ToLower()) ||
                                                                      x.ClientOrg.Email.ToLower().Contains(Search.ToLower()) ||
                                                                      x.Account.Org.OrgName.ToLower().Contains(Search.ToLower()) ||
                                                                      x.Account.Name.ToLower().Contains(Search.ToLower()) ||
                                                                      x.Account.Number.ToLower().Contains(Search.ToLower()) ||
                                                                      x.Account.ShortCode.ToLower().Contains(Search.ToLower())).ToList();
                }
            }

            return(query.ToArray());
        }