Example #1
0
        private IQueryable <Person> RunLimitedSearch()
        {
            var matches = new List <Person>();
            var results = CurrentDatabase.FindPerson(FirstName, LastName, null, Email, null);

            foreach (var result in results)
            {
                matches.Add(CurrentDatabase.LoadPersonById(result.PeopleId.GetValueOrDefault()));
            }
            return(matches.AsQueryable());
        }
Example #2
0
        internal void CheckDuplicate()
        {
            var pids = CurrentDatabase.FindPerson(FirstName, LastName, Birthday, null, CellPhone.GetDigits()).Select(pp => pp.PeopleId).ToList();
            var q    = from p in CurrentDatabase.People
                       where pids.Contains(p.PeopleId)
                       select new { p.PeopleId, p.Name, p.PrimaryAddress, p.Age, };
            var sb = new StringBuilder();

            foreach (var p in q)
            {
                if (sb.Length == 0)
                {
                    sb.AppendLine("<ul>\n");
                }

                sb.AppendFormat("<li><a href=\"/Person2/{1}\" target=\"_blank\">{0}</a> ({1}), {2}, age:{3}</li>\n", p.Name, p.PeopleId, p.PrimaryAddress, p.Age);
            }
            if (sb.Length > 0)
            {
                PotentialDuplicate = sb + "</ul>\n";
            }
        }
Example #3
0
        public Transaction ProcessPaymentTransaction(OnlineRegModel m)
        {
            var ti = (m?.Transaction != null)
                ? CreateTransaction(CurrentDatabase, m.Transaction, AmtToPay)
                : CreateTransaction(CurrentDatabase);

            int?pid = null;

            if (m != null)
            {
                m.ParseSettings();

                pid = m.UserPeopleId;
                if (m.TranId == null)
                {
                    m.TranId = ti.Id;
                }
            }

            if (!pid.HasValue)
            {
                var pds = CurrentDatabase.FindPerson(First, Last, null, Email, Phone);
                if (pds.Count() == 1)
                {
                    pid = pds.Single().PeopleId.Value;
                }
            }

            TransactionResponse tinfo;
            var processType = m?.ProcessType ?? PaymentProcessTypes.OnlineRegistration;
            var gw          = CurrentDatabase.Gateway(testing, null, processType);

            if (SavePayInfo)
            {
                tinfo = gw.PayWithVault(pid ?? 0, AmtToPay ?? 0, Description, ti.Id, Type);
            }
            else
            {
                tinfo = Type == PaymentType.Ach
                    ? PayWithCheck(gw, pid, ti)
                    : PayWithCreditCard(gw, pid, ti);
            }

            ti.TransactionId = tinfo.TransactionId;

            ti.Testing = CheckIfIsGatewayTesting(ti.Testing.GetValueOrDefault(), processType);

            if (ti.Testing.GetValueOrDefault() && !ti.TransactionId.Contains("(testing)"))
            {
                ti.TransactionId += "(testing)";
            }

            ti.Approved         = tinfo.Approved;
            transactionApproved = tinfo.Approved;

            if (!ti.Approved.GetValueOrDefault())
            {
                ti.Amtdue += ti.Amt;
                if (m != null && m.OnlineGiving())
                {
                    ti.Amtdue = 0;
                }
            }

            ti.Message         = tinfo.Message;
            ti.AuthCode        = tinfo.AuthCode;
            ti.TransactionDate = Util.Now;

            CurrentDatabase.SubmitChanges();
            return(ti);
        }
Example #4
0
        public override IQueryable <Person> DefineModelList()
        {
            if (ShowLimitedSearch)
            {
                return(RunLimitedSearch());
            }

            //var db = Db;
            var q = Util2.OrgLeadersOnly
                ? CurrentDatabase.OrgLeadersOnlyTag2().People(CurrentDatabase)
                : CurrentDatabase.People.AsQueryable();

            if (UsersOnly)
            {
                q = q.Where(p => p.Users.Any(uu => uu.UserRoles.Any(ur => ur.Role.RoleName == "Access")));
            }

            if (OnlineRegTypeSearch)
            {
                return(from pid in CurrentDatabase.FindPerson(FirstName, LastName, dob.ToDate(), Email, Phone)
                       join p in q on pid.PeopleId equals p.PeopleId
                       select p);
            }

            if (Name.HasValue())
            {
                string first, last;
                Util.NameSplit(Name, out first, out last);

                if (first.HasValue())
                {
                    q = from p in q
                        where (p.LastName.StartsWith(last) || p.MaidenName.StartsWith(last)) &&
                        (p.FirstName.StartsWith(first) || p.NickName.StartsWith(first) || p.MiddleName.StartsWith(first))
                        select p;
                }
                else if (last.AllDigits())
                {
                    q = from p in q
                        where p.PeopleId == last.ToInt()
                        select p;
                }
                else
                {
                    q = CurrentDatabase.Setting("UseAltnameContains")
                        ? from p in q
                        where p.LastName.StartsWith(last) || p.MaidenName.StartsWith(last) || p.AltName.Contains(last)
                        select p
                        : from p in q
                        where p.LastName.StartsWith(last) || p.MaidenName.StartsWith(last)
                        select p;
                }
            }

            if (Address.IsNotNull())
            {
                Address = Address.Trim();
                if (Address.HasValue())
                {
                    q = from p in q
                        where p.Family.AddressLineOne.Contains(Address) ||
                        p.Family.AddressLineTwo.Contains(Address) ||
                        p.Family.CityName.Contains(Address) ||
                        p.Family.ZipCode.Contains(Address)
                        select p;
                }
            }
            if (Communication.IsNotNull())
            {
                Communication = Communication.Trim();
                if (Communication.HasValue())
                {
                    q = from p in q
                        where p.CellPhone.Contains(Communication) || p.EmailAddress.Contains(Communication) ||
                        p.Family.HomePhone.Contains(Communication) ||
                        p.WorkPhone.Contains(Communication)
                        select p;
                }
            }
            if (dob.HasValue())
            {
                DateTime dt;
                if (DateTime.TryParse(dob, out dt))
                {
                    if (Regex.IsMatch(dob, @"\d+/\d+/\d+"))
                    {
                        q = q.Where(p => p.BirthDay == dt.Day && p.BirthMonth == dt.Month && p.BirthYear == dt.Year);
                    }
                    else
                    {
                        q = q.Where(p => p.BirthDay == dt.Day && p.BirthMonth == dt.Month);
                    }
                }
                else
                {
                    int n;
                    if (int.TryParse(dob, out n))
                    {
                        if (n >= 1 && n <= 12)
                        {
                            q = q.Where(p => p.BirthMonth == n);
                        }
                        else
                        {
                            q = q.Where(p => p.BirthYear == n);
                        }
                    }
                }
            }
            return(q);
        }