Exemple #1
0
    /// <summary>
    /// The user has entered text in the mailaddress role (i.e. Home, Work, etc.) This is simply a PATCH
    /// message on the view model using the standard JSON-Patch format (RFCXXXX)
    /// </summary>
    /// <param name="input">The input event contains the new value etc.</param>
    void Handle(Input.SearchRole input)
    {
        var role = SQL("SELECT r FROM MailAddressRole r WHERE Name = ?", input.Value).First;

        if (role != null)
        {
            Data.Role = role;
        }
        else
        {
            var newRole = new EmailAddressRole();
            newRole.Name = input.Value;

            this.Data.Role = newRole;

            Master m = Master.GET("/master");
            var    p = (ContactApp)m.ApplicationPage;
            p.FocusedContact.EmailAddressRoleOptions.Add().Data = newRole;
        }
    }
Exemple #2
0
    void Handle(Input.SearchRole input)
    {
        var role = SQL("SELECT r FROM PhoneNumberRole r WHERE Name = ?", input.Value).First;

        if (role != null)
        {
            Data.Role = role;
        }
        else
        {
            var newRole = new PhoneNumberRole();
            newRole.Name = input.Value;

            Data.Role = newRole;

            Master m = Master.GET("/master");
            var    p = (ContactApp)m.ApplicationPage;
            ((ContactPage)p.FocusedContact).PhoneNumberRoleOptions.Add().Data = newRole;
        }
    }