Esempio n. 1
0
        public static BasicPersonInfo GetBasicPersonInfo(int?id)
        {
            var cv = new CodeValueModel();
            var p  = DbUtil.Db.LoadPersonById(id.Value);
            var pi = new BasicPersonInfo
            {
                Age                = p.Age.ToString(),
                Birthday           = p.DOB,
                CampusId           = p.CampusId ?? 0,
                Mobile             = p.CellPhone.FmtFone(),
                DeceasedDate       = p.DeceasedDate,
                DoNotCallFlag      = p.DoNotCallFlag,
                DoNotMailFlag      = p.DoNotMailFlag,
                DoNotVisitFlag     = p.DoNotVisitFlag,
                DoNotPublishPhones = p.DoNotPublishPhones ?? false,
                PrimaryEmail       = new EmailInfo(p.EmailAddress, p.SendEmailAddress1 ?? true),
                AltEmail           = new EmailInfo(p.EmailAddress2, p.SendEmailAddress2 ?? false),
                Employer           = p.EmployerOther,
                FirstName          = p.FirstName,
                Created            = p.CreatedDate,
                Grade              = p.Grade.ToString(),
                HomePhone          = p.Family.HomePhone.FmtFone(),
                JoinDate           = p.JoinDate,
                LastName           = p.LastName,
                AltName            = p.AltName,
                FormerName         = p.MaidenName,
                Gender             = new CodeInfo(p.GenderId, cv.GenderCodesWithUnspecified()),
                Marital            = new CodeInfo(p.MaritalStatusId, cv.MaritalStatusCodes99()),
                MemberStatus       = new CodeInfo(p.MemberStatusId, cv.MemberStatusCodes0()),
                FamilyPosition     = new CodeInfo(p.PositionInFamilyId, cv.FamilyPositionCodes()),
                MiddleName         = p.MiddleName,
                GoesBy             = p.NickName,
                Occupation         = p.OccupationOther,
                PeopleId           = p.PeopleId,
                School             = p.SchoolOther,
                Spouse             = p.SpouseName(DbUtil.Db),
                Suffix             = p.SuffixCode,
                Title              = new CodeInfo(p.TitleCode, cv.TitleCodes(), "Value"),
                WeddingDate        = p.WeddingDate.FormatDate(),
                Work               = p.WorkPhone.FmtFone(),
                ReceiveSMS         = p.ReceiveSMS,
            };

            pi.person = p;
            return(pi);
        }
Esempio n. 2
0
        private static void UpdatePeople(DbConnection cn, CMSDataContext Db, int userPeopleId)
        {
            var cv   = new CodeValueModel();
            var pcmd = cn.CreateCommand();

            pcmd.CommandText = "select * from [Sheet1$]";
            var rd = pcmd.ExecuteReader();

            while (rd.Read())
            {
                var i = Util.GetAs(rd, typeof(UpdatePeopleItem)) as UpdatePeopleItem;
                var p = Db.LoadPersonById(i.PeopleId);

                //var psb = new StringBuilder();
                var psb = new List <ChangeDetail>();

                p.UpdateValue(psb, "TitleCode", i.Title);
                p.UpdateValue(psb, "FirstName", i.First);
                p.UpdateValue(psb, "NickName", i.GoesBy);
                p.UpdateValue(psb, "LastName", i.Last);
                p.UpdateValue(psb, "SuffixCode", i.Suffix);
                p.UpdateValue(psb, "EmailAddress", i.Email1);
                p.UpdateValue(psb, "EmailAddress2", i.Email2);
                p.UpdateValue(psb, "DOB", i.BirthDate.FormatDate());
                p.UpdateValue(psb, "WeddingDate", i.Anniversary);
                p.UpdateValue(psb, "JoinDate", i.Joined);
                p.UpdateValue(psb, "CellPhone", i.Cell.GetDigits());
                p.UpdateValue(psb, "WorkPhone", i.Work.GetDigits());
                p.UpdateValue(psb, "AltName", i.AltName);
                p.UpdateValue(psb, "SchoolOther", i.School);
                p.UpdateValue(psb, "OccupationOther", i.Occupation);
                p.UpdateValue(psb, "EmployerOther", i.Employer);
                p.UpdateValue(psb, "Grade", i.Grade);
                p.UpdateValue(psb, "DeceasedDate", i.Deceased);

                p.UpdateValue(psb, "MemberStatusId", CviOrNull(cv.MemberStatusCodes().SingleOrDefault(c => c.Value == i.Member)) ?? 20);
                p.UpdateValue(psb, "GenderId", CviOrNull(cv.GenderCodes().SingleOrDefault(c => c.Value == i.Gender)) ?? 0);
                p.UpdateValue(psb, "MaritalStatusId", CviOrNull(cv.MaritalStatusCodes().SingleOrDefault(c => c.Value == i.Marital)) ?? 0);
                p.UpdateValue(psb, "PositionInFamilyId", CviOrNull(cv.FamilyPositionCodes().SingleOrDefault(c => c.Value == i.FamilyPos)) ?? 0);
                p.UpdateValue(psb, "CampusId", CviOrNull(cv.AllCampuses().SingleOrDefault(c => c.Value == i.Campus)));

                p.LogChanges(Db, psb);
                Db.SubmitChanges();
            }
        }
Esempio n. 3
0
 public IEnumerable<TitleItems> TitleItems()
 {
     var Model = new CodeValueModel();
     return new List<TitleItems>
     {
         new TitleItems { title = "Member Status Codes", items = Model.MemberStatusCodes() },
         new TitleItems { title = "Drop Type Codes", items = Model.DropTypes() },
         new TitleItems { title = "Baptism Status Codes", items = Model.BaptismStatuses() },
         new TitleItems { title = "Baptism Type Codes", items = Model.BaptismTypes() },
         new TitleItems { title = "Campus Codes", items = Model.AllCampuses() },
         new TitleItems { title = "Marital Status Codes", items = Model.MaritalStatusCodes() },
         new TitleItems { title = "Gender Codes", items = Model.GenderCodes() },
         new TitleItems { title = "Family Position Codes", items = Model.FamilyPositionCodes() },
         new TitleItems { title = "Contribution Statement Options", items = Model.EnvelopeOptions() },
         new TitleItems { title = "Envelope Options", items = Model.EnvelopeOptions() },
         new TitleItems { title = "Entry Point Codes", items = Model.EntryPoints() },
         new TitleItems { title = "New Member Class", items = Model.NewMemberClassStatusCodes() },
         new TitleItems { title = "Approval Codes (negative to remove, 0 to remove all)", items = Model.VolunteerCodes() },
     };
 }
Esempio n. 4
0
        public static PersonInfo GetPersonInfo(int?id)
        {
            var cv    = new CodeValueModel();
            var flags = DbUtil.Db.Setting("StatusFlags", "F04,F01,F02,F03");
            var i     = (from pp in DbUtil.Db.People
                         let spouse = (from sp in pp.Family.People where sp.PeopleId == pp.SpouseId select sp.Name).SingleOrDefault()
                                      let statusflags = DbUtil.Db.StatusFlags(flags).Single(sf => sf.PeopleId == id).StatusFlags
                                                        where pp.PeopleId == id
                                                        select new
            {
                pp,
                f = pp.Family,
                spouse = spouse,
                pp.Picture,
                statusflags,
            }).FirstOrDefault();

            if (i == null)
            {
                return(null);
            }
            var p   = i.pp;
            var fam = i.f;

            var pi = new PersonInfo
            {
                PeopleId      = p.PeopleId,
                AddressTypeId = p.AddressTypeId,
                Deceased      = p.IsDeceased ?? false,
                FamilyId      = p.FamilyId,
                Name          = p.Name,
                Picture       = i.Picture,
                SpouseId      = p.SpouseId,
                StatusFlags   = (i.statusflags ?? "").Split(','),

                member = new MemberInfo
                {
                    PeopleId               = p.PeopleId,
                    BaptismSchedDate       = p.BaptismSchedDate,
                    BaptismTypeId          = p.BaptismTypeId ?? 0,
                    BaptismStatusId        = p.BaptismStatusId ?? 0,
                    BaptismDate            = p.BaptismDate,
                    DecisionDate           = p.DecisionDate,
                    DecisionTypeId         = p.DecisionTypeId ?? 0,
                    DropDate               = p.DropDate,
                    DropTypeId             = p.DropCodeId,
                    EnvelopeOptionId       = p.EnvelopeOptionsId ?? 0,
                    StatementOptionId      = p.ContributionOptionsId ?? 0,
                    JoinTypeId             = p.JoinCodeId,
                    NewChurch              = p.OtherNewChurch,
                    PrevChurch             = p.OtherPreviousChurch,
                    NewMemberClassDate     = p.NewMemberClassDate,
                    NewMemberClassStatusId = p.NewMemberClassStatusId ?? 0,
                    MemberStatusId         = p.MemberStatusId,
                    JoinDate               = p.JoinDate,
                },
                basic = new BasicPersonInfo
                {
                    PeopleId       = p.PeopleId,
                    person         = p,
                    Age            = p.Age.ToString(),
                    Birthday       = p.DOB,
                    CampusId       = p.CampusId ?? 0,
                    Mobile         = p.CellPhone.FmtFone(),
                    DeceasedDate   = p.DeceasedDate,
                    DoNotCallFlag  = p.DoNotCallFlag,
                    DoNotMailFlag  = p.DoNotMailFlag,
                    DoNotVisitFlag = p.DoNotVisitFlag,
                    PrimaryEmail   = new EmailInfo(p.EmailAddress, p.SendEmailAddress1 ?? true),
                    AltEmail       = new EmailInfo(p.EmailAddress2, p.SendEmailAddress2 ?? false),
                    Gender         = new CodeInfo(p.GenderId, cv.GenderCodesWithUnspecified()),
                    Marital        = new CodeInfo(p.MaritalStatusId, cv.MaritalStatusCodes99()),
                    MemberStatus   = new CodeInfo(p.MemberStatusId, cv.MemberStatusCodes0()),
                    FamilyPosition = new CodeInfo(p.PositionInFamilyId, cv.FamilyPositionCodes()),
                    Employer       = p.EmployerOther,
                    FirstName      = p.FirstName,
                    Created        = p.CreatedDate,
                    Grade          = p.Grade.ToString(),
                    HomePhone      = p.Family.HomePhone,
                    JoinDate       = p.JoinDate,
                    LastName       = p.LastName,
                    AltName        = p.AltName,
                    FormerName     = p.MaidenName,
                    MemberStatusId = p.MemberStatusId,
                    MiddleName     = p.MiddleName,
                    GoesBy         = p.NickName,
                    Occupation     = p.OccupationOther,
                    School         = p.SchoolOther,
                    Spouse         = i.spouse,
                    Suffix         = p.SuffixCode,
                    Title          = new CodeInfo(p.TitleCode, cv.TitleCodes(), "Value"),
                    WeddingDate    = p.WeddingDate.FormatDate(),
                    Work           = p.WorkPhone.FmtFone(),
                    ReceiveSMS     = p.ReceiveSMS,
                },
                growth = new GrowthInfo
                {
                    PeopleId            = p.PeopleId,
                    InterestPointId     = p.InterestPointId ?? 0,
                    OriginId            = p.OriginId ?? 0,
                    EntryPointId        = p.EntryPointId ?? 0,
                    ChristAsSavior      = p.ChristAsSavior,
                    Comments            = p.Comments,
                    InterestedInJoining = p.InterestedInJoining,
                    MemberAnyChurch     = p.MemberAnyChurch,
                    PleaseVisit         = p.PleaseVisit,
                    SendInfo            = p.InfoBecomeAChristian,
                },
                membernotes = new MemberNotesInfo
                {
                    PeopleId        = p.PeopleId,
                    LetterStatusId  = p.LetterStatusId ?? 0,
                    LetterReceived  = p.LetterDateReceived,
                    LetterRequested = p.LetterDateRequested,
                    LetterNotes     = p.LetterStatusNotes,
                },
                FamilyAddr = new AddressInfo
                {
                    Name       = "FamilyAddr",
                    PeopleId   = p.PeopleId,
                    person     = p,
                    Address1   = fam.AddressLineOne,
                    Address2   = fam.AddressLineTwo,
                    City       = fam.CityName,
                    Zip        = fam.ZipCode,
                    BadAddress = fam.BadAddressFlag,
                    State      = new CodeInfo(fam.StateCode, AddressInfo.StateCodes()),
                    Country    = new CodeInfo(fam.CountryName, AddressInfo.Countries()),
                    ResCode    = new CodeInfo(fam.ResCodeId, AddressInfo.ResCodes()),
                    FromDt     = fam.AddressFromDate,
                    ToDt       = fam.AddressToDate,
                    Preferred  = p.AddressTypeId == 10,
                },
                PersonalAddr = new AddressInfo
                {
                    Name       = "PersonalAddr",
                    PeopleId   = p.PeopleId,
                    person     = p,
                    Address1   = p.AddressLineOne,
                    Address2   = p.AddressLineTwo,
                    City       = p.CityName,
                    State      = new CodeInfo(p.StateCode, AddressInfo.StateCodes()),
                    Country    = new CodeInfo(p.CountryName, AddressInfo.Countries()),
                    ResCode    = new CodeInfo(p.ResCodeId, AddressInfo.ResCodes()),
                    Zip        = p.ZipCode,
                    BadAddress = p.BadAddressFlag,
                    FromDt     = p.AddressFromDate,
                    ToDt       = p.AddressToDate,
                    Preferred  = p.AddressTypeId == 30,
                },
                //familymembers = i.familymembers
            };

            return(pi);
        }
Esempio n. 5
0
        public IEnumerable <TitleItems> FetchTitleItems()
        {
            var Model = new CodeValueModel();

            return(new List <TitleItems>
            {
                new TitleItems {
                    title = "Approval Codes", Instructions = "(negative to remove, 0 to remove all)", items = Model.VolunteerCodes()
                },
                new TitleItems {
                    title = "Baptism Status Codes", items = Model.BaptismStatusList()
                },
                new TitleItems {
                    title = "Baptism Type Codes", items = Model.BaptismTypeList()
                },
                new TitleItems {
                    title = "Bad Address Flag", items = BadAddressFlag(), UseCode = true
                },
                new TitleItems {
                    title = "Campus Codes", items = Model.AllCampuses()
                },
                new TitleItems {
                    title = "Contribution Statement Options", items = Model.EnvelopeOptionList()
                },
                new TitleItems {
                    title = "Decision Type Codes", items = Model.DecisionTypeList()
                },
                new TitleItems {
                    title = "Do Not Mail", items = DoNotMail(), UseCode = true
                },
                new TitleItems {
                    title = "Drop Type Codes", items = Model.DropTypeList()
                },
                new TitleItems {
                    title = "Envelope Options", items = Model.EnvelopeOptionList()
                },
                new TitleItems {
                    title = "Entry Point Codes", items = Model.EntryPoints()
                },
                new TitleItems {
                    title = "Family Position Codes", items = Model.FamilyPositionCodes()
                },
                new TitleItems {
                    title = "Gender Codes", items = Model.GenderCodes()
                },
                new TitleItems {
                    title = "Grades", items = Grades(), UseCode = true
                },
                new TitleItems {
                    title = "Join Type Codes", items = Model.JoinTypeList()
                },
                new TitleItems {
                    title = "Marital Status Codes", items = Model.MaritalStatusCodes()
                },
                new TitleItems {
                    title = "Member Status Codes", items = Model.MemberStatusCodes()
                },
                new TitleItems {
                    title = "New Member Class", items = Model.NewMemberClassStatusList()
                },
                new TitleItems {
                    title = "Receive SMS", items = ReceiveSMS(), UseCode = true
                },
            });
        }
Esempio n. 6
0
        public static IEnumerable <CodeValueItem> Fetch(string field, ref bool useCode)
        {
            IEnumerable <CodeValueItem> m = null;
            var lookups = new CodeValueModel();

            switch (field)
            {
            case "Approval Codes":
                m = lookups.VolunteerCodes();
                break;

            case "Baptism Status":
                m = lookups.BaptismStatusList();
                break;

            case "Baptism Type":
                m = lookups.BaptismTypeList();
                break;

            case "Bad Address Flag":
                m       = UpdateFieldsModel.BadAddressFlag();
                useCode = true;
                break;

            case "Campus":
                m = lookups.AllCampuses();
                break;

            case "Statement Options":
                m = lookups.EnvelopeOptionList();
                break;

            case "Electronic Statement":
                m       = UpdateFieldsModel.ElectronicStatement();
                useCode = true;
                break;

            case "Decision Type":
                m = lookups.DecisionTypeList();
                break;

            case "Do Not Call":
                m       = UpdateFieldsModel.DoNotCall();
                useCode = true;
                break;

            case "Do Not Mail":
                m       = UpdateFieldsModel.DoNotMail();
                useCode = true;
                break;

            case "Drop Type":
                m = lookups.DropTypeList();
                break;

            case "Envelope Options":
                m = lookups.EnvelopeOptionList();
                break;

            case "Entry Point":
                m       = lookups.EntryPoints();
                useCode = false;
                break;

            case "Family Position":
                m = lookups.FamilyPositionCodes();
                break;

            case "Gender":
                m = lookups.GenderCodes();
                break;

            case "Grade":
                m       = UpdateFieldsModel.Grades();
                useCode = true;
                break;

            case "Join Type":
                m = lookups.JoinTypeList();
                break;

            case "Marital Status":
                m = lookups.MaritalStatusCodes();
                break;

            case "Member Status":
                m = lookups.MemberStatusCodes();
                break;

            case "New Member Class":
                m = lookups.NewMemberClassStatusList();
                break;

            case "ReceiveSMS":
                m       = UpdateFieldsModel.ReceiveSMS();
                useCode = true;
                break;
            }
            return(m);
        }