/// <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; } }
public static void Create() { Db.Transaction(() => { Db.SlowSQL("DELETE FROM Mailbox"); Db.SlowSQL("DELETE FROM EmailAddress"); Db.SlowSQL("DELETE FROM Contact"); Db.SlowSQL("DELETE FROM Mail"); Db.SlowSQL("DELETE FROM Country"); Db.SlowSQL("DELETE FROM EmailAddressRole"); Db.SlowSQL("DELETE FROM PhoneNumberRole"); Db.SlowSQL("DELETE FROM Thread"); var drafts = new Mailbox() { Name = "Drafts", Icon = "settings" }; var inbox = new Mailbox() { Name = "Inbox" }; var sent = new Mailbox() { Name = "Sent" }; var lisa = new Contact() { FirstName = "Lisa", LastName = "Gherardini" }; var work = new EmailAddressRole() { Name = "Work" }; var home = new EmailAddressRole() { Name = "Home" }; new PhoneNumberRole() { Name = "Mobile" }; new PhoneNumberRole() { Name = "Work" }; new PhoneNumberRole() { Name = "Home" }; new PhoneNumberRole() { Name = "Work Fax" }; new PhoneNumberRole() { Name = "Home Fax" }; var me = new EmailAddress() { Address = "*****@*****.**" }; var them1 = new EmailAddress() { Address = "*****@*****.**", Contact = lisa, Role = home }; them1.Role = new EmailAddressRole() { Name = "2nd Work" }; var t1 = new Thread(); var them2 = new EmailAddress() { Address = "*****@*****.**" }; var t2 = new Thread(); var t3 = new Thread(); new Country() { Name = "Sweden", DialCode = "+46" }; new Country() { Name = "Norway", DialCode = "+47" }; new Country() { Name = "Poland", DialCode = "+48" }; new Country() { Name = "Germany", DialCode = "+49" }; new Mail() { Thread = t1, From = them1, To = me, Subject = "Hi there", Content = "How are you", Mailbox = inbox }; new Mail() { Thread = t2, From = them2, To = me, Subject = "Buy diet pills", Content = "Guaranteed results", Mailbox = inbox }; new Mail() { Thread = t3, From = them2, To = me, Subject = "Business opportunity", Content = "Call me", Mailbox = inbox }; new Mail() { Thread = t2, From = me, To = them2, Subject = "Re: But diet pill", Content = "No thank you", Mailbox = sent }; }); }