private Sage.Entity.Interfaces.IContact GetPrimaryContactFor(Sage.Entity.Interfaces.IAccount account) { Object result; IRepository <Sage.Entity.Interfaces.IContact> rep = Sage.Platform.EntityFactory.GetRepository <Sage.Entity.Interfaces.IContact>(); IQueryable qry = (IQueryable)rep; IExpressionFactory ep = qry.GetExpressionFactory(); Sage.Platform.Repository.ICriteria crit = qry.CreateCriteria(); crit.Add(ep.Eq("Account", account)); crit.Add(ep.Eq("IsPrimary", true)); result = crit.UniqueResult <Sage.Entity.Interfaces.IContact>(); return((result != null) ? (Sage.Entity.Interfaces.IContact)result : null); }
protected override void OnFormBound() { ClientBindingMgr.RegisterDialogCancelButton(cmdCancel); if ((Contact != null) & !IsClosing) { Sage.Entity.Interfaces.IContact contact = DialogService.DialogParameters["MoveContact"] as Sage.Entity.Interfaces.IContact; Sage.Entity.Interfaces.IAccount account = DialogService.DialogParameters["ToAccount"] as Sage.Entity.Interfaces.IAccount; this.lueMoveContact.LookupResultValue = contact; this.txtFromAccount.Text = contact.AccountName; this.lueToAccount.LookupResultValue = account; this.lueCompletedItemsContact.SeedProperty = "Account.Id"; this.lueCompletedItemsContact.SeedValue = contact.Account.Id.ToString(); this.lueOpenItemsContact.SeedProperty = "Account.Id"; this.lueOpenItemsContact.SeedValue = contact.Account.Id.ToString(); this.lueCompletedItemsContact.LookupResultValue = DialogService.DialogParameters["CompletedItemsContact"]; this.lueOpenItemsContact.LookupResultValue = DialogService.DialogParameters["OpenItemsContact"]; } base.OnFormBound(); }