void InitPage(CrudAPI crudapi) { crudAPI = crudapi; var Comp = crudAPI.CompanyEntity; InitializeComponent(); StartLoadCache(); layoutControl = layoutItems; deCreated.IsReadOnly = true; deCreated.AllowDefaultButton = false; if (campaignClient != null) { RibbonBase rb = (RibbonBase)frmRibbon.DataContext; UtilDisplay.RemoveMenuCommand(rb, new string[] { "Delete", "Layout", "Templates" }); if (!isCopiedRow) { NewRow = CreateNew() as CrmFollowUpClient; NewRow.SetMaster(master ?? crudapi.CompanyEntity); } } if (editrow == null && LoadedRow == null && campaignClient == null) { frmRibbon.DisableButtons("Delete"); if (!isCopiedRow) { editrow = CreateNew() as CrmFollowUpClient; editrow.SetMaster(master ?? crudapi.CompanyEntity); } deCreated.IsReadOnly = false; deCreated.AllowDefaultButton = true; liUpdatedAt.Visibility = Visibility.Collapsed; } if (isCopiedRow) { frmRibbon.DisableButtons("Delete"); } lookupDCAccount.api = leGroup.api = leEmployee.api = leOfferNumber.api = crudAPI; if (campaignClient == null) { layoutItems.DataContext = editrow; } else if (campaignClient != null) { layoutItems.DataContext = NewRow; } frmRibbon.OnItemClicked += frmRibbon_OnItemClicked; liOfferNumber.ButtonClicked += liOfferNumber_ButtonClicked; BindContact(); }
public CwAddFollowUp(CrudAPI _api) { var newItem = Activator.CreateInstance(typeof(CrmFollowUpClient)) as UnicontaBaseEntity; api = _api; followUp = newItem as CrmFollowUpClient; followUp.SetMaster(api.CompanyEntity); this.DataContext = followUp; InitializeComponent(); this.Title = string.Format(Uniconta.ClientTools.Localization.lookup("AddOBJ"), Uniconta.ClientTools.Localization.lookup("FollowUp")); leGroup.api = leEmployee.api = api; #if !SILVERLIGHT FocusManager.SetFocusedElement(txtText, txtText); #endif }
private void leContact_SelectedIndexChanged(object sender, RoutedEventArgs e) { var contact = leContact.SelectedItem as Contact; if (contact != null) { editrow.SetMaster(contact); } else { var dcAccount = master as DCAccount; editrow._DCType = (CrmCampaignMemberType)dcAccount.__DCType(); editrow._Account = dcAccount._Account; editrow.NotifyPropertyChanged("DCType"); editrow.NotifyPropertyChanged("DCAccount"); } }