public static ProxyAccount SingleConvertToProxyAccount(Account account)
        {
            ProxyAccount proxy = new ProxyAccount();

            proxy.AccountName          = account.Name;
            proxy.EntityRole           = EnsureValueFromOptionSet(account, "new_agencyrole");
            proxy.ID                   = account.Id;
            proxy.ParentID             = (account.new_opportunity_account != null) ? account.new_opportunity_account.Id.ToString() : Guid.Empty.ToString();
            proxy.IDstring             = proxy.ID.ToString();
            proxy.Country              = EnsureValueFromOptionSet(account, "new_agencycountry");
            proxy.InvolvementInProject = EnsureValueFromOptionSet(account, "new_involvementinproject"); //account.new_InvolvementinProject

            proxy.Address1_Street1       = account.Address1_Line1;                                      //EnsureValueFromOptionSet(account, "address1_line1");
            proxy.Address1_Street2       = account.Address1_Line2;                                      //EnsureValueFromOptionSet(account, "address1_line2");
            proxy.Address1_Street3       = account.Address1_Line3;                                      //EnsureValueFromOptionSet(account, "address1_line3");
            proxy.Address1_City          = account.Address1_City;                                       //EnsureValueFromOptionSet(account, "address1_city");
            proxy.Address1_StateProvince = account.Address1_StateOrProvince;                            //EnsureValueFromOptionSet(account, "address1_stateorprovince");
            proxy.Address1_ZipCode       = account.Address1_PostalCode;                                 //EnsureValueFromOptionSet(account, "address1_postalcode");
            proxy.Address1_CountryRegion = account.Address1_Country;                                    //EnsureValueFromOptionSet(account, "address1_country");

            return(proxy);
        }
        public static List <ProxyAccount> ConvertToProxyAccount(IEnumerable <Account> accounts)
        {
            List <ProxyAccount> results = new List <ProxyAccount>();

            foreach (Account item in accounts)
            {
                /*
                 * if (item.FormattedValues["new_agencyrole"] != "Executing Agency" && item.FormattedValues["new_agencyrole"] != "Implementing Agency")
                 * {
                 *  continue;
                 * }
                 * StringBuilder sb = new StringBuilder();
                 * foreach (var i in item.FormattedValues)
                 * {
                 *  sb.Append(string.Format("Key: {0} Value: {1}{2}", i.Key, i.Value, Environment.NewLine));
                 * }*/

                ProxyAccount acct = SingleConvertToProxyAccount(item);
                results.Add(acct);
            }
            return(results);
        }
        public static ProxyAccount SingleConvertToProxyAccount(Account account)
        {
            ProxyAccount proxy = new ProxyAccount();
            proxy.AccountName = account.Name;
            proxy.EntityRole = EnsureValueFromOptionSet(account, "new_agencyrole");
            proxy.ID = account.Id;
            proxy.ParentID = (account.new_opportunity_account != null) ? account.new_opportunity_account.Id.ToString() : Guid.Empty.ToString();
            proxy.IDstring = proxy.ID.ToString();
            proxy.Country = EnsureValueFromOptionSet(account, "new_agencycountry");
            proxy.InvolvementInProject = EnsureValueFromOptionSet(account, "new_involvementinproject"); //account.new_InvolvementinProject

            proxy.Address1_Street1 = account.Address1_Line1; //EnsureValueFromOptionSet(account, "address1_line1");
            proxy.Address1_Street2 = account.Address1_Line2; //EnsureValueFromOptionSet(account, "address1_line2");
            proxy.Address1_Street3 = account.Address1_Line3; //EnsureValueFromOptionSet(account, "address1_line3");
            proxy.Address1_City = account.Address1_City; //EnsureValueFromOptionSet(account, "address1_city");
            proxy.Address1_StateProvince = account.Address1_StateOrProvince; //EnsureValueFromOptionSet(account, "address1_stateorprovince");
            proxy.Address1_ZipCode = account.Address1_PostalCode; //EnsureValueFromOptionSet(account, "address1_postalcode");
            proxy.Address1_CountryRegion = account.Address1_Country; //EnsureValueFromOptionSet(account, "address1_country");

            return proxy;
        }
 public void UpdateOneAccount(ProxyAccount account)
 {
 }