Exemple #1
0
 /// <remarks/>
 public void getAccountsAsync(getAccountsRequest getAccountsRequest) {
     this.getAccountsAsync(getAccountsRequest, null);
 }
Exemple #2
0
 /// <remarks/>
 public void getAccountsAsync(getAccountsRequest getAccountsRequest, object userState) {
     if ((this.getAccountsOperationCompleted == null)) {
         this.getAccountsOperationCompleted = new System.Threading.SendOrPostCallback(this.OngetAccountsOperationCompleted);
     }
     this.InvokeAsync("getAccounts", new object[] {
                 getAccountsRequest}, this.getAccountsOperationCompleted, userState);
 }
Exemple #3
0
        /// <summary>
        /// Search will return all the list of donors and save it on cache
        /// it has been implemented to make the less possible calls to the Wip service 
        /// </summary>
        /// <returns> The cache result(getAccountsResponse) </returns>
        public List<account> Search(SearchCondition condition)
        {
            var port = Models.Util.Port();
            getAccountsRequest acreq = new getAccountsRequest();

            StringBuilder strAction = new StringBuilder();
            strAction.Append(Util.Actions.SearchFor.ToString());

            if (condition.Email.Length > 0)
            {
                acreq.emailAddress = condition.Email;
                strAction.Append("Email:" + condition.Email);
            }
            if (condition.Zip.Length > 0)
            {
                acreq.zipCode = condition.Zip;
                strAction.Append("Zip:" + condition.Zip);
            }
            if (condition.Organization.Length > 0)
            {
                acreq.organization = condition.Organization;
                strAction.Append("Organization:" + condition.Organization);
            }
            if (condition.AccountNumber.Length > 0)
            {
                acreq.accountIdRangeStart = Convert.ToInt64(condition.AccountNumber);
                acreq.accountIdRangeEnd = Convert.ToInt64(condition.AccountNumber);
                strAction.Append("AccountNumber:" + condition.AccountNumber);
            }

            if (condition.Name.Length > 0)
            {
                strAction.Append("Name:" + condition.Name);
            }

            Models.Util.SaveAction(strAction.ToString());

            if (condition.Name.Length == 0)
            {
                return port.getAccounts(acreq).accounts.ToList();
            }
            else if (condition.Name.Contains(" "))
            {
                var names = condition.Name.Split(' ');
                acreq.firstName = names[0];
                acreq.lastName = names[1];
                return port.getAccounts(acreq).accounts.ToList();
            }
            else
            {
                acreq.firstName = condition.Name;
                var first = port.getAccounts(acreq).accounts;

                acreq.firstName = null;
                acreq.lastName = condition.Name;
                var last = port.getAccounts(acreq).accounts.ToList();

                foreach (account a in first)
                {
                    var have = from acc in last where acc.accountId == a.accountId select acc;

                    if (have.Count() == 0)
                    {
                        last.Add(a);
                    }
                }

                return last;
            }
        }