コード例 #1
0
        public Paragraph AddPhones(bool keepnext)
        {
            var paragraph1 = new Paragraph {
                RsidParagraphMarkRevision = "00E7001C", RsidParagraphAddition = "00E7001C", RsidParagraphProperties = "005205ED", RsidRunAdditionDefault = "00E7001C"
            };

            var paragraphProperties1 = new ParagraphProperties();
            var spacingBetweenLines1 = new SpacingBetweenLines {
                After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto
            };

            var paragraphMarkRunProperties1 = new ParagraphMarkRunProperties();
            var runFonts1 = new RunFonts {
                ComplexScriptTheme = ThemeFontValues.MinorHighAnsi
            };
            var fontSize1 = new FontSize {
                Val = "20"
            };
            var fontSizeComplexScript1 = new FontSizeComplexScript {
                Val = "20"
            };

            paragraphMarkRunProperties1.Append(runFonts1);
            paragraphMarkRunProperties1.Append(fontSize1);
            paragraphMarkRunProperties1.Append(fontSizeComplexScript1);

            var keeplines = new KeepLines();

            paragraphProperties1.Append(keeplines);
            if (keepnext)
            {
                paragraphProperties1.Append(new KeepNext());
            }
            paragraphProperties1.Append(spacingBetweenLines1);
            paragraphProperties1.Append(paragraphMarkRunProperties1);
            paragraph1.Append(paragraphProperties1);

            var needbreak = false;

            if (HomePhone.HasValue())
            {
                var run1 = new Run {
                    RsidRunProperties = "00E7001C"
                };
                if (needbreak)
                {
                    run1.Append(new Break());
                }
                needbreak = true;

                var runProperties1 = new RunProperties();
                var runFonts2      = new RunFonts {
                    ComplexScriptTheme = ThemeFontValues.MinorHighAnsi
                };
                var fontSize3 = new FontSize {
                    Val = "20"
                };

                runProperties1.Append(fontSize3);
                runProperties1.Append(runFonts2);
                var text1 = new Text();
                text1.Text = HomePhone.FmtFone("H");

                run1.Append(runProperties1);
                run1.Append(text1);
                paragraph1.Append(run1);
            }


            if (head.Cell.HasValue())
            {
                var run4 = new Run {
                    RsidRunProperties = "00E7001C"
                };
                if (needbreak)
                {
                    run4.Append(new Break());
                }
                needbreak = true;

                var runProperties4 = new RunProperties();
                var runFonts5      = new RunFonts {
                    ComplexScriptTheme = ThemeFontValues.MinorHighAnsi
                };
                var fontSize3 = new FontSize {
                    Val = "20"
                };

                runProperties4.Append(fontSize3);
                runProperties4.Append(runFonts5);
                var text3 = new Text();
                text3.Text = $"C {head.First}: {head.Cell.FmtFone()}";

                run4.Append(runProperties4);
                run4.Append(text3);
                paragraph1.Append(run4);
            }
            if (spouse != null && spouse.Cell.HasValue())
            {
                var run4 = new Run {
                    RsidRunProperties = "00E7001C"
                };
                if (needbreak)
                {
                    run4.Append(new Break());
                }
                needbreak = true;

                var runProperties4 = new RunProperties();
                var runFonts5      = new RunFonts {
                    ComplexScriptTheme = ThemeFontValues.MinorHighAnsi
                };
                var fontSize3 = new FontSize {
                    Val = "20"
                };

                runProperties4.Append(fontSize3);
                runProperties4.Append(runFonts5);
                var text3 = new Text();
                text3.Text = $"C {spouse.First}: {spouse.Cell.FmtFone()}";

                run4.Append(runProperties4);
                run4.Append(text3);
                paragraph1.Append(run4);
            }

            return(paragraph1);
        }
コード例 #2
0
ファイル: Validate.cs プロジェクト: chrisgundersen/bvcms
        public void ValidateModelForNew(ModelStateDictionary ModelState, int i)
        {
            var dobname     = Parent.GetNameFor(mm => mm.List[i].DateOfBirth);
            var foundname   = Parent.GetNameFor(mm => mm.List[i].Found);
            var isnewfamily = whatfamily == 3;

            ValidBasic(ModelState, i);
            DateTime dt;

            if (RequiredDOB() && DateOfBirth.HasValue() && !Util.BirthDateValid(bmon, bday, byear, out dt))
            {
                ModelState.AddModelError(dobname, "birthday invalid");
            }
            else if (!birthday.HasValue && RequiredDOB())
            {
                ModelState.AddModelError(dobname, "birthday required");
            }
            if (birthday.HasValue && NoReqBirthYear() == false && birthday.Value.Year == Util.SignalNoYear)
            {
                ModelState.AddModelError(dobname, "BirthYear is required");
                IsValidForNew = false;
                return;
            }

            var minage = DbUtil.Db.Setting("MinimumUserAge", "16").ToInt();

            if (orgid == Util.CreateAccountCode && age < minage)
            {
                ModelState.AddModelError(dobname, "must be {0} to create account".Fmt(minage));
            }

            if (ComputesOrganizationByAge() && GetAppropriateOrg() == null)
            {
                ModelState.AddModelError(dobname, NoAppropriateOrgError);
            }

            ValidateBirthdayRange(ModelState, i);
            int n = 0;

            if (Phone.HasValue() && Phone.GetDigits().Length >= 10)
            {
                n++;
            }
            if (ShowAddress && HomePhone.HasValue() && HomePhone.GetDigits().Length >= 10)
            {
                n++;
            }

            if (RequiredPhone() && n == 0)
            {
                ModelState.AddModelError(Parent.GetNameFor(mm => mm.List[i].Phone), "cell or home phone required");
            }

            if (HomePhone.HasValue() && HomePhone.GetDigits().Length > 20)
            {
                ModelState.AddModelError(Parent.GetNameFor(mm => mm.List[i].HomePhone), "homephone too long");
            }

            if (EmailAddress.HasValue())
            {
                EmailAddress = EmailAddress.Trim();
            }
            if (!EmailAddress.HasValue() || !Util.ValidEmail(EmailAddress))
            {
                ModelState.AddModelError(Parent.GetNameFor(mm => mm.List[i].EmailAddress), "Please specify a valid email address.");
            }
            if (isnewfamily)
            {
                if (!AddressLineOne.HasValue() && RequiredAddr())
                {
                    ModelState.AddModelError(Parent.GetNameFor(mm => mm.List[i].AddressLineOne), "address required.");
                }
                if (RequiredZip() && AddressLineOne.HasValue())
                {
                    var addrok = City.HasValue() && State.HasValue();
                    if (ZipCode.HasValue())
                    {
                        addrok = true;
                    }
                    if (!addrok)
                    {
                        ModelState.AddModelError(Parent.GetNameFor(mm => mm.List[i].ZipCode), "zip required (or \"na\")");
                    }

                    if (ModelState.IsValid && AddressLineOne.HasValue() &&
                        (Country == "United States" || !Country.HasValue()))
                    {
                        var r = AddressVerify.LookupAddress(AddressLineOne, AddressLineTwo, City, State, ZipCode);
                        if (r.Line1 != "error")
                        {
                            if (r.found == false)
                            {
                                ModelState.AddModelError(Parent.GetNameFor(mm => mm.List[i].ZipCode), r.address + ", to skip address check, Change the country to USA, Not Validated");
                                ShowCountry = true;
                                return;
                            }
                            if (r.Line1 != AddressLineOne)
                            {
                                AddressLineOne = r.Line1;
                            }
                            if (r.Line2 != (AddressLineTwo ?? ""))
                            {
                                AddressLineTwo = r.Line2;
                            }
                            if (r.City != (City ?? ""))
                            {
                                City = r.City;
                            }
                            if (r.State != (State ?? ""))
                            {
                                State = r.State;
                            }
                            if (r.Zip != (ZipCode ?? ""))
                            {
                                ZipCode = r.Zip;
                            }
                        }
                    }
                }
            }

            if (!gender.HasValue && RequiredGender())
            {
                ModelState.AddModelError(Parent.GetNameFor(mm => mm.List[i].gender), "Please specify gender");
            }
            if (!married.HasValue && RequiredMarital())
            {
                ModelState.AddModelError(Parent.GetNameFor(mm => mm.List[i].married), "Please specify marital status");
            }

            if (MemberOnly())
            {
                ModelState.AddModelError(foundname, "Sorry, must be a member of church");
            }
            else if (org != null && setting.ValidateOrgIds.Count > 0)
            {
                ModelState.AddModelError(foundname, "Must be member of specified organization");
            }

            IsValidForNew      = ModelState.IsValid;
            IsValidForContinue = ModelState.IsValid;
        }