public static PersonIdentification GetPersonIdentification(Party party, IdentificationType identificationType)
        {
            var personIdentification = Context.PersonIdentifications.SingleOrDefault(entity => entity.PartyId == party.Id
                                                                                && entity.IdentificationTypeId == identificationType.Id);

            return personIdentification;
        }
 public static PostalAddress GetCurrentPostalAddress(FinancialEntities context, Party party, PostalAddressType type, Func<Address, bool> condition)
 {
     Address address = party.Addresses.SingleOrDefault(entity => entity.EndDate == null && entity.PostalAddress.PostalAddressTypeId == type.Id && condition(entity));
     if (address != null)
         return address.PostalAddress;
     return null;
 }
示例#3
0
        public static PartyRole CreateAndUpdateCurrentLoanApplicationRole(LoanApplication loanApplication, Party party, RoleType roletype, DateTime today)
        {
            PartyRole role = GetPartyRoleFromLoanApplication(loanApplication, roletype);
            if (role != null)
                role.EndDate = today;

            return CreateLoanApplicationRole(loanApplication, roletype, party, today);
        }
示例#4
0
 public static Address AddAddress(Party party, AddressType addressType, DateTime today)
 {
     Address address = new Address();
     address.Party = party;
     address.AddressType = addressType;
     address.EffectiveDate = today;
     return address;
 }
 public static PostalAddress GetCurrentPostalAddressV2(FinancialEntities context, Party party, PostalAddressType type, Func<PostalAddress, bool> condition)
 {
     PostalAddress postalAddress = context.PostalAddresses.SingleOrDefault(entity =>entity.Address.PartyId == party.Id &&
         entity.Address.EndDate == null && entity.PostalAddressTypeId == type.Id && condition(entity));
     //Address address = party.Addresses.SingleOrDefault(entity => entity.EndDate == null && entity.PostalAddress.PostalAddressTypeId == type.Id && condition(entity));
     //if (address != null)
     //    return address.PostalAddress;
     return postalAddress;
 }
示例#6
0
        public static PartyRole Create(RoleType roletype, Party party, DateTime today)
        {
            PartyRole partyRole = new PartyRole();
            partyRole.Party = party;
            partyRole.RoleTypeId = roletype.Id;
            partyRole.EffectiveDate = today;
            partyRole.EndDate = null;

            return partyRole;
        }
示例#7
0
 public static PartyRole CreateChequeRole(Cheque cheque, RoleType roleType, Party party, DateTime today)
 {
     PartyRole partyRole = new PartyRole();
     partyRole.Party = party;
     partyRole.RoleTypeId = roleType.Id;
     partyRole.EffectiveDate = today;
     partyRole.EndDate = null;
     cheque.PartyRole = partyRole;
     Context.Cheques.AddObject(cheque);
     return partyRole;
 }
        public static ElectronicAddress CreateElectronicAddress(Party party, ElectronicAddressType type, DateTime now)
        {
            Address address = new Address();
            address.Party = party;
            address.AddressType = AddressType.ElectronicAddressType;
            address.EffectiveDate = now;

            ElectronicAddress electronicAddress = new ElectronicAddress();
            electronicAddress.Address = address;
            electronicAddress.ElectronicAddressType = type;
            return electronicAddress;
        }
        public static PostalAddress CreatePostalAddress(FinancialEntities context, Party party, PostalAddressType type, DateTime now)
        {
            Address address = new Address();
            address.Party = party;
            address.AddressType = AddressTypeEnums.GetPostalAddressType(context);
            address.EffectiveDate = now;

            PostalAddress postalAddress = new PostalAddress();
            postalAddress.Address = address;
            postalAddress.PostalAddressType = type;
            return postalAddress;
        }
 public void FillLenderInformation(Party party)
 {
     //Fill Lender Name
     Organization organization = party.Organization;
     lblLenderNameHeader.Text = organization.OrganizationName;
     //Fill Lender Address
     var postalAddress = PrintFacade.SetAndGetPostalAddress(party);
     FillPostalAddress(postalAddress);
     //Fill Lender Numbers
     lblPrimTelNumber.Text = PrintFacade.GetPrimaryPhoneNumber(party, postalAddress).ToString();
     lblSecTelNumber.Text = PrintFacade.GetSecondaryPhoneNumber(party, postalAddress).ToString();
     lblFaxNumber.Text = PrintFacade.GetFaxNumber(party, postalAddress).ToString();
     lblEmailAddress.Text = PrintFacade.GetEmailAddress(party);
 }
示例#11
0
        public void AddSameName(string result, Party party)
        {
            if (result == "yes")
            {
                hiddenUsesExistRecord.Text = "yes";
                this.hiddenExistingParty.Value = party.Id;

            }
            else
            {
                hiddenUsesExistRecord.Text = "no";
                //txtPersonName.Text = "";
                //wndPersonNameDetail.Show();
            }
        }
示例#12
0
        public static string GetFaxNumber(Party party, PostalAddress postalAddress)
        {
            string faxPhoneNUmber = string.Empty;
            var telecomNumberTypeFax = ObjectContext.TelecommunicationsNumberTypes.SingleOrDefault(entity => entity.Name == TelecommunicationsNumberType.BusinessFaxNumberType.Name);
            InitialDatabaseValueChecker.ThrowIfNull<TelecommunicationsNumberType>(telecomNumberTypeFax);
            var addressTypTelecom = ObjectContext.AddressTypes.First(entity => entity.Name == AddressType.TelecommunicationNumberType.Name);

            var faxNumber = party.Addresses.FirstOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == addressTypTelecom.Id
                && entity.TelecommunicationsNumber.TypeId.Value == telecomNumberTypeFax.Id && entity.TelecommunicationsNumber.IsPrimary);

            if (faxNumber != null)
            {
                var fN = faxNumber.TelecommunicationsNumber;
                faxPhoneNUmber = postalAddress.Country.CountryTelephoneCode + " " + "(" + fN.AreaCode + ") " + fN.PhoneNumber;

            }
            return faxPhoneNUmber;
        }
示例#13
0
        public static string GetPrimaryPhoneNumber(Party party, PostalAddress postalAddress)
        {
            string primPhoneNumber = null;
            //Primary Business Phone Number
            var addressTypTelecom = ObjectContext.AddressTypes.First(entity => entity.Name == AddressType.TelecommunicationNumberType.Name);

            var primaryNumber = party.Addresses.FirstOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == addressTypTelecom.Id
                && entity.TelecommunicationsNumber.TypeId.Value ==  TelecommunicationsNumberType.BusinessPhoneNumberType.Id && entity.TelecommunicationsNumber != null
                && entity.TelecommunicationsNumber.IsPrimary);

            if (primaryNumber != null)
            {
                var pN = primaryNumber.TelecommunicationsNumber;
                primPhoneNumber = postalAddress.Country.CountryTelephoneCode + " " + "(" + pN.AreaCode + ") " + pN.PhoneNumber;
            }

            return primPhoneNumber;
        }
示例#14
0
        public static string GetEmailAddress(Party party)
        {
            string emailAddress = string.Empty;

            var addressTypeId = AddressType.ElectronicAddressType.Id;
            var emailTypeId = ElectronicAddressType.BusinessEmailAddressType.Id;
            var primaryEmail = party.Addresses.FirstOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == addressTypeId
                                                 && entity.ElectronicAddress.ElectronicAddressTypeId.Value == emailTypeId
                                                 && entity.ElectronicAddress.IsPrimary);

            if (primaryEmail != null)
            {
                var ea = primaryEmail.ElectronicAddress;
                //Email Address
                emailAddress = ea.ElectronicAddressString;
            }

            return emailAddress;
        }
        public static void CreateOrUpdateTeleCommNumberAddress(Party party, TelecommunicationsNumber newTelecommNumberAddress, TelecommunicationsNumberType type, DateTime now, bool IsPrimary)
        {
            var address = party.Addresses.FirstOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == AddressType.TelecommunicationNumberType.Id && entity.TelecommunicationsNumber.IsPrimary == IsPrimary
                && entity.TelecommunicationsNumber.TelecommunicationsNumberType.Id == type.Id);

            newTelecommNumberAddress.AreaCode = string.IsNullOrWhiteSpace(newTelecommNumberAddress.AreaCode) ? null : newTelecommNumberAddress.AreaCode;
            newTelecommNumberAddress.PhoneNumber = string.IsNullOrWhiteSpace(newTelecommNumberAddress.PhoneNumber) ? null : newTelecommNumberAddress.PhoneNumber;

            if (newTelecommNumberAddress.AreaCode == null && newTelecommNumberAddress.PhoneNumber == null)
            {
                if (address != null)
                    address.EndDate = now;
                Context.Detach(newTelecommNumberAddress);
                return;
            }

            bool isEqual = false;
            if (address != null)
            {
                isEqual = true;
                var currentTeleComm = address.TelecommunicationsNumber;
                isEqual = isEqual && currentTeleComm.AreaCode == newTelecommNumberAddress.AreaCode;
                isEqual = isEqual && currentTeleComm.PhoneNumber == newTelecommNumberAddress.PhoneNumber;
                if (isEqual == false)
                    address.EndDate = now;
            }

            if (isEqual == false)
            {
                Address newAddress = new Address();
                newAddress.Party = party;
                newAddress.AddressType = AddressType.TelecommunicationNumberType;
                newAddress.EffectiveDate = now;

                newTelecommNumberAddress.Address = newAddress;
                newTelecommNumberAddress.TelecommunicationsNumberType = type;
                Context.TelecommunicationsNumbers.AddObject(newTelecommNumberAddress);
            }
            else
                Context.Detach(newTelecommNumberAddress);
        }
示例#16
0
        public CustomerWithLoan(Party party)
        {
            if (party.PartyType.Id == PartyType.PersonType.Id)
            {
                Person personAsCustomer = party.Person;
                this.Names = StringConcatUtility.Build(" ", personAsCustomer.LastNameString + ","
                    , personAsCustomer.FirstNameString, personAsCustomer.MiddleInitialString,
                    personAsCustomer.NameSuffixString);
            }
            else
            {
                this.OrgName = party.Organization.OrganizationName;
            }

            this.PartyTypes = party.PartyType.Name;
            PartyRole customerPartyRole = PartyRole.GetByPartyIdAndRole(party.Id, RoleType.CustomerType);
            if (customerPartyRole.Customer != null)
            {
                this.CustomerID = customerPartyRole.Id;
                this.Status = customerPartyRole.Customer.CurrentStatus.CustomerStatusType.Name;
            }

            Address postalAddress = party.Addresses.FirstOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == AddressType.PostalAddressType.Id
                                && entity.PostalAddress.PostalAddressTypeId == PostalAddressType.HomeAddressType.Id && entity.PostalAddress.IsPrimary);

            if (postalAddress != null && postalAddress.PostalAddress != null)
            {
                PostalAddress postalAddressSpecific = postalAddress.PostalAddress;
                this.Addresses = StringConcatUtility.Build(", ", postalAddressSpecific.StreetAddress,
                              postalAddressSpecific.Barangay,
                              postalAddressSpecific.Municipality,
                              postalAddressSpecific.City,
                              postalAddressSpecific.Province,
                              postalAddressSpecific.State,
                              postalAddressSpecific.Country.Name,
                              postalAddressSpecific.PostalCode);
            }
        }
        public AllowedCoBorrowerGuarantorModel(Party party)
        {
            this.PartyId = party.Id;
            if (party.PartyTypeId == PartyType.PersonType.Id)
            {
                Person personAsCustomer = party.Person;
                this.Name = StringConcatUtility.Build(" ", personAsCustomer.LastNameString + ","
                    , personAsCustomer.FirstNameString, personAsCustomer.MiddleInitialString,
                    personAsCustomer.NameSuffixString);
            }
            var postalAddress = PostalAddress.GetCurrentPostalAddress(party, PostalAddressType.HomeAddressType, true);

            if (postalAddress != null)
            {
                this.Address = StringConcatUtility.Build(",", postalAddress.StreetAddress,
                    postalAddress.Barangay,
                    postalAddress.Municipality,
                    postalAddress.City,
                    postalAddress.Province,
                    postalAddress.Country.Name,
                    postalAddress.PostalCode);
            }
        }
        public static void CreateOrUpdateElectronicAddress(Party party, ElectronicAddress newElectronicAddress , ElectronicAddressType type, Func<Address, bool> condition, DateTime now)
        {
            var currentElectronicAddress = ElectronicAddress.GetCurrentElectronicAddress(party, type, condition);
            if (string.IsNullOrWhiteSpace(newElectronicAddress.ElectronicAddressString))
            {
                if (currentElectronicAddress != null)
                    currentElectronicAddress.Address.EndDate = now;
                if (newElectronicAddress.EntityState == System.Data.EntityState.Added)
                    Context.Detach(newElectronicAddress);
                return;
            }

            bool isEqual = false;
            if (currentElectronicAddress != null)
            {
                isEqual = currentElectronicAddress.ElectronicAddressString == newElectronicAddress.ElectronicAddressString;
                if (isEqual == false)
                    currentElectronicAddress.Address.EndDate = now;
            }

            if (isEqual == false)
            {
                Address address = new Address();
                address.Party = party;
                address.AddressType = AddressType.ElectronicAddressType;
                address.EffectiveDate = now;

                newElectronicAddress.Address = address;
                newElectronicAddress.ElectronicAddressType = type;
                Context.ElectronicAddresses.AddObject(newElectronicAddress);
            }
            else
            {
                if (newElectronicAddress.EntityState == System.Data.EntityState.Added)
                    Context.Detach(newElectronicAddress);
            }
        }
 public static TelecommunicationsNumber GetCurrentTelecommNumberAddress(Party party, TelecommunicationsNumberType type, Func<Address, bool> condition)
 {
     Address address = party.Addresses.FirstOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == AddressType.TelecommunicationNumberType.Id
         && entity.TelecommunicationsNumber.TelecommunicationsNumberType.Id == type.Id && condition(entity));
     if (address != null)
         return address.TelecommunicationsNumber;
     return null;
 }
示例#20
0
        public static string GetSecondaryPhoneNumber(Party party, PostalAddress postalAddress)
        {
            string secPhoneNUmber = string.Empty;
            //Secondary Business Phone Number
            var addressTypTelecom = ObjectContext.AddressTypes.First(entity => entity.Name == AddressType.TelecommunicationNumberType.Name);
            var telecomNumberTypeBusinessPhoneNumber = ObjectContext.TelecommunicationsNumberTypes.SingleOrDefault(entity => entity.Name == TelecommunicationsNumberType.BusinessPhoneNumberType.Name);

            var secondaryNumber = party.Addresses.FirstOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == addressTypTelecom.Id
                && entity.TelecommunicationsNumber.TypeId.Value == telecomNumberTypeBusinessPhoneNumber.Id && entity.TelecommunicationsNumber != null
                && entity.TelecommunicationsNumber.IsPrimary == false);

            if (secondaryNumber != null)
            {
                var sN = secondaryNumber.TelecommunicationsNumber;
                secPhoneNUmber = postalAddress.Country.CountryTelephoneCode + " " + "(" + sN.AreaCode + ") " + sN.PhoneNumber + secPhoneNUmber;
            }

            return secPhoneNUmber;
        }
 public static TelecommunicationsNumber GetCurrentTelecommNumberAddress(Party party, TelecommunicationsNumberType type, bool isPrimaryTelecommunicationNumber)
 {
     Address address = party.Addresses.FirstOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == AddressType.TelecommunicationNumberType.Id
         && entity.TelecommunicationsNumber.TelecommunicationsNumberType.Id == type.Id && entity.TelecommunicationsNumber.IsPrimary == isPrimaryTelecommunicationNumber);
     if (address != null)
         return address.TelecommunicationsNumber;
     return null;
 }
示例#22
0
        public static PostalAddress SetAndGetPostalAddress(Party party)
        {
            var postalAddressType = PostalAddressType.BusinessAddressType.Name;
            var addressType = ObjectContext.AddressTypes.First(entity => entity.Name.Equals("Postal Address"));
            InitialDatabaseValueChecker.ThrowIfNull<AddressType>(addressType);
            var address = party.Addresses.FirstOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == addressType.Id &&
                                entity.PostalAddress.PostalAddressType.Name == postalAddressType && entity.PostalAddress.IsPrimary == true);
            var pa = address.PostalAddress;

            return pa;
        }
        public static void CreateOrUpdatePostalAddress(Party party, PostalAddress newPostalAddress, PostalAddressType addressType, DateTime now, bool isPrimary)
        {
            var address = party.Addresses.SingleOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == AddressType.PostalAddressType.Id
                                                            && entity.PostalAddress.PostalAddressTypeId == addressType.Id
                                                            && entity.PartyId == party.Id
                                                            && entity.PostalAddress.IsPrimary == isPrimary);

            newPostalAddress.Barangay = string.IsNullOrWhiteSpace(newPostalAddress.Barangay) ? null : newPostalAddress.Barangay;
            newPostalAddress.StreetAddress = string.IsNullOrWhiteSpace(newPostalAddress.StreetAddress) ? null : newPostalAddress.StreetAddress;
            newPostalAddress.City = string.IsNullOrWhiteSpace(newPostalAddress.City) ? null : newPostalAddress.City;
            newPostalAddress.Municipality = string.IsNullOrWhiteSpace(newPostalAddress.Municipality) ? null : newPostalAddress.Municipality;
            newPostalAddress.PostalCode = string.IsNullOrWhiteSpace(newPostalAddress.PostalCode) ? null : newPostalAddress.PostalCode;
            newPostalAddress.Province = string.IsNullOrWhiteSpace(newPostalAddress.Province) ? null : newPostalAddress.Province;
            newPostalAddress.State = string.IsNullOrWhiteSpace(newPostalAddress.State) ? null : newPostalAddress.State;

            bool isNull = true;

            isNull &= newPostalAddress.Barangay == null;
            isNull &= newPostalAddress.City == null;
            isNull &= newPostalAddress.Municipality == null;
            isNull &= newPostalAddress.PostalCode == null;
            isNull &= newPostalAddress.Province == null;
            isNull &= (newPostalAddress.CountryId == null || newPostalAddress.CountryId == 0);

            if (isNull)
            {
                if (newPostalAddress.EntityState == System.Data.EntityState.Added)
                    Context.Detach(newPostalAddress);
                return;
            }

            bool isEqual = false;
            if (address != null)
            {
                isEqual = true;

                var currentPostalAddress = address.PostalAddress;
                isEqual = isEqual && currentPostalAddress.Barangay == newPostalAddress.Barangay;
                isEqual = isEqual && currentPostalAddress.StreetAddress == newPostalAddress.StreetAddress;
                isEqual = isEqual && currentPostalAddress.CountryId == newPostalAddress.CountryId;
                isEqual = isEqual && currentPostalAddress.City == newPostalAddress.City;
                isEqual = isEqual && currentPostalAddress.Municipality == newPostalAddress.Municipality;
                isEqual = isEqual && currentPostalAddress.PostalCode == newPostalAddress.PostalCode;
                isEqual = isEqual && currentPostalAddress.Province == newPostalAddress.Province;
                isEqual = isEqual && currentPostalAddress.State == newPostalAddress.State;

                if (isEqual == false)
                    address.EndDate = now;
            }

            if (isEqual == false)
            {
                Address newAddress = new Address();
                newAddress.Party = party;
                newAddress.AddressType = AddressType.PostalAddressType;
                newAddress.EffectiveDate = now;

                newPostalAddress.Address = newAddress;
                newPostalAddress.PostalAddressType = addressType;
                Context.PostalAddresses.AddObject(newPostalAddress);
            }
            else
            {
                if (newPostalAddress.EntityState == System.Data.EntityState.Added)
                    Context.Detach(newPostalAddress);
            }
        }
 public static PostalAddress GetCurrentPostalAddressV2(Party party, PostalAddressType type, Func<PostalAddress, bool> condition)
 {
     PostalAddress postalAddress = Context.PostalAddresses.SingleOrDefault(entity => entity.Address.PartyId == party.Id &&
         entity.Address.EndDate == null && entity.PostalAddressTypeId == type.Id && condition(entity));
     return postalAddress;
 }
 public static PostalAddress GetCurrentPostalAddress(Party party, PostalAddressType type, bool IsPrimaryPostalAddress)
 {
     Address address = party.Addresses.SingleOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == AddressType.PostalAddressType.Id
             && entity.PostalAddress.PostalAddressTypeId == type.Id && entity.PostalAddress.IsPrimary == IsPrimaryPostalAddress);
     if (address != null)
         return address.PostalAddress;
     return null;
 }
 public static PostalAddress GetCurrentPostalAddress(Party party, PostalAddressType type, Asset asset)
 {
     Address address = party.Addresses.SingleOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == AddressType.PostalAddressType.Id
             && entity.PostalAddress.PostalAddressTypeId == type.Id && entity.AssetId == asset.Id);
     if (address != null)
         return address.PostalAddress;
     return null;
 }
 public static TelecommunicationsNumber GetCurrentTelecommNumberAddressV2(Party party, TelecommunicationsNumberType type, Func<TelecommunicationsNumber, bool> condition)
 {
     TelecommunicationsNumber telecomAddress = Context.TelecommunicationsNumbers.SingleOrDefault(entity => entity.Address.PartyId == party.Id &&
         entity.Address.EndDate == null && entity.TelecommunicationsNumberType.Id == type.Id && condition(entity));
     if(telecomAddress != null)
         return telecomAddress;
     return null;
 }
        public PostalAddress SetAndGetPostalAddress(Party party)
        {
            var postalAddressType = PostalAddressType.BusinessAddressType.Name;
            var addressType = ObjectContext.AddressTypes.First(entity => entity.Name.Equals("Postal Address"));
            InitialDatabaseValueChecker.ThrowIfNull<AddressType>(addressType);
            var address = party.Addresses.FirstOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == addressType.Id &&
                                entity.PostalAddress.PostalAddressType.Name == postalAddressType && entity.PostalAddress.IsPrimary == true);
            var pa = address.PostalAddress;

            if (!string.IsNullOrWhiteSpace(pa.StreetAddress))
            {
                lblStreetAddress.Text = pa.StreetAddress + ",";
            }

            lblBarangay.Text = pa.Barangay;
            lblCity.Text = pa.City;
            lblMunicipality.Text = pa.Municipality;
            lblProvince.Text = pa.Province;
            lblCountry.Text = pa.Country.Name;
            lblPostalCode.Text = pa.PostalCode;

            return pa;
        }
        public static TelecommunicationsNumber CreateTelecommNumberAddress(Party party, TelecommunicationsNumberType type, DateTime now)
        {
            Address address = new Address();
            address.Party = party;
            address.AddressType = AddressType.TelecommunicationNumberType;
            address.EffectiveDate = now;

            TelecommunicationsNumber telecomAddress = new TelecommunicationsNumber();
            telecomAddress.Address = address;
            telecomAddress.TelecommunicationsNumberType = type;
            return telecomAddress;
        }
        public static PostalAddress CreatePostalAddress(Party party, PostalAddressType type, DateTime now)
        {
            Address address = new Address();
            address.Party = party;
            address.AddressType = AddressType.PostalAddressType;
            address.EffectiveDate = now;

            PostalAddress postalAddress = new PostalAddress();
            postalAddress.Address = address;
            postalAddress.PostalAddressType = type;
            return postalAddress;
        }