private void CreateOrUpdatePostalAddress(Party party, Country country, DateTime today)
        {
            AddressType addressType = AddressType.PostalAddressType;
            PostalAddressType postalAddressType = PostalAddressType.BusinessAddressType;

            //Create an Address with AddressType as Postal Address
            PostalAddress newPostalAddress = new PostalAddress();
            newPostalAddress.Country = country;
            newPostalAddress.Barangay = hiddenBarangay.Text;
            newPostalAddress.PostalCode = hiddenPostalCode.Text;
            newPostalAddress.Province = hiddenProvince.Text;
            newPostalAddress.City = hiddenCity.Text;
            newPostalAddress.Municipality = hiddenMunicipality.Text;
            newPostalAddress.StreetAddress = hiddenStreet.Text;
            newPostalAddress.IsPrimary = true;

            PostalAddress.CreateOrUpdatePostalAddress(party, newPostalAddress, postalAddressType, today, true);
        }
Exemplo n.º 2
0
        private void CreateOrUpdateTelecommuncationNumber(FinancialEntities context, Party party, Country country, DateTime today)
        {
            var addressType = AddressType.TelecommunicationNumberType;
            var businessNumberAddressType = TelecommunicationsNumberType.BusinessPhoneNumberType;
            var faxNumberAddressType = TelecommunicationsNumberType.BusinessFaxNumberType;

                TelecommunicationsNumber newTelNum = new TelecommunicationsNumber();
                newTelNum.IsPrimary = true;
                newTelNum.AreaCode = txtAreaCode.Text;
                newTelNum.PhoneNumber = txtPhoneNum.Text;
                newTelNum.TelecommunicationsNumberType = businessNumberAddressType;
                TelecommunicationsNumber.CreateOrUpdateTeleCommNumberAddress(party, newTelNum, businessNumberAddressType, today, true);

                TelecommunicationsNumber newFaxNum = new TelecommunicationsNumber();
                newFaxNum.IsPrimary = true;
                newFaxNum.AreaCode = txtFaxAreaCode.Text;
                newFaxNum.PhoneNumber = txtFaxNum.Text;
                newFaxNum.TelecommunicationsNumberType = faxNumberAddressType;
                TelecommunicationsNumber.CreateOrUpdateTeleCommNumberAddress(party, newFaxNum, faxNumberAddressType, today, true);
        }
        private void CreateOrUpdateContactInfo(Party party, Country country, DateTime today)
        {
            TelecommunicationsNumber faxNumber = new TelecommunicationsNumber();
            faxNumber.AreaCode = this.txtFaxAreacode.Text;
            faxNumber.PhoneNumber = this.txtFaxNumber.Text;
            faxNumber.TelecommunicationsNumberType = TelecommunicationsNumberType.BusinessFaxNumberType;
            faxNumber.IsPrimary = true;
            TelecommunicationsNumber.CreateOrUpdateTeleCommNumberAddress(party, faxNumber,
                TelecommunicationsNumberType.BusinessFaxNumberType, today, true);

            TelecommunicationsNumber telephoneNumber = new TelecommunicationsNumber();
            telephoneNumber.AreaCode = this.txtTelephoneAreaCode.Text;
            telephoneNumber.PhoneNumber = this.txtTelephoneNumber.Text;
            telephoneNumber.TelecommunicationsNumberType = TelecommunicationsNumberType.BusinessPhoneNumberType;
            telephoneNumber.IsPrimary = true;
            TelecommunicationsNumber.CreateOrUpdateTeleCommNumberAddress(party, telephoneNumber,
                TelecommunicationsNumberType.BusinessPhoneNumberType, today, true);

            ElectronicAddress emailAddress = new ElectronicAddress();
            emailAddress.ElectronicAddressString = txtEmailAddress.Text;
            emailAddress.IsPrimary = true;

            ElectronicAddress.CreateOrUpdateElectronicAddress(party, emailAddress,
                ElectronicAddressType.BusinessEmailAddressType, entity => entity.ElectronicAddress.IsPrimary, today);
        }
        private void CreateOrUpdateContactInfo(Party party, Country country, DateTime today)
        {
            TelecommunicationsNumber cellNumber = new TelecommunicationsNumber();
            cellNumber.AreaCode = this.txtCellphoneAreaCode.Text;
            cellNumber.PhoneNumber = this.txtCellphoneNumber.Text;
            cellNumber.TelecommunicationsNumberType = TelecommunicationsNumberType.PersonalMobileNumberType;
            cellNumber.IsPrimary = true;
            TelecommunicationsNumber.CreateOrUpdateTeleCommNumberAddress(party, cellNumber,
                TelecommunicationsNumberType.PersonalMobileNumberType, today, true);

            TelecommunicationsNumber telephoneNumber = new TelecommunicationsNumber();
            telephoneNumber.AreaCode = this.txtTelephoneAreaCode.Text;
            telephoneNumber.PhoneNumber = this.txtTelephoneNumber.Text;
            telephoneNumber.TelecommunicationsNumberType = TelecommunicationsNumberType.HomePhoneNumberType;
            telephoneNumber.IsPrimary = true;

            TelecommunicationsNumber.CreateOrUpdateTeleCommNumberAddress(party, telephoneNumber,
                TelecommunicationsNumberType.HomePhoneNumberType, today, true);

            ElectronicAddress emailAddress = new ElectronicAddress();
            emailAddress.ElectronicAddressString = txtEmailAddress.Text;
            emailAddress.IsPrimary = true;

            ElectronicAddress.CreateOrUpdateElectronicAddress(party, emailAddress,
                ElectronicAddressType.PersonalEmailAddressType, entity => entity.ElectronicAddress.IsPrimary, today);
        }
Exemplo n.º 5
0
 public bool AreChosenHoursInParkingHourRange(DateTime hour)
 {
     return(hour.TimeOfDay >= Country.GetMinimumStartingHour().TimeOfDay &&
            hour.TimeOfDay <= Country.GetMaximumHour().TimeOfDay);
 }
        private void CreateOrUpdateTelecommuncationNumber(FinancialEntities ctx, Party party, Country country, DateTime today)
        {
            var addressType = ctx.AddressTypes.First(entity => entity.Name.Equals("Telecommunication Number"));
            var businessNumberAddressType = ctx.TelecommunicationsNumberTypes.SingleOrDefault(entity => entity.Name.Equals("Business Phone Number"));
            var faxNumberAddressType = ctx.TelecommunicationsNumberTypes.SingleOrDefault(entity => entity.Name.Equals("Business Fax Number"));

            InitialDatabaseValueChecker.ThrowIfNull<AddressType>(addressType);
            InitialDatabaseValueChecker.ThrowIfNull<TelecommunicationsNumberType>(faxNumberAddressType);
            InitialDatabaseValueChecker.ThrowIfNull<TelecommunicationsNumberType>(businessNumberAddressType);

            bool primaryNumberIsEqual = false;
            var primaryNumber = party.Addresses.FirstOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == addressType.Id
                    && entity.TelecommunicationsNumber.TypeId.Value == businessNumberAddressType.Id && entity.TelecommunicationsNumber != null
                    && entity.TelecommunicationsNumber.IsPrimary);
            if (primaryNumber != null)
            {
                primaryNumberIsEqual = IsEqual(primaryNumber.TelecommunicationsNumber, txtPrimTelAreaCode.Text, txtPrimTelPhoneNumber.Text);

                if (primaryNumberIsEqual == false)
                    primaryNumber.EndDate = today;
            }

            if(primaryNumberIsEqual == false)
            {
                //Create Primary Telecommunication Number
                if (string.IsNullOrWhiteSpace(txtPrimTelPhoneNumber.Text) == false)
                {
                    Address newAddressAsPrimTelecom = AddressBusinessUtility.AddAddress(party, addressType, today);
                    TelecommunicationsNumber newPrimTelecomNumber = AddressBusinessUtility.AddTelNum(newAddressAsPrimTelecom, businessNumberAddressType, true);
                    newPrimTelecomNumber.AreaCode = txtPrimTelAreaCode.Text;
                    newPrimTelecomNumber.PhoneNumber = txtPrimTelPhoneNumber.Text;
                }
            }
            /*******************************************************************************************************************/
            bool secondaryNumberIsEqual = false;
            var secondaryNumber = party.Addresses.FirstOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == addressType.Id
                    && entity.TelecommunicationsNumber.TypeId.Value == businessNumberAddressType.Id && entity.TelecommunicationsNumber != null
                    && entity.TelecommunicationsNumber.IsPrimary == false);
            if (secondaryNumber != null)
            {
                secondaryNumberIsEqual = IsEqual(secondaryNumber.TelecommunicationsNumber, txtSecTelAreaCode.Text, txtSecTelPhoneNumber.Text);

                if (secondaryNumberIsEqual == false)
                    secondaryNumber.EndDate = today;
            }

            if (secondaryNumberIsEqual == false)
            {
                //Create Secondary Telecommunication Number
                if (string.IsNullOrWhiteSpace(txtSecTelPhoneNumber.Text) == false)
                {
                    Address newAddressAsSecTelecom = AddressBusinessUtility.AddAddress(party, addressType, today);
                    TelecommunicationsNumber newSecTelecomNumber = AddressBusinessUtility.AddTelNum(newAddressAsSecTelecom, businessNumberAddressType, false);
                    newSecTelecomNumber.AreaCode = txtSecTelAreaCode.Text;
                    newSecTelecomNumber.PhoneNumber = txtSecTelPhoneNumber.Text;
                }
            }
            /*******************************************************************************************************************/
            bool faxNumberIsEqual = false;
            var faxNumber = party.Addresses.FirstOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == addressType.Id
                    && entity.TelecommunicationsNumber.TypeId.Value == faxNumberAddressType.Id && entity.TelecommunicationsNumber.IsPrimary);
            if (faxNumber != null)
            {
                faxNumberIsEqual = IsEqual(faxNumber.TelecommunicationsNumber, txtFaxAreaCode.Text, txtFaxPhoneNumber.Text);

                if (faxNumberIsEqual == false)
                    faxNumber.EndDate = today;
            }

            if (faxNumberIsEqual == false)
            {
                //Create Fax Number
                if (string.IsNullOrWhiteSpace(txtFaxPhoneNumber.Text)==false)
                {
                    Address newAddressAsFaxNumber = AddressBusinessUtility.AddAddress(party, addressType, today);
                    TelecommunicationsNumber newfaxTelecomNumber = AddressBusinessUtility.AddTelNum(newAddressAsFaxNumber, faxNumberAddressType, true);
                    newfaxTelecomNumber.AreaCode = txtFaxAreaCode.Text;
                    newfaxTelecomNumber.PhoneNumber = txtFaxPhoneNumber.Text;
                }
            }
        }
        private void CreateOrUpdateElectronicAddress(FinancialEntities ctx, Party party, Country country, DateTime today)
        {
            var addressType = ctx.AddressTypes.First(entity => entity.Name.Equals("Electronic Address"));
            var electronicAddressType = ctx.ElectronicAddressTypes.SingleOrDefault(entity => entity.Name.Equals("Business Email Address"));

            InitialDatabaseValueChecker.ThrowIfNull<AddressType>(addressType);
            InitialDatabaseValueChecker.ThrowIfNull<ElectronicAddressType>(electronicAddressType);

            bool isEqual = false;
            var address = party.Addresses.FirstOrDefault(entity => entity.EndDate == null && entity.AddressTypeId == addressType.Id && entity.ElectronicAddress.IsPrimary);
            if (address != null)
            {
                isEqual = true;
                var electronicAddress = address.ElectronicAddress;
                isEqual = electronicAddress.ElectronicAddressString == txtEmailAddress.Text;

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

            if (isEqual == false)
            {
                //Create Electronic Address
                Address newAddressAsEmail = AddressBusinessUtility.AddAddress(party, addressType, today);
                ElectronicAddress newEmailAddress = AddressBusinessUtility.AddEmail(newAddressAsEmail, electronicAddressType, true);
                newEmailAddress.ElectronicAddressString = txtEmailAddress.Text;
            }
        }
Exemplo n.º 8
0
        public Reserve(string NumberPhone, string LicencePlate, int numberOfMinutes, DateTime startTime, Country country)
        {
            this.numberPhone     = NumberPhone;
            this.licencePlate    = LicencePlate;
            this.numberOfMinutes = numberOfMinutes;
            this.country         = country;
            this.startTime       = startTime;
            DateTime afterStart = startTime;

            endTime = startTime.AddMinutes(numberOfMinutes);
        }
Exemplo n.º 9
0
        //New Cellphone Number
        protected void CreateTelecomeNumber(Address Address, 
                                            TelecommunicationsNumberType TelecomNumberType, 
                                            Country Country, 
                                            string AreaCode,
                                            string PhoneNumber)
        {
            if (string.IsNullOrWhiteSpace(AreaCode) && string.IsNullOrWhiteSpace(PhoneNumber))
            {
                ObjectContext.Detach(Address);
                return;
            }
            TelecommunicationsNumber NewTelecomNumber = new TelecommunicationsNumber();
            NewTelecomNumber.Address = Address;
            NewTelecomNumber.TelecommunicationsNumberType = TelecomNumberType;
            NewTelecomNumber.AreaCode = AreaCode;
            NewTelecomNumber.PhoneNumber = PhoneNumber;
            NewTelecomNumber.IsPrimary = true;

            ObjectContext.TelecommunicationsNumbers.AddObject(NewTelecomNumber);
        }
Exemplo n.º 10
0
        //New Postal Address
        protected void CreatePostalAddress(Address Address, 
                                            PostalAddressType PostalAddressType, 
                                            Country Country, 
                                            string StreetAddress, 
                                            string Barangay, 
                                            string Municipality, 
                                            string City, 
                                            string Province, 
                                            string State, 
                                            string PostalCode)
        {
            PostalAddress NewPostalAddress = new PostalAddress();
            NewPostalAddress.Address = Address;
            NewPostalAddress.PostalAddressType = PostalAddressType;
            NewPostalAddress.Country = Country;

            if (string.IsNullOrWhiteSpace(StreetAddress)) NewPostalAddress.StreetAddress = null;
            else NewPostalAddress.StreetAddress = StreetAddress;

            NewPostalAddress.Barangay = Barangay;

            if (string.IsNullOrWhiteSpace(Municipality)) NewPostalAddress.Municipality = null;
            else NewPostalAddress.Municipality = Municipality;

            if (string.IsNullOrWhiteSpace(City)) NewPostalAddress.City = null;
            else NewPostalAddress.City = City;

            if (string.IsNullOrWhiteSpace(Province)) NewPostalAddress.Province = null;
            else NewPostalAddress.Province = Province;

            if (string.IsNullOrWhiteSpace(State)) NewPostalAddress.State = null;
            else NewPostalAddress.State = State;

            NewPostalAddress.PostalCode = PostalCode;
            NewPostalAddress.IsPrimary = true;

            ObjectContext.PostalAddresses.AddObject(NewPostalAddress);
        }