protected void GridProviderContactView_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            List <ProviderContact> providercontacts = (List <ProviderContact>)GridProviderContactView.DataSource;
            string          id = e.Keys[0].ToString();
            ProviderContact providercontact = providercontacts.Find(m => m.Id == id);
            var             newValue        = e.NewValues;

            providercontact.Department  = newValue["Department"].ToString() ?? string.Empty;
            providercontact.Email       = newValue["Email"].ToString() ?? string.Empty;
            providercontact.FirstName   = newValue["FirstName"].ToString() ?? string.Empty;
            providercontact.LastName    = newValue["LastName"].ToString() ?? string.Empty;
            providercontact.MobilePhone = newValue["MobilePhone"].ToString() ?? string.Empty;
            providercontact.Phone       = newValue["Phone"].ToString() ?? string.Empty;


            var model = controller.GetData(ModelId);

            model.Contacts = providercontacts;
            controller.Update(model);

            e.Cancel = true;
            GridProviderContactView.CancelEdit();

            GridProviderContactView.DataSource = providercontacts;
            GridProviderContactView.DataBind();
        }
예제 #2
0
        public static CoreViewModel GetProviderById(string id)
        {
            List <ProviderContact> list = new List <ProviderContact>();

            var manager    = PlugInManager.GetBookingDataManager();
            var bp         = manager.GetBookingProcess(id);
            int providerid = bp.AccProvider;
            var provider   = manager.GetProviderForProviderId(providerid);

            CoreViewModel m = new CoreViewModel();


            m.Id       = provider.Id;
            m.Address  = provider.Address;
            m.Country  = provider.Country;
            m.Bank     = provider.Bank;
            m.City     = provider.City;
            m.Contacts = provider.Contacts;
            m.IBAN     = provider.IBAN;
            m.Name     = provider.Name;
            m.PersonalIdentificationNumber = provider.PersonalIdentificationNumber;
            m.Notes         = provider.Notes;
            m.ProviderId    = provider.ProviderId;
            m.Title         = provider.Title;
            m.BookingEmail  = provider.BookingEmail;
            m.Cancellations = provider.Cancellations;

            list = m.Contacts;

            ProviderContact contact = new ProviderContact();

            contact.Email = provider.BookingEmail;

            list.Add(contact);

            m.Contacts = list;

            int counter = 0;

            foreach (var item in m.Contacts)
            {
                item.Id = (++counter).ToString();
            }
            counter = 0;
            foreach (var item in m.Notes)
            {
                item.Id = (++counter).ToString();
            }
            foreach (var item in m.Cancellations)
            {
                item.Id = (++counter).ToString();
            }

            return(m);
        }
        public async Task <IActionResult> Create([Bind("ProviderContactID,providerID,firstName,lastName,contactEmail,roleIdentID,contactTelNum")] ProviderContact providerContact)
        {
            if (ModelState.IsValid)
            {
                _context.Add(providerContact);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["providerID"] = new SelectList(_context.Providers, "ProviderID", "ProviderID", providerContact.providerID);
            return(View(providerContact));
        }
예제 #4
0
        private ProviderContact DeserializeProviderContent(XElement providerContactElement)
        {
            if (providerContactElement == null)
            {
                return(null);
            }

            var contactAddressElement         = providerContactElement.Element("ContactAddress");
            var contactPersonalDetailsElement = providerContactElement.Element("ContactPersonalDetails");

            var providerContact = new ProviderContact
            {
                ContactAddress         = new AddressStructure(),
                ContactPersonalDetails = new PersonNameStructure(),
            };

            providerContact.ContactType = providerContactElement.Element("ContactType").Value;

            providerContact.ContactAddress.Address1 = contactAddressElement?.Element("Address1")?.Value;
            providerContact.ContactAddress.Address2 = contactAddressElement?.Element("Address2")?.Value;
            providerContact.ContactAddress.Address3 = contactAddressElement?.Element("Address3")?.Value;
            providerContact.ContactAddress.Address4 = contactAddressElement?.Element("Address4")?.Value;
            providerContact.ContactAddress.Town     = contactAddressElement?.Element("Town")?.Value;
            providerContact.ContactAddress.County   = contactAddressElement?.Element("County")?.Value;
            providerContact.ContactAddress.PostCode = contactAddressElement?.Element("PostCode")?.Value;

            providerContact.ContactPersonalDetails.PersonNameTitle     = contactPersonalDetailsElement?.Element(GovTalkNs + "PersonNameTitle")?.Value;
            providerContact.ContactPersonalDetails.PersonGivenName     = contactPersonalDetailsElement?.Element(GovTalkNs + "PersonGivenName")?.Value;
            providerContact.ContactPersonalDetails.PersonFamilyName    = contactPersonalDetailsElement?.Element(GovTalkNs + "PersonFamilyName")?.Value;
            providerContact.ContactPersonalDetails.PersonNameSuffix    = contactPersonalDetailsElement?.Element(GovTalkNs + "PersonNameSuffix")?.Value;
            providerContact.ContactPersonalDetails.PersonRequestedName = contactPersonalDetailsElement?.Element(GovTalkNs + "PersonRequestedName")?.Value;

            providerContact.ContactRole           = providerContactElement.Element("ContactRole")?.Value;
            providerContact.ContactTelephone1     = providerContactElement.Element("ContactTelephone1")?.Value;
            providerContact.ContactTelephone2     = providerContactElement.Element("ContactTelephone2")?.Value;
            providerContact.ContactFax            = providerContactElement.Element("ContactFax")?.Value;
            providerContact.ContactWebsiteAddress = providerContactElement.Element("ContactWebsiteAddress")?.Value;
            providerContact.ContactEmail          = providerContactElement.Element("ContactEmail")?.Value;
            providerContact.LastUpdated           = providerContactElement.Element("LastUpdated") != null
                ? (DateTime?)DateTime.Parse(providerContactElement.Element("LastUpdated").Value)
                : null;

            return(providerContact);
        }
        private bool AreSame(ProviderContact current, ProviderContact staging)
        {
            if (current?.ContactRole != staging?.ContactRole ||
                current?.ContactTelephone1 != staging?.ContactTelephone1 ||
                current?.ContactTelephone2 != staging?.ContactTelephone2 ||
                current?.ContactFax != staging?.ContactFax ||
                current?.ContactWebsiteAddress != staging?.ContactWebsiteAddress ||
                current?.ContactEmail != staging?.ContactEmail)
            {
                return(false);
            }

            if (!AreSame(current?.ContactAddress, staging?.ContactAddress))
            {
                return(false);
            }

            return(AreSame(current?.ContactPersonalDetails, staging?.ContactPersonalDetails));
        }
예제 #6
0
        protected void GridProviderContactView_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            List <ProviderContact> providercontacts = (List <ProviderContact>)GridProviderContactView.DataSource;
            string          id = e.Keys[0].ToString();
            ProviderContact providercontact = providercontacts.Find(m => m.Id == id);

            providercontacts.Remove(providercontact);


            var model = Controller.GetData(ModelId);

            model.Contacts = providercontacts;
            Controller.Update(model);

            e.Cancel = true;
            GridProviderContactView.CancelEdit();

            GridProviderContactView.DataSource = providercontacts;
            GridProviderContactView.DataBind();
        }
        public void Update(ProviderContact entity)
        {
            var providerContacts = (from proCon in _context.ProviderContacts
                                    where proCon.ProviderId == entity.ProviderId
                                    select proCon).FirstOrDefault();

            if (providerContacts != null)
            {
                providerContacts.ProviderId     = entity.ProviderId;
                providerContacts.PrimaryPhone   = entity.PrimaryPhone;
                providerContacts.PrimaryEmail   = entity.PrimaryEmail;
                providerContacts.SecondaryPhone = entity.SecondaryPhone;
                providerContacts.SecondaryEmail = entity.SecondaryEmail;
                providerContacts.WebsiteAddress = entity.WebsiteAddress;
            }
            else
            {
                _context.ProviderContacts.Add(entity);
            }
        }
예제 #8
0
        private void AssertContactMapping(ProviderContact actualContact, ProviderContactStructure ukrlpContact)
        {
            actualContact.ContactType.Should().Be(ukrlpContact.ContactType);
            actualContact.ContactRole.Should().Be(ukrlpContact.ContactRole);
            actualContact.ContactTelephone1.Should().Be(ukrlpContact.ContactTelephone1);
            actualContact.ContactWebsiteAddress.Should().Be(ukrlpContact.ContactWebsiteAddress);
            actualContact.ContactEmail.Should().Be(ukrlpContact.ContactEmail);
            actualContact.ContactFax.Should().Be(ukrlpContact.ContactFax);
            actualContact.LastUpdated.Should().Be(Clock.UtcNow);
            actualContact.AdditionalData.Should().BeNull();
            actualContact.ContactPersonalDetails.Should().NotBeNull();

            var actualContactAddress = actualContact.ContactAddress;

            actualContactAddress.SAON.Description.Should().Be(ukrlpContact.ContactAddress.Address1);
            actualContactAddress.PAON.Description.Should().Be(ukrlpContact.ContactAddress.Address2);
            actualContactAddress.StreetDescription.Should().Be(ukrlpContact.ContactAddress.Address3);
            actualContactAddress.Locality.Should().Be(ukrlpContact.ContactAddress.Address4);

            // Town is still mapped to items as it was in the v3 client to minimize change in data
            actualContactAddress.PostTown.Should().BeNull();
            actualContactAddress.Items.Should().BeEquivalentTo(new List <string>
            {
                ukrlpContact.ContactAddress.Town,
                ukrlpContact.ContactAddress.County,
            });

            actualContactAddress.PostCode.Should().Be(ukrlpContact.ContactAddress.PostCode);
            actualContactAddress.AdditionalData.Should().BeNull();

            var actualPersonalDetails = actualContact.ContactPersonalDetails;

            actualPersonalDetails.PersonNameTitle.SingleOrDefault().Should().Be(ukrlpContact.ContactPersonalDetails.PersonNameTitle.Single());
            actualPersonalDetails.PersonGivenName.SingleOrDefault().Should().Be(ukrlpContact.ContactPersonalDetails.PersonGivenName.Single());
            actualPersonalDetails.PersonFamilyName.Should().Be(ukrlpContact.ContactPersonalDetails.PersonFamilyName);
            actualPersonalDetails.AdditionalData.Should().BeNull();
        }