コード例 #1
0
        public void Merge2()
        {
            ContactSet set1 = ContactSet.Create(new CollisionObject(), new CollisionObject());
            ContactSet set2 = ContactSet.Create(set1.ObjectA, set1.ObjectB);

            Contact contact = Contact.Create();

            contact.Position = new Vector3F(1, 2, 3);
            set2.Add(contact);

            ContactHelper.Merge(set2, set1, CollisionQueryType.Contacts, 0.01f);
            Assert.AreEqual(1, set2.Count);

            contact          = Contact.Create();
            contact.Position = new Vector3F(1, 2, 3);
            set1.Add(contact);

            contact          = Contact.Create();
            contact.Position = new Vector3F(2, 2, 3);
            set1.Add(contact);

            contact          = Contact.Create();
            contact.Position = new Vector3F(3, 2, 3);
            set1.Add(contact);

            ContactHelper.Merge(set2, set1, CollisionQueryType.Contacts, 0.01f);
            Assert.AreEqual(3, set2.Count);
        }
コード例 #2
0
        public IActionResult Index(Contact contact)
        {
            ContactHelper helper = new ContactHelper();

            helper.sendEmail(contact);
            return(RedirectToAction("FormSubmitted", "ContactUs"));
        }
コード例 #3
0
        public void GetContactEntityForCustomerPayload_PopulateEmail()
        {
            // Given
            var customer = new Customer
            {
                CustomerIdentifier = new CustomerIdentifier {
                    CustomerId = "Test customer"
                },
                Email = new[]
                {
                    new Email
                    {
                        Address = "*****@*****.**"
                    },
                    new Email
                    {
                        Address = "*****@*****.**"
                    },
                    new Email
                    {
                        Address = "*****@*****.**"
                    }
                }
            };

            // When
            var contact = ContactHelper.GetContactEntityForCustomerPayload(customer, tracingService);

            // Then
            Assert.AreEqual(customer.Email[0].Address, contact[Attributes.Contact.EmailAddress1].ToString());
            Assert.AreEqual(customer.Email[1].Address, contact[Attributes.Contact.EmailAddress2].ToString());
            Assert.AreEqual(customer.Email[2].Address, contact[Attributes.Contact.EmailAddress3].ToString());
        }
コード例 #4
0
        public void GetContactEntityForCustomerPayload_PopulateIdentity()
        {
            // Given
            var customer = new Customer
            {
                CustomerIdentifier = new CustomerIdentifier {
                    CustomerId = "Test customer"
                },
                CustomerIdentity = new CustomerIdentity
                {
                    AcademicTitle = "PhD",
                    Birthdate     = "1982-10-08",
                    FirstName     = "John",
                    Gender        = Gender.Male,
                    Language      = "Language",
                    LastName      = "Doe",
                    Salutation    = "Mr"
                }
            };

            // When
            var contact = ContactHelper.GetContactEntityForCustomerPayload(customer, tracingService);

            // Then
            Assert.AreEqual(customer.CustomerIdentity.FirstName, contact[Attributes.Contact.FirstName].ToString());
            Assert.AreEqual(customer.CustomerIdentity.LastName, contact[Attributes.Contact.LastName].ToString());
            Assert.AreEqual(950000006, ((OptionSetValue)contact[Attributes.Contact.Language]).Value);
            Assert.AreEqual(950000000, ((OptionSetValue)contact[Attributes.Contact.Salutation]).Value);
        }
コード例 #5
0
        public void GetContactEntityForCustomerPayload_PopulatePermission()
        {
            // Given
            var customer = new Customer
            {
                CustomerIdentifier = new CustomerIdentifier {
                    CustomerId = "Test customer"
                },
                Permissions = new Permissions
                {
                    AllowMarketing       = true,
                    DoNotAllowEmail      = true,
                    DoNotAllowMail       = true,
                    DoNotAllowPhoneCalls = true,
                    DoNotAllowSms        = true
                }
            };

            // When
            var contact = ContactHelper.GetContactEntityForCustomerPayload(customer, tracingService);

            // Then
            Assert.AreEqual(new OptionSetValue(950000001), contact[Attributes.Contact.MarketingByPhone]);
            Assert.AreEqual(new OptionSetValue(950000001), contact[Attributes.Contact.SendMarketingByEmail]);
            Assert.AreEqual(new OptionSetValue(950000001), contact[Attributes.Contact.SendMarketingByPost]);
            Assert.AreEqual(new OptionSetValue(950000000), contact[Attributes.Contact.ThomasCookMarketingConsent]);
            Assert.AreEqual(new OptionSetValue(950000001), contact[Attributes.Contact.SendMarketingBySms]);
        }
コード例 #6
0
        public void GetContactEntityForCustomerPayload_PopulatePhone()
        {
            // Given
            var customer = new Customer
            {
                CustomerIdentifier = new CustomerIdentifier {
                    CustomerId = "Test customer"
                },
                Phone = new[]
                {
                    new Phone
                    {
                        Number = "111-11-11"
                    },
                    new Phone
                    {
                        Number = "222-22-22"
                    },
                    new Phone
                    {
                        Number = "333-33-33"
                    }
                }
            };

            // When
            var contact = ContactHelper.GetContactEntityForCustomerPayload(customer, tracingService);

            // Then
            Assert.AreEqual(customer.Phone[0].Number, contact[Attributes.Contact.Telephone1].ToString());
            Assert.AreEqual(customer.Phone[1].Number, contact[Attributes.Contact.Telephone2].ToString());
            Assert.AreEqual(customer.Phone[2].Number, contact[Attributes.Contact.Telephone3].ToString());
        }
コード例 #7
0
        public async Task <ActionResult> Index()
        {
            try
            {
                var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "ContactsIndexPage");

                ContactHelper.StoreSettings = GetStoreSettings();
                ContactHelper.ImageWidth    = GetSettingValueInt("ContactsIndex_ImageWidth", 50);
                ContactHelper.ImageHeight   = GetSettingValueInt("ContactsIndex_ImageHeight", 50);
                var contactsTask = ContactService.GetContactsByStoreIdAsync(StoreId, null, true);

                await Task.WhenAll(pageDesignTask, contactsTask);

                var pageDesign = pageDesignTask.Result;
                var contacts   = contactsTask.Result;

                if (pageDesign == null)
                {
                    throw new Exception("PageDesing is null");
                }


                var pageOutput = ContactHelper.GetContactIndexPage(pageDesign, contacts);


                return(View(pageOutput));
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Index:" + ex.StackTrace);
                return(new HttpStatusCodeResult(500));
            }
        }
コード例 #8
0
        public async Task GivenTheSelectAssociatedServiceFormIsPresentedAsync()
        {
            var order = (Order)Context[ContextKeys.CreatedOrder];

            order.OrderingPartyContact = ContactHelper.Generate();

            var supplier = await DbContext.Supplier.SingleOrDefaultAsync(s => s.Id == "10000")
                           ?? (await SupplierInfo.GetSupplierWithId("10000", Test.BapiConnectionString)).ToDomain();

            var orderBuilder = new OrderBuilder(order)
                               .WithExistingSupplier(supplier)
                               .WithSupplierContact(ContactHelper.Generate());

            order = orderBuilder.Build();

            DbContext.Update(order);

            await DbContext.SaveChangesAsync();

            Context.Remove(ContextKeys.CreatedOrder);
            Context.Add(ContextKeys.CreatedOrder, order);

            WhenTheUserHasChosenToManageTheAssociatedServiceSection();
            new CommonSteps(Test, Context).WhenTheUserChoosesToAddAOrderItem();
        }
コード例 #9
0
        public async Task GivenAnIncompleteOrderWithCatalogueItemsExists()
        {
            await GivenAnIncompleteOrderExists();

            var order = Context.Get <Order>(ContextKeys.CreatedOrder);

            order.OrderingPartyContact = ContactHelper.Generate();
            order.CommencementDate     = DateTime.Today;

            var supplier = await DbContext.Supplier.SingleOrDefaultAsync(s => s.Id == "100000")
                           ?? (await SupplierInfo.GetSupplierWithId("100000", Test.BapiConnectionString)).ToDomain();

            var orderBuilder = new OrderBuilder(order)
                               .WithExistingSupplier(supplier)
                               .WithSupplierContact(ContactHelper.Generate());

            order = orderBuilder.Build();

            DbContext.Update(order);

            await DbContext.SaveChangesAsync();

            await GivenACatalogueSolutionWithAFlatPriceVariableDeclarativeOrderTypeIsSavedToTheOrder(100);

            Context.Remove(ContextKeys.CreatedOrder);
            Context.Add(ContextKeys.CreatedOrder, order);
        }
コード例 #10
0
    /// <summary>
    /// Actions handler.
    /// </summary>
    protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        // Check permission
        ContactHelper.AuthorizedModifyContact(SiteID, true);

        switch (e.CommandName.ToLowerCSafe())
        {
        // Save contact
        case "save":
            if (ValidateForm())
            {
                EditForm.SaveData(null);
                SetButtonsVisibility();
            }
            break;

        // Split from parent contact
        case "split":
            List <ContactInfo> mergedContact = new List <ContactInfo>(1)
            {
                (ContactInfo)CMSPage.EditedObject
            };
            ContactHelper.Split(parentContact, mergedContact, false, false, false, false);
            SetButtonsVisibility();
            ShowConfirmation(GetString("om.contact.splitted"));
            break;
        }
    }
コード例 #11
0
        public async Task GivenTheMinimumDataNeededToEnableTheFundingSourceSectionExists()
        {
            var commonSteps = new CommonSteps(Test, Context);
            await commonSteps.GivenAnIncompleteOrderExists();

            var order = (Order)Context[ContextKeys.CreatedOrder];

            order.OrderingPartyContact = ContactHelper.Generate();
            order.CommencementDate     = DateTime.Today;

            var supplier = await DbContext.Supplier.SingleOrDefaultAsync(s => s.Id == "100000")
                           ?? (await SupplierInfo.GetSupplierWithId("100000", Test.BapiConnectionString)).ToDomain();

            var orderBuilder = new OrderBuilder(order)
                               .WithExistingSupplier(supplier)
                               .WithSupplierContact(ContactHelper.Generate());

            order = orderBuilder.Build();

            DbContext.Update(order);

            await new AssociatedServices(Test, Context).GivenAnAssociatedServiceWithAFlatPriceDeclarativeOrderTypeIsSavedToTheOrder();

            await commonSteps.SetOrderCatalogueSectionToComplete();

            await commonSteps.SetOrderAdditionalServicesSectionToComplete();

            await commonSteps.SetOrderAssociatedServicesSectionToComplete();
        }
コード例 #12
0
        public void GetContactEntityForBookingPayload_PopulateIdentity()
        {
            Customer c = new Customer
            {
                CustomerIdentifier = new CustomerIdentifier
                {
                    BusinessArea = "Hotel",
                    CustomerId   = "CONT001",
                    SourceMarket = Guid.NewGuid().ToString(),
                    SourceSystem = "On Tour"
                },
                CustomerIdentity = new CustomerIdentity
                {
                    FirstName     = "Joe",
                    LastName      = "Blog",
                    AcademicTitle = "MS",
                    Birthdate     = "1982-10-08",
                    Gender        = Gender.Female,
                    Language      = "English",
                    MiddleName    = "Tom",
                    Salutation    = "Mr"
                }
            };
            var contact = ContactHelper.GetContactEntityForBookingPayload(c, trace);

            Assert.AreEqual(c.CustomerIdentity.AcademicTitle, contact[Attributes.Contact.AcademicTitle].ToString());
            Assert.AreEqual(c.CustomerIdentity.FirstName, contact[Attributes.Contact.FirstName].ToString());
            Assert.AreEqual(c.CustomerIdentity.LastName, contact[Attributes.Contact.LastName].ToString());
            Assert.AreEqual(c.CustomerIdentity.MiddleName, contact[Attributes.Contact.MiddleName].ToString());
            //checking for language which is not available in CRM
            Assert.AreEqual(950000006, ((OptionSetValue)(contact[Attributes.Contact.Language])).Value);
            Assert.AreEqual(950000000, ((OptionSetValue)(contact[Attributes.Contact.Salutation])).Value);
            Assert.AreEqual(950000001, ((OptionSetValue)(contact[Attributes.Contact.Gender])).Value);
        }
コード例 #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check read permission
        ContactHelper.AuthorizedReadContact(CMSContext.CurrentSiteID, true);

        string siteName = CMSContext.CurrentSiteName;

        // Get bounce limit
        mBounceLimit = NewsletterHelper.BouncedEmailsLimit(siteName);
        // Get info if bounced e-mail tracking is available
        mBounceInfoAvailable = NewsletterHelper.MonitorBouncedEmails(siteName);

        // Check if parent object exist
        SubscriberInfo sb = SubscriberInfoProvider.GetSubscriberInfo(QueryHelper.GetInteger("subscriberid", 0));

        EditedObject = sb;

        // Initialize unigrid
        UniGrid.OnAction            += uniGrid_OnAction;
        UniGrid.OnExternalDataBound += uniGrid_OnExternalDataBound;
        UniGrid.WhereCondition       = "ContactID IN (SELECT ContactGroupMemberRelatedID FROM OM_ContactGroupMember WHERE ContactGroupMemberContactGroupID = "
                                       + QueryHelper.GetInteger("groupid", 0) + " AND ContactGroupMemberType = 0) AND ContactSiteID = " + CMSContext.CurrentSiteID
                                       + " AND ContactMergedWithContactID IS NULL";
        UniGrid.ShowObjectMenu = false;
    }
コード例 #14
0
ファイル: Tab_IPs.aspx.cs プロジェクト: itymofieiev/Kentico9
    protected void Page_Load(object sender, EventArgs e)
    {
        ContactInfo ci = (ContactInfo)EditedObject;

        // Check permission read
        int siteID = ContactHelper.ObjectSiteID(EditedObject);

        CheckReadPermission(siteID);

        bool globalContact = (ci.ContactSiteID == 0);
        bool mergedContact = (ci.ContactMergedWithContactID > 0);

        listElem.ShowContactNameColumn = globalContact;
        listElem.ShowSiteNameColumn    = IsSiteManager && globalContact;
        listElem.ShowRemoveButton      = !mergedContact && !globalContact && ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, false);
        listElem.IsGlobalContact       = globalContact;
        listElem.IsMergedContact       = mergedContact;
        listElem.ContactID             = ci.ContactID;

        // Restrict site IDs in CMSDesk
        if (!IsSiteManager)
        {
            listElem.WhereCondition = "ContactSiteID = " + SiteContext.CurrentSiteID;
        }
    }
コード例 #15
0
    private void OnTabCreated(object sender, TabCreatedEventArgs e)
    {
        if (e.Tab == null)
        {
            return;
        }

        switch (e.Tab.TabName.ToLowerCSafe())
        {
        case "account.customfields":
            // Check if contact has any custom fields
            var formInfo = FormHelper.GetFormInfo("OM.Account", false);
            if (!formInfo.GetFields(true, false, false).Any())
            {
                e.Tab = null;
            }
            break;

        case "account.contacts":
            // Display contacts tab only if user is authorized to read contacts
            if (!ContactHelper.AuthorizedReadContact(Account.AccountSiteID, false) && !AccountHelper.AuthorizedReadAccount(Account.AccountSiteID, false))
            {
                e.Tab = null;
            }
            break;

        case "account.merge":
        case "account.subsidiaries":
            if (Account.AccountMergedWithAccountID != 0)
            {
                e.Tab = null;
            }
            break;
        }
    }
コード例 #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check read permission
        ContactHelper.AuthorizedReadContact(CMSContext.CurrentSiteID, true);

        string siteName = CMSContext.CurrentSiteName;

        // Get bounce limit
        mBounceLimit = SettingsKeyProvider.GetIntValue(siteName + ".CMSBouncedEmailsLimit");
        // Get info if bounced e-mail tracking is available
        mBounceInfoAvailable = SettingsKeyProvider.GetBoolValue(siteName + ".CMSMonitorBouncedEmails") &&
                               NewsletterProvider.OnlineMarketingEnabled(siteName);

        CurrentMaster.HeaderActions.HelpTopicName = "subscribercontacts_tab";
        CurrentMaster.HeaderActions.HelpName      = "helpTopic";

        // Check if parent object exist
        Subscriber sb = SubscriberProvider.GetSubscriber(QueryHelper.GetInteger("subscriberid", 0));

        EditedObject = sb;

        // Initialize unigrid
        UniGrid.OnAction            += uniGrid_OnAction;
        UniGrid.OnExternalDataBound += uniGrid_OnExternalDataBound;
        UniGrid.WhereCondition       = "ContactID IN (SELECT ContactGroupMemberRelatedID FROM OM_ContactGroupMember WHERE ContactGroupMemberContactGroupID = "
                                       + QueryHelper.GetInteger("groupid", 0) + " AND ContactGroupMemberType = 0) AND ContactSiteID = " + CMSContext.CurrentSiteID
                                       + " AND ContactMergedWithContactID IS NULL";
        UniGrid.ShowObjectMenu = false;
    }
コード例 #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ci = (ContactInfo)EditedObject;
        CheckReadPermission(ci.ContactSiteID);

        globalContact = (ci.ContactSiteID <= 0);
        mergedContact = (ci.ContactMergedWithContactID > 0);
        modifyAllowed = ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, false);

        contactId = QueryHelper.GetInteger("contactid", 0);

        string where = null;
        // Filter only site members in CMSDesk (for global contacts)
        if (!IsSiteManager && globalContact && AuthorizedForSiteContacts)
        {
            where += " (ContactSiteID IS NULL OR ContactSiteID=" + CMSContext.CurrentSiteID + ")";
        }

        // Choose correct object ("query") according to type of contact
        if (globalContact)
        {
            gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPGLOBALCUSTOMERLIST;
        }
        else if (mergedContact)
        {
            gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPMERGEDCUSTOMERLIST;
        }
        else
        {
            gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPCUSTOMERLIST;
        }

        // Query parameters
        QueryDataParameters parameters = new QueryDataParameters();

        parameters.Add("@ContactId", contactId);

        gridElem.WhereCondition       = where;
        gridElem.QueryParameters      = parameters;
        gridElem.OnAction            += new OnActionEventHandler(gridElem_OnAction);
        gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound);

        // Hide header actions for global contact
        CurrentMaster.HeaderActionsPlaceHolder.Visible = modifyAllowed && !globalContact && !mergedContact;

        // Setup customer selector
        try
        {
            ucSelectCustomer = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/Ecommerce/FormControls/CustomerSelector.ascx");
            ucSelectCustomer.SetValue("Mode", "OnlineMarketing");
            ucSelectCustomer.SetValue("SiteID", ci.ContactSiteID);
            ucSelectCustomer.Changed   += new EventHandler(ucSelectCustomer_Changed);
            ucSelectCustomer.IsLiveSite = false;
            pnlSelectCustomer.Controls.Clear();
            pnlSelectCustomer.Controls.Add(ucSelectCustomer);
        }
        catch
        {
        }
    }
コード例 #18
0
        static void PlayWithContacts()
        {
            var ch = new ContactHelper <Person>();

            ch.Add(new Person("Betty", "White"));
            ch.Add(new Person("Crocker", "Davis"));
            ch.Add(new Person("Horace", "Slughorn"));

            var alfred = new Person("Alfred", "the Great", "777", "345-3455");

            ch.Add(alfred);

            foreach (var item in ch.Read())
            {
                Console.WriteLine(item);
            }
            // ch.WriteToText();
            ch.WriteToXml();
            Person p = ch.ReadFromXml() as Person;

            ch.Add(p);
            ch.WriteToText();
            ch.Clear();

            Console.WriteLine("\n\n");
            ch.PlayWithDelegates();
        }
コード例 #19
0
ファイル: Edit.ascx.cs プロジェクト: SMEWebmaster/Kentico16
    /// <summary>
    /// Actions handler.
    /// </summary>
    protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        // Check permission
        ContactHelper.AuthorizedModifyContact(SiteID, true);

        switch (e.CommandName.ToLowerCSafe())
        {
        // Save contact
        case "save":
            if (EditForm.SaveData(null))
            {
                SetButtonsVisibility();
            }
            break;

        // Split from parent contact
        case "split":
        {
            var mergedContact = (ContactInfo)UIContext.EditedObject;
            List <ContactInfo> mergedContactList = new List <ContactInfo>(1)
            {
                mergedContact
            };

            ContactHelper.SplitContacts(parentContact, mergedContactList, false, false, false);
            SetButtonsVisibility();
            ShowConfirmation(GetString("om.contact.splitted"));
            ScriptHelper.RefreshTabHeader(Page, mergedContact.ContactDescriptiveName);
        }
        break;
        }
    }
コード例 #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        chkEmail.Enabled      = !String.IsNullOrEmpty(ContactHelper.GetEmailDomain(this.CurrentContact.ContactEmail));
        chkAddress.Enabled    = !String.IsNullOrEmpty(this.CurrentContact.ContactAddress1) || !String.IsNullOrEmpty(this.CurrentContact.ContactAddress2) || !String.IsNullOrEmpty(this.CurrentContact.ContactCity) || !String.IsNullOrEmpty(this.CurrentContact.ContactZIP);
        chkBirthDay.Enabled   = (this.CurrentContact.ContactBirthday != DateTimeHelper.ZERO_TIME);
        chkPhone.Enabled      = !String.IsNullOrEmpty(this.CurrentContact.ContactBusinessPhone) || !String.IsNullOrEmpty(this.CurrentContact.ContactHomePhone) || !String.IsNullOrEmpty(this.CurrentContact.ContactMobilePhone);
        chkMembership.Visible = chkIPaddress.Visible = ci.ContactSiteID != 0;

        // Current contact is global object
        if (ci.ContactSiteID == 0)
        {
            plcSite.Visible = true;
            // Display site selector in site manager
            if (ContactHelper.IsSiteManager)
            {
                siteOrGlobalSelector.Visible = false;
            }
            // Display 'site or global' selector in CMS desk for global objects
            else if (ContactHelper.AuthorizedReadContact(CMSContext.CurrentSiteID, false) && ContactHelper.AuthorizedModifyContact(CMSContext.CurrentSiteID, false))
            {
                siteSelector.Visible = false;
            }
            else
            {
                plcSite.Visible = false;
            }
        }
    }
コード例 #21
0
        public void GetContactEntityForBookingPayload_CustomerIdentifierIsNull()
        {
            var contact = ContactHelper.GetContactEntityForBookingPayload(new Models.Customer(), trace);

            Assert.IsNotNull(contact);
            Assert.AreEqual("", contact[Attributes.Contact.SourceSystemId].ToString());
        }
コード例 #22
0
    public void query_contact_id()
    {
        var contact_id    = Request.Params["contact_id"];
        var contacthelper = new ContactHelper(contact_id, this.sqlConnection(), this.Page);

        contacthelper.info();
    }
コード例 #23
0
        public void GetContactEntityForBookingPayload_PopulateAddress()
        {
            Customer c = new Customer
            {
                CustomerIdentifier = new CustomerIdentifier
                {
                    BusinessArea = "Hotel",
                    CustomerId   = "CONT001",
                    SourceMarket = Guid.NewGuid().ToString(),
                    SourceSystem = "On Tour"
                },
                CustomerIdentity = new CustomerIdentity
                {
                    FirstName     = "Joe",
                    LastName      = "Blog",
                    AcademicTitle = "MS",
                    Birthdate     = "1982-10-08",
                    Gender        = Gender.Female,
                    Language      = "English",
                    MiddleName    = "Tom",
                    Salutation    = "Mr"
                },
                Address = new Address[]
                {
                    new Address
                    {
                        AdditionalAddressInfo = "Tes",
                        AddressType           = AddressType.Main,
                        Country             = Guid.NewGuid().ToString(),
                        County              = "Warrington",
                        FlatNumberUnit      = "A",
                        HouseNumberBuilding = "21",
                        PostalCode          = "WA113",
                        Street              = "Handy",
                        Town = "Man"
                    },
                    new Address
                    {
                        AdditionalAddressInfo = "Tes",
                        AddressType           = AddressType.Main,
                        Country             = Guid.NewGuid().ToString(),
                        County              = "Warrington",
                        FlatNumberUnit      = "A",
                        HouseNumberBuilding = "211",
                        PostalCode          = "WA1131",
                        Street              = "Handy1",
                        Town = "Man1"
                    }
                }
            };
            var contact = ContactHelper.GetContactEntityForBookingPayload(c, trace);

            Assert.AreEqual(c.Address[0].AdditionalAddressInfo, contact[Attributes.Contact.Address1AdditionalInformation].ToString());
            Assert.AreEqual(c.Address[0].FlatNumberUnit, contact[Attributes.Contact.Address1FlatOrUnitNumber].ToString());
            Assert.AreEqual(c.Address[0].HouseNumberBuilding, contact[Attributes.Contact.Address1HouseNumberOrBuilding].ToString());
            Assert.AreEqual(c.Address[0].Town, contact[Attributes.Contact.Address1Town].ToString());
            Assert.AreEqual(c.Address[0].PostalCode, contact[Attributes.Contact.Address1PostalCode].ToString());
            Assert.AreEqual(c.Address[0].County, contact[Attributes.Contact.Address1County].ToString());
            Assert.AreEqual(c.Address[0].Country, ((EntityReference)(contact[Attributes.Contact.Address1CountryId])).Id.ToString());
        }
コード例 #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckUIElementAccessHierarchical(ModuleName.ONLINEMARKETING, "ContactMembership.Subscribers");
        ci = (ContactInfo)EditedObject;
        if (ci == null)
        {
            RedirectToAccessDenied(GetString("general.invalidparameters"));
        }

        CheckReadPermission(ci.ContactSiteID);

        globalContact = (ci.ContactSiteID <= 0);
        mergedContact = (ci.ContactMergedWithContactID > 0);
        modifyAllowed = ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, false);

        contactId = QueryHelper.GetInteger("contactid", 0);

        string where = null;
        // Filter only site members in CMSDesk (for global contacts)
        if (!IsSiteManager && globalContact && AuthorizedForSiteContacts)
        {
            where = " (ContactSiteID IS NULL OR ContactSiteID=" + SiteContext.CurrentSiteID + ")";
        }

        // Choose correct object ("query") according to type of contact
        if (globalContact)
        {
            gridElem.ObjectType = ContactMembershipGlobalSubscriberListInfo.OBJECT_TYPE;
        }
        else if (mergedContact)
        {
            gridElem.ObjectType = ContactMembershipMergedSubscriberListInfo.OBJECT_TYPE;
        }
        else
        {
            gridElem.ObjectType = ContactMembershipSubscriberListInfo.OBJECT_TYPE;
        }

        // Query parameters
        QueryDataParameters parameters = new QueryDataParameters();

        parameters.Add("@ContactId", contactId);

        gridElem.WhereCondition       = where;
        gridElem.QueryParameters      = parameters;
        gridElem.OnAction            += gridElem_OnAction;
        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;

        // Hide header actions for global contact or merged contact.
        CurrentMaster.HeaderActionsPlaceHolder.Visible = modifyAllowed && !globalContact && !mergedContact;

        // Setup subscriber selector
        selectSubscriber.UniSelector.SelectionMode     = SelectionModeEnum.MultipleButton;
        selectSubscriber.UniSelector.OnItemsSelected  += UniSelector_OnItemsSelected;
        selectSubscriber.UniSelector.ReturnColumnName  = "SubscriberID";
        selectSubscriber.UniSelector.DisplayNameFormat = "{%SubscriberFullName%} ({%SubscriberEmail%})";
        selectSubscriber.ShowSiteFilter = false;
        selectSubscriber.IsLiveSite     = false;
        selectSubscriber.SiteID         = ci.ContactSiteID;
    }
コード例 #25
0
        /// <summary>
        /// Performs a collision query to update the closest-point information in the contact set.
        /// </summary>
        /// <param name="contactSet">The contact set.</param>
        /// <param name="deltaTime">
        /// The time step size in seconds. (The elapsed simulation time since the contact set was
        /// updated the last time.)
        /// </param>
        /// <remarks>
        /// This method updates closest-point information stored in the given contact set. This method
        /// is usually faster than <see cref="GetClosestPoints"/> because the information in
        /// <paramref name="contactSet"/> is reused and updated.
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="contactSet"/> is <see langword="null"/>.
        /// </exception>
        public void UpdateClosestPoints(ContactSet contactSet, float deltaTime)
        {
            if (contactSet == null)
            {
                throw new ArgumentNullException("contactSet");
            }

            // Update cached information. The last closest-point pair is removed if
            // a penetration is removed.
            ContactHelper.UpdateContacts(contactSet, deltaTime, CollisionDetection.ContactPositionTolerance);

            ComputeCollision(contactSet, CollisionQueryType.ClosestPoints);

            // Reduce to 1 contact.
            if (contactSet.ObjectA.IsRay || contactSet.ObjectB.IsRay)
            {
                ContactHelper.ReduceRayHits(contactSet);
            }
            else
            {
                ContactHelper.ReduceClosestPoints(contactSet);
            }

            CheckResult(contactSet, true);
            contactSet.IsValid = true;
        }
コード例 #26
0
        //--------------------------------------------------------------
        #region Methods
        //--------------------------------------------------------------

        /// <summary>
        /// Gets the closest points of two collision objects.
        /// </summary>
        /// <param name="objectA">The collision object A.</param>
        /// <param name="objectB">The collision object B.</param>
        /// <returns>The contact set with the closest points.</returns>
        /// <remarks>
        /// Note that it is possible that two collision objects have "no closest points", for example
        /// if one collision object has an <see cref="EmptyShape"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="objectA"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="objectB"/> is <see langword="null"/>.
        /// </exception>
        public ContactSet GetClosestPoints(CollisionObject objectA, CollisionObject objectB)
        {
            if (objectA == null)
            {
                throw new ArgumentNullException("objectA");
            }
            if (objectB == null)
            {
                throw new ArgumentNullException("objectB");
            }

            // Create new contact set.

            ContactSet contactSet = ContactSet.Create(objectA, objectB);

            // Compute new closest points.
            ComputeCollision(contactSet, CollisionQueryType.ClosestPoints);

            // Reduce to 1 contact.
            if (objectA.IsRay || objectB.IsRay)
            {
                ContactHelper.ReduceRayHits(contactSet);
            }
            else
            {
                ContactHelper.ReduceClosestPoints(contactSet);
            }

            CheckResult(contactSet, true);

            return(contactSet);
        }
コード例 #27
0
    /// <summary>
    /// Actions handler.
    /// </summary>
    protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        // Check permission
        ContactHelper.AuthorizedModifyContact(this.SiteID, true);

        switch (e.CommandName.ToLower())
        {
        // Save contact
        case "save":
            if (ValidateForm())
            {
                EditForm.SaveData(null);
            }
            break;

        // Split from parent contact
        case "split":
            List <ContactInfo> mergedContact = new List <ContactInfo>();
            mergedContact.Add((ContactInfo)CMSPage.EditedObject);
            ContactHelper.Split(parentContact, mergedContact, false, false, false, false);
            ScriptHelper.RefreshTabHeader(this.Page, null);

            string url = URLHelper.AddParameterToUrl(URLHelper.CurrentURL, "split", "1");
            ScriptHelper.RegisterStartupScript(this.Page, typeof(string), "RefreshPage", ScriptHelper.GetScript("window.location.replace('" + url + "');"));
            break;
        }
    }
コード例 #28
0
ファイル: Edit.ascx.cs プロジェクト: SMEWebmaster/Kentico16
    /// <summary>
    /// Sets visibility of buttons that are connected to merged contact - split button and link to his parent.
    /// </summary>
    private void SetButtonsVisibility()
    {
        // Find out if current contact is merged into another site or global contact
        bool mergedIntoSite   = ValidationHelper.GetInteger(EditForm.Data["ContactMergedWithContactID"], 0) != 0;
        bool mergedIntoGlobal = ValidationHelper.GetInteger(EditForm.Data["ContactGlobalContactID"], 0) != 0 &&
                                ContactHelper.AuthorizedReadContact(UniSelector.US_GLOBAL_RECORD, false);
        bool globalContactsVisible = SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSCMGlobalContacts") || CurrentUser.IsGlobalAdministrator;

        if (mergedIntoSite || (mergedIntoGlobal && globalContactsVisible))
        {
            if (mergedIntoSite)
            {
                parentContact = ContactInfoProvider.GetContactInfo(ValidationHelper.GetInteger(EditForm.Data["ContactMergedWithContactID"], 0));
                headingMergedInto.ResourceString = "om.contact.mergedintosite";
            }
            else
            {
                parentContact = ContactInfoProvider.GetContactInfo(ValidationHelper.GetInteger(EditForm.Data["ContactGlobalContactID"], 0));
                headingMergedInto.ResourceString = "om.contact.mergedintoglobal";
            }

            lblMergedIntoContactName.Text = HTMLHelper.HTMLEncode(ContactInfoProvider.GetContactFullName(parentContact));

            string contactDetailDialogURL = UIContextHelper.GetElementDialogUrl(ModuleName.ONLINEMARKETING, "EditContact", parentContact.ContactID);
            string openDialogScript       = ScriptHelper.GetModalDialogScript(contactDetailDialogURL, "ContactDetail");

            btnMergedContact.IconCssClass  = "icon-edit";
            btnMergedContact.OnClientClick = openDialogScript;
            btnMergedContact.ToolTip       = GetString("om.contact.viewdetail");
        }
        else
        {
            panelMergedContactDetails.Visible = btnSplit.Visible = false;
        }
    }
        public async Task GivenTheSupplierHasMultipleAdditionalServicesAsync()
        {
            var solutionId = await SupplierInfo.GetSolutionWithMultipleAdditionalServices(Test.BapiConnectionString);

            Context.Add(ContextKeys.ChosenItemId, solutionId);

            var supplierId = solutionId.Split('-')[0];
            var supplier   = await DbContext.Supplier.SingleOrDefaultAsync(s => s.Id == supplierId)
                             ?? (await SupplierInfo.GetSupplierWithId(supplierId, Test.BapiConnectionString)).ToDomain();

            var order = Context.Get <Order>(ContextKeys.CreatedOrder);

            order = new OrderBuilder(order)
                    .WithExistingSupplier(supplier)
                    .WithSupplierContact(ContactHelper.Generate())
                    .WithCommencementDate(DateTime.Today)
                    .WithOrderingPartyContact(ContactHelper.Generate())
                    .Build();

            DbContext.Update(order);

            await DbContext.SaveChangesAsync();

            Context.Remove(ContextKeys.CreatedOrder);
            Context.Add(ContextKeys.CreatedOrder, order);
        }
コード例 #30
0
ファイル: Delete.aspx.cs プロジェクト: SMEWebmaster/Kentico16
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // Check permissions
        ContactHelper.AuthorizedModifyContact(contactSiteId, true);

        EnsureAsyncLog();
        RunAsyncDelete();
    }
コード例 #31
0
    public void query_contact()
    {
        String query;

        var informationtype_id = Request.Params["informationtype_id"];
        var productservicename_id = Request.Params["productservicename_id"];
        var location_id = Request.Params["location_id"];

        if ( Request.Params["productservicetype_id"] != null ) {
            var productservicetype_id = Request.Params["productservicetype_id"];
            query = "EXECUTE InformationType_ProductServiceType_ProductServiceName_Location_to_Contact_Query "
                 + informationtype_id + ',' + productservicetype_id + ',' + productservicename_id + ',' + location_id;
        } else {
            var productserviceline_id = Request.Params["productserviceline_id"];
            query = "EXECUTE InformationType_ProductServiceLine_ProductServiceName_Location_to_Contact_Query "
                 + informationtype_id + ',' + productserviceline_id + ',' + productservicename_id + ',' + location_id;
        }

        var conn = this.sqlConnection();
        conn.Open();

        SqlCommand command 		= conn.CreateCommand();
        command.CommandText 	= query;
         		SqlDataReader reader 	= command.ExecuteReader();

        while (reader.Read())
        {
            if ( reader["label"] != "" ) {
                this.Page.Response.Write ("<span class='large'><strong>" + reader["label"] + "</strong></span><br>" );
            }
          			var contact_id = reader["id"].ToString();
            var contacthelper = new ContactHelper(contact_id,this.sqlConnection(),this.Page);
            contacthelper.info();
            this.Page.Response.Write ("<br><br>");
        }

        reader.Close();
        conn.Close();
    }
コード例 #32
0
 public void Init()
 {
     _contactHelper = new ContactHelper("site", "user", "password",
                                                    "https://secure.eloqua.com/API/REST/1.0/");
 }
コード例 #33
0
 public void query_contact_id()
 {
     var contact_id = Request.Params["contact_id"];
     var contacthelper = new ContactHelper(contact_id,this.sqlConnection(),this.Page);
     contacthelper.info();
 }