示例#1
0
        public void btn_submit_Clicked()
        {
            // NEED TO DO VERIFICATION ON FORM. TRY CATCH ON REQUIRED EMPTY VARIABLES?

            if (string.IsNullOrEmpty(view.getMiddleName()))
            {
                personBuilder
                .WithNoMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getLastName());

                if (string.IsNullOrEmpty(view.getEmergency()))
                {
                    personBuilder
                    .WithPrimaryContactOnly(view.getPhone());

                    if (string.IsNullOrEmpty(view.getSecondLine()) && string.IsNullOrEmpty(view.getThirdLine()))
                    {
                        addressBuilder
                        .OneLineAddress(view.getFirstLine(), view.getCity(), view.getCounty(), view.getPostcode());
                    }
                    else if (string.IsNullOrEmpty(view.getThirdLine()))
                    {
                        addressBuilder
                        .TwoLineAddress(view.getFirstLine(), view.getSecondLine(), view.getCity(), view.getCounty(), view.getPostcode());
                    }
                    else
                    {
                        addressBuilder
                        .ThreeLineAddress(view.getFirstLine(), view.getSecondLine(), view.getThirdLine(), view.getCity(), view.getCounty(), view.getPostcode());
                    }
                }
                else
                {
                    personBuilder
                    .WithAllContacts(view.getPhone(), view.getEmergency());
                }
            }
            else
            {
                personBuilder
                .WithMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getMiddleName(), view.getLastName());
            }

            gp      = personBuilder.Build();
            address = addressBuilder.Build();
            GP practice = new GP();

            practice.GPPractice = view.getPracticeName();
            MemberDB.InsertGP(gp);
            AddressDB.InsertAddress(address);
            GPDB.InsertGP(practice);

            ConfirmationForm      cForm      = new ConfirmationForm();
            ConfirmationPresenter cPresenter = new ConfirmationPresenter(cForm);

            cForm.Show();
        }
示例#2
0
        public void AddressBuilder_FirstLineOnly_ReturnsTrue()
        {
            var address = builder
                          .OneLineAddress("Line", "City", "County", "Postcode")
                          .Build();

            Assert.IsNotNull(address.FirstLine);
            Assert.IsNull(address.SecondLine);
            Assert.IsNull(address.ThirdLine);
        }
示例#3
0
        public void btn_submit_Clicked()
        {
            personBuilder
            .setMember((Member)Enum.Parse(typeof(Member), view.getMember()))
            .setGender((Gender)Enum.Parse(typeof(Gender), view.getGender()))
            .setDOB(view.getDOB());


            if (string.IsNullOrEmpty(view.getMiddleName()))
            {
                personBuilder
                .WithNoMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getLastName());

                if (string.IsNullOrEmpty(view.getEmergency()))
                {
                    personBuilder
                    .WithPrimaryContactOnly(view.getPhone());

                    if (string.IsNullOrEmpty(view.getSecondLine()) && string.IsNullOrEmpty(view.getThirdLine()))
                    {
                        addressBuilder
                        .OneLineAddress(view.getFirstLine(), view.getCity(), view.getCounty(), view.getPostcode());
                    }
                    else if (string.IsNullOrEmpty(view.getThirdLine()))
                    {
                        addressBuilder
                        .TwoLineAddress(view.getFirstLine(), view.getSecondLine(), view.getCity(), view.getCounty(), view.getPostcode());
                    }
                    else
                    {
                        addressBuilder
                        .ThreeLineAddress(view.getFirstLine(), view.getSecondLine(), view.getThirdLine(), view.getCity(), view.getCounty(), view.getPostcode());
                    }
                }
                else
                {
                    personBuilder
                    .WithAllContacts(view.getPhone(), view.getEmergency());
                }
            }
            else
            {
                personBuilder
                .WithMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getMiddleName(), view.getLastName());
            }

            member = personBuilder.Build();
            MemberDB.InsertMember(member);
            address = addressBuilder.Build();
            AddressDB.InsertAddress(address);

            if (view.getMember() == "Patient")
            {
                GPInformationForm      gpForm      = new GPInformationForm();
                GPInformationPresenter gpPresenter = new GPInformationPresenter(gpForm);
                gpForm.Show();
            }
            else
            {
                ConfirmationForm      cForm      = new ConfirmationForm();
                ConfirmationPresenter cPresenter = new ConfirmationPresenter(cForm);
                cForm.Show();
            }
        }