Beispiel #1
0
 protected override void OnFormBound()
 {
     if (Contact == null)
     {
         Object parentEntity;
         try
         {
             parentEntity = GetParentEntity();
             if (parentEntity != null)
             {
                 if (parentEntity is Sage.Entity.Interfaces.IContact)
                 {
                     Sage.Entity.Interfaces.IContact contact = (parentEntity as Sage.Entity.Interfaces.IContact);
                     Contact = contact;
                 }
             }
         }
         catch
         {
             Sage.Entity.Interfaces.IContact contact = GetLastContact();
             if (contact != null)
             {
                 Contact = contact;
             }
         }
     }
     LoadContact();
     base.OnFormBound();
 }
 protected override void InnerPageLoad(object sender, EventArgs e)
 {
     if (this.Visible & !IsClosing)
     {
         if (Contact == null)
         {
             if (!DialogService.DialogParameters.ContainsKey("MoveContact"))
             {
                 Sage.Entity.Interfaces.IContact contact = GetParentEntity() as Sage.Entity.Interfaces.IContact;
                 Contact = contact;
                 DialogService.DialogParameters.Add("MoveContact", Contact);
                 DialogService.DialogParameters.Add("ToAccount", Contact.Account);
             }
             else
             {
                 /* Handled in change event. */
             }
             if (!DialogService.DialogParameters.ContainsKey("CompletedItemsContact"))
             {
                 DialogService.DialogParameters.Add("CompletedItemsContact", this.lueCompletedItemsContact.LookupResultValue);
             }
             if (!DialogService.DialogParameters.ContainsKey("OpenItemsContact"))
             {
                 DialogService.DialogParameters.Add("OpenItemsContact", this.lueOpenItemsContact.LookupResultValue);
             }
         }
         if (!DialogService.DialogParameters.ContainsKey("Init"))
         {
             this.chkCopyHistory.Checked = true;
             DialogService.DialogParameters.Add("Init", string.Empty);
         }
     }
 }
 protected void lueMoveContact_ChangeAction(object sender, EventArgs e)
 {
     if (!DialogService.DialogParameters.ContainsKey("MoveContact"))
     {
         DialogService.DialogParameters.Add("MoveContact", this.lueMoveContact.LookupResultValue);
     }
     else
     {
         DialogService.DialogParameters["MoveContact"] = this.lueMoveContact.LookupResultValue;
     }
     Sage.Entity.Interfaces.IContact contact = (Sage.Entity.Interfaces.IContact) this.lueMoveContact.LookupResultValue;
     Contact = contact;
     this.lueMoveContact.LookupResultValue = contact;
     this.txtFromAccount.Text = contact.AccountName;
     this.lueCompletedItemsContact.SeedProperty = "Account.Id";
     this.lueCompletedItemsContact.SeedValue    = contact.Account.Id.ToString();
     this.lueOpenItemsContact.SeedProperty      = "Account.Id";
     this.lueOpenItemsContact.SeedValue         = contact.Account.Id.ToString();
     Sage.Entity.Interfaces.IContact primary_contact = GetPrimaryContactFor(contact.Account);
     if (primary_contact != null)
     {
         if (!primary_contact.Equals(contact))
         {
             this.lueCompletedItemsContact.LookupResultValue = primary_contact;
             this.lueOpenItemsContact.LookupResultValue      = primary_contact;
         }
         else
         {
             this.lueCompletedItemsContact.LookupResultValue = null;
             this.lueOpenItemsContact.LookupResultValue      = null;
         }
     }
     if (!DialogService.DialogParameters.ContainsKey("CompletedItemsContact"))
     {
         DialogService.DialogParameters.Add("CompletedItemsContact", this.lueCompletedItemsContact.LookupResultValue);
     }
     else
     {
         DialogService.DialogParameters["CompletedItemsContact"] = this.lueCompletedItemsContact.LookupResultValue;
     }
     if (!DialogService.DialogParameters.ContainsKey("OpenItemsContact"))
     {
         DialogService.DialogParameters.Add("OpenItemsContact", this.lueOpenItemsContact.LookupResultValue);
     }
     else
     {
         DialogService.DialogParameters["OpenItemsContact"] = this.lueOpenItemsContact.LookupResultValue;
     }
 }
Beispiel #4
0
 private Sage.Entity.Interfaces.IContact GetLastContact()
 {
     if (this.EntityHistoryService != null)
     {
         object contactId = this.EntityHistoryService.GetLastIdForType <Sage.Entity.Interfaces.IContact>();
         if (contactId != null)
         {
             Sage.Entity.Interfaces.IContact contact = Sage.Platform.EntityFactory.GetById <Sage.Entity.Interfaces.IContact>(contactId);
             if (contact != null)
             {
                 return(contact);
             }
         }
     }
     return(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();
 }