Example #1
0
        public string GetFormValues()
        {
            var formValues = new FormValuesBuilder();

            if (!string.IsNullOrEmpty(this.Name))
            {
                formValues.Add("name", this.Name.Length > 50 ? this.Name.Substring(0, 50) : this.Name);
            }
            formValues.Add("campus_id", this.Campus.CCBID.ToString())
            .Add("main_leader_id", this.MainLeader.ID)
            .Add("description", this.Description);

            if (this.GroupType.ID.HasValue)
            {
                formValues.Add("group_type_id", this.GroupType.ID);
            }

            if (this.Department.ID.HasValue)
            {
                formValues.Add("department_id", this.Department.ID);
            }

            if (this.Area.ID.HasValue)
            {
                formValues.Add("area_id", this.Area.ID);
            }

            if (!string.IsNullOrEmpty(this.GroupCapacity))
            {
                formValues.Add("group_capacity", this.GroupCapacity);
            }

            return(formValues.ToString());
        }
Example #2
0
        public int Login(string username, string password)
        {
            int returnID = 0;

            var formValues = new FormValuesBuilder();

            if (!string.IsNullOrEmpty(username))
            {
                formValues.Add("login", username);
            }

            if (!string.IsNullOrEmpty(password))
            {
                formValues.Add("password", password);
            }

            var result = this.Execute("individual_id_from_login_password", formValues.ToString());

            if (result.Items.Count > 0)
            {
                var id = result.Items[0].ID;
                if (id != null)
                {
                    returnID = id.Value;
                }
            }

            return(returnID);
        }
Example #3
0
        public string GetFormValues()
        {
            var formValues = new FormValuesBuilder();

            if (!string.IsNullOrEmpty(this.Name))
            {
                formValues.Add("name", this.Name.Length > 50 ? this.Name.Substring(0, 50) : this.Name);
            }
            formValues.Add("group_id", this.Group.CCBID.ToString())
            .Add("start_date", this.StartDateTime.HasValue ? this.StartDateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
            .Add("end_date", this.EndDateTime.HasValue ? this.EndDateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
            .Add("description", this.Description)
            .Add("leader_notes", this.LeaderNotes)
            .Add("setup_notes", this.Setup.Notes);

            if (this.Organizer.CCBID.HasValue)
            {
                formValues.Add("organizer_id", this.Organizer.CCBID.ToString());
            }

            if (!string.IsNullOrEmpty(this.Phone.Value))
            {
                formValues.Add("contact_phone", this.Phone.Value);
            }

            if (!string.IsNullOrEmpty(this.Location.Name))
            {
                formValues.Add("location_name", this.Location.Name);
            }

            if (!string.IsNullOrEmpty(this.Location.Line1))
            {
                formValues.Add("location_street_address", this.Location.Line1);
            }

            if (!string.IsNullOrEmpty(this.Location.City))
            {
                formValues.Add("location_city", this.Location.City);
            }

            if (!string.IsNullOrEmpty(this.Location.State))
            {
                formValues.Add("location_state", this.Location.State);
            }

            if (!string.IsNullOrEmpty(this.Location.Zip))
            {
                formValues.Add("location_zip", this.Location.Zip);
            }

            return(formValues.ToString());
        }
Example #4
0
        public IChurchCommunityBuilderResponse <IndividualCollection> LoginProfile(string username, string password)
        {
            var formValues = new FormValuesBuilder();

            if (!string.IsNullOrEmpty(username))
            {
                formValues.Add("login", username);
            }

            if (!string.IsNullOrEmpty(password))
            {
                formValues.Add("password", password);
            }


            var individuals = this.Execute("individual_profile_from_login_password", formValues.ToString());

            return(individuals);
        }
Example #5
0
        public IChurchCommunityBuilderResponse <IndividualCollection> Login(string username, string password)
        {
            int returnID = 0;

            var formValues = new FormValuesBuilder();

            if (!string.IsNullOrEmpty(username))
            {
                formValues.Add("login", username);
            }

            if (!string.IsNullOrEmpty(password))
            {
                formValues.Add("password", password);
            }

            var result = this.Execute("individual_id_from_login_password", formValues.ToString());

            return(result);
        }
Example #6
0
        public Individual LoginProfile(string username, string password)
        {
            var formValues = new FormValuesBuilder();

            if (!string.IsNullOrEmpty(username))
            {
                formValues.Add("login", username);
            }

            if (!string.IsNullOrEmpty(password))
            {
                formValues.Add("password", password);
            }


            var individuals = this.Execute("individual_profile_from_login_password", formValues.ToString());

            if (individuals != null && individuals.Individuals.Count > 0)
            {
                return(individuals.Individuals[0]);
            }

            return(null);
        }
Example #7
0
        public string GetFormValues()
        {
            var formValues = new FormValuesBuilder();

            if (!string.IsNullOrEmpty(this.FirstName))
            {
                formValues.Add("first_name", this.FirstName);
            }

            if (!string.IsNullOrEmpty(this.LastName))
            {
                formValues.Add("last_name", this.LastName);
            }

            formValues.Add("middle_name", this.MiddleName)
            .Add("legal_first_name", this.LegalFirstName)
            .Add("sync_id", this.SyncID)
            .Add("other_id", this.OtherID)
            .Add("salutation", this.Salutation)
            .Add("suffix", this.Suffix);

            if (Campus != null && Campus.ID > 0)
            {
                formValues.Add("campus_id", this.Campus.ID.ToString());
            }

            if (this.Family != null && this.Family.ID > 0)
            {
                formValues.Add("family_id", this.Family.ID);
            }

            if (!string.IsNullOrEmpty(this.FamilyPositionString))
            {
                if (this.FamilyPositionString.ToLower() == "head of household" || this.FamilyPositionString.ToLower() == "primary contact")
                {
                    formValues.Add("family_position", "h");
                }
                else if (this.FamilyPositionString.ToLower() == "spouse")
                {
                    formValues.Add("family_position", "s");
                }
                else if (this.FamilyPositionString.ToLower() == "other")
                {
                    formValues.Add("family_position", "o");
                }
                else if (this.FamilyPositionString.ToLower() == "child")
                {
                    formValues.Add("family_position", "c");
                }
            }

            formValues.Add("gender", this.Gender)
            .Add("birthday", this.Birthday.HasValue ? this.Birthday.Value.ToString("yyyy-MM-dd") : "")
            .Add("anniversary", this.Anniversary.HasValue ? this.Anniversary.Value.ToString("yyyy-MM-dd") : "")
            .Add("deceased", this.Deceased.HasValue ? this.Deceased.Value.ToString("yyyy-MM-dd") : "")
            .Add("membership_date", this.MembershipDate.HasValue ? this.MembershipDate.Value.ToString("yyyy-MM-dd") : "")
            .Add("membership_end", this.MembershipEnd.HasValue ? this.MembershipEnd.Value.ToString("yyyy-MM-dd") : "")
            .Add("membership_type_id", this.MembershipType != null && this.MembershipType.ID > 0 ? this.MembershipType.ID.ToString() : "")
            .Add("giving_number", this.GivingNumber)
            .Add("allergies", this.Allergies)
            .Add("marital_status", this.MaritalStatus);

            if (!string.IsNullOrEmpty(Email) && Email.Contains('@') && Email.Contains('.'))
            {
                formValues.Add("email", this.Email);
            }
            else
            {
                formValues.Add("email", string.Empty);
            }

            if (this.Addresses != null && this.Addresses.Count > 0)
            {
                foreach (var current in Addresses)
                {
                    var addressType = current.Type;
                    var addressLine = current.Line1;

                    if (!string.IsNullOrEmpty(current.Line2) && !current.Line2.StartsWith(current.City))
                    {
                        addressLine += " " + current.Line2;
                    }

                    formValues.Add(string.Format("{0}_street_address", current.Type), addressLine);
                    formValues.Add(string.Format("{0}_city", current.Type), current.City);
                    if (!string.IsNullOrEmpty(current.State))
                    {
                        formValues.Add(string.Format("{0}_state", current.Type), current.State.ToUpper());
                    }
                    formValues.Add(string.Format("{0}_zip", current.Type), current.Zip);

                    if (current.Country != null)
                    {
                        formValues.Add(string.Format("{0}_country", current.Type), current.Country.Code.ToUpper());
                    }
                }
            }

            if (this.Phones != null && this.Phones.Count > 0)
            {
                foreach (var current in this.Phones)
                {
                    formValues.Add(string.Format("{0}_phone", current.Type), current.Value);
                }
            }

            if (this.UserDefinedTextFields != null && this.UserDefinedTextFields.Count > 0)
            {
                foreach (var field in this.UserDefinedTextFields)
                {
                    formValues.Add(field.Name, field.Text);
                }
            }

            if (this.UserDefinedDateFields != null && this.UserDefinedDateFields.Count > 0)
            {
                foreach (var field in this.UserDefinedDateFields)
                {
                    if (field.Date.HasValue)
                    {
                        formValues.Add(field.Name, field.Date.Value.ToString("yyyy-MM-dd"));
                    }
                    else
                    {
                        formValues.Add(field.Name, "");
                    }
                }
            }

            if (this.UserDefinedPulldownFields != null && this.UserDefinedPulldownFields.Count > 0)
            {
                foreach (var field in this.UserDefinedPulldownFields)
                {
                    formValues.Add(field.Name, field.Selection.ID.ToString());
                }
            }

            return(formValues.ToString());
        }
Example #8
0
        public FormValuesBuilder CreateFormValues()
        {
            var formValues = new FormValuesBuilder();

            formValues.Add("coa_category_id", this.AccountID.ToString())
            .Add("individual_id", this.IndividualID.ToString())
            .Add("amount", this.GiftAmount.ToString("#.00", CultureInfo.InvariantCulture));

            if (!string.IsNullOrEmpty(this.MerchantTransactionID))
            {
                formValues.Add("merchant_transaction_id", this.MerchantTransactionID);
            }

            if (!string.IsNullOrEmpty(this.MerchantAuthorizationCode))
            {
                formValues.Add("merchant_authorization_code", this.MerchantAuthorizationCode);
            }

            if (!string.IsNullOrEmpty(this.MerchantName))
            {
                formValues.Add("merchant_name", this.MerchantName);
            }

            if (!string.IsNullOrEmpty(this.MerchantNotes))
            {
                formValues.Add("merchant_notes", this.MerchantNotes);
            }

            if (this.MerchantProcessDate.HasValue)
            {
                formValues.Add("merchant_process_date", this.MerchantProcessDate.Value.ToString("yyyy-MM-dd"));
            }

            if (!string.IsNullOrEmpty(this.FirstName))
            {
                formValues.Add("first_name", this.FirstName);
            }
            if (!string.IsNullOrEmpty(this.LastName))
            {
                formValues.Add("last_name", this.LastName);
            }
            if (!string.IsNullOrEmpty(this.StreetAddress))
            {
                formValues.Add("stret_address", this.StreetAddress);
            }
            if (!string.IsNullOrEmpty(this.City))
            {
                formValues.Add("city", this.City);
            }
            if (!string.IsNullOrEmpty(this.State))
            {
                formValues.Add("state", this.State);
            }
            if (!string.IsNullOrEmpty(this.Zip))
            {
                formValues.Add("zip", this.Zip);
            }
            if (!string.IsNullOrEmpty(this.Email))
            {
                formValues.Add("email", this.Email);
            }
            if (!string.IsNullOrEmpty(this.Phone))
            {
                formValues.Add("phone", this.Phone);
            }
            if (this.CampusID.HasValue)
            {
                formValues.Add("campus_id", this.CampusID.Value);
            }
            if (!string.IsNullOrEmpty(this.PaymentMethodType))
            {
                formValues.Add("payment_method_type", this.PaymentMethodType);
            }

            return(formValues);
        }