コード例 #1
0
ファイル: FamilyRole.cs プロジェクト: mgolois/DivineChMS
 public MembersFamilyRole ToMembersRole(Member member)
      => new MembersFamilyRole
      {
          FamilyRole = this,
          Member = member,
          MemberID = member.Id,
          FamilyRoleID = this.Id
      };
コード例 #2
0
ファイル: MemberEvent.cs プロジェクト: mgolois/DivineChMS
        public MemberEvent(Member member, string eventName, DateTime date)
        {
            MemberID = member.Id;
            FullName = member.FullName;
            EventName = eventName;
            EventDate = date.ToString("MM/dd/yyyy");
            Date = date;
            Phone = member.CellPhone ?? member.HomePhone ?? member.WorkPhone;

            var age = (DateTime.Now.Year - date.Year);

            if(date.AddYears(age) > DateTime.Now)
            {
                age--;
            }

            Years = age.ToString();

        }
コード例 #3
0
        private async void OnSave(object sender, EventArgs e)
        {
            var member = new Member
            {
                FirstName = FirstName.Text,
                LastName = LastName.Text,
                MiddleName = MiddletName.Text,
                DateOfBirth = DateOfBirthPicker.Date,
                Email = Email.Text,
                City = City.Text,
                Address = Address.Text,
                State = State.Text,
                Zipcode = Zipcode.Text,
                Country = Country.Text,
                HomePhone = HomePhone.Text,
                CellPhone = CellPhone.Text,
            };
            member.SalutationID = lookupData.Salutations.FirstOrDefault(s => CompareSelectedIndex(SalutationPicker, s.SalutationName))?.Id;
            member.MemberStatusID = lookupData.MemberStatus.FirstOrDefault(s => CompareSelectedIndex(StatusPicker, s.Status)).Id;
            member.HeadOfFamilyID = lookupData.HeadOfFamilies.FirstOrDefault(s => CompareSelectedIndex(FamilyHeadPicker, s.FullName))?.Id;
            member.RelationshipStatusID = lookupData.RelationshipStatus.FirstOrDefault(s => CompareSelectedIndex(RelationshipPicker, s.Status))?.Id;
            member.GenderID = lookupData.Genders.FirstOrDefault(s => CompareSelectedIndex(GenderPicker, s.GenderName))?.Id;
            member.MembersFamilyRoles = new List<MembersFamilyRole>()
            {
                new MembersFamilyRole()
                {
                    FamilyRoleID =
                        lookupData.Roles.FirstOrDefault(r => CompareSelectedIndex(FamilyRolePicker, r.FamilyRole.Role))
                            .FamilyRoleID,

                }
            };
            member.MembersMinistries = new List<MembersMinistry>()
            {
                new MembersMinistry()
                {
                    MinistryID =
                        lookupData.MinistriesDetails.FirstOrDefault(
                            r => CompareSelectedIndex(MinistryPicker, r.MinistryName)).MinistryID
                }
            };

            var result = await newMemberVM.SaveNewMembers(member);

            if (result.Success)
            {
                await DisplayAlert("SUCCESS", $"{result.Result.FullName} was successfully saved", "OK");
                ClearField();
            }
            else
            {
                await DisplayAlert("ERROR", result.Message, "OK");
            }

        }
コード例 #4
0
 public async Task<IResultResponse<Member>> SaveNewMembers(Member member)
 {
   return await divineProxy.PostMembers(member).ToObject<Member>();
 }
コード例 #5
0
ファイル: DivineProxy.cs プロジェクト: mgolois/DivineChMS
        public async Task<HttpResponseMessage> PostMembers(Member member)
        {
            SetTokenInHeader();
            return await httpClient.PostAsJsonAsync("/api/Members", member);

        }