示例#1
0
        public RelatedRecordsControl(TabControl parent, IOrganizationService service, QueryInfo child, CRMRecordEventHandler recorddoubleclick, CRMRecordEventHandler recordselectasparent)
        {
            InitializeComponent();
            gvChildren.RecordDoubleClick += recorddoubleclick;
            SelectAsParent = recordselectasparent;
            if (child.Relationship is OneToManyRelationshipMetadata rel1m)
            {
                txtCascadeAssign.Text   = rel1m.CascadeConfiguration.Assign?.ToString();
                txtCascadeShare.Text    = rel1m.CascadeConfiguration.Share?.ToString();
                txtCascadeUnshare.Text  = rel1m.CascadeConfiguration.Unshare?.ToString();
                txtCascadeReparent.Text = rel1m.CascadeConfiguration.Reparent?.ToString();
                txtCascadeDelete.Text   = rel1m.CascadeConfiguration.Delete?.ToString();
                pan1Mrel.Visible        = true;
                panMMrel.Visible        = false;
            }
            if (child.Relationship is ManyToManyRelationshipMetadata relmm)
            {
                txtMMEntity1.Text    = relmm.Entity1LogicalName;
                txtMMAttribute1.Text = relmm.Entity1IntersectAttribute;
                txtMMEntity2.Text    = relmm.Entity2LogicalName;
                txtMMAttribute2.Text = relmm.Entity2IntersectAttribute;
                pan1Mrel.Visible     = false;
                panMMrel.Visible     = true;
            }
            txtEntity.Text   = child.CollectionDisplayName;
            txtRelation.Text = child.Relationship.SchemaName;
            txtCount.Text    = child.Results.Entities.Count.ToString();
            var tp = new TabPage(child.CollectionDisplayName + (child.Relationship is ManyToManyRelationshipMetadata ? " M:M" : ""))
            {
                Tag  = child,
                Name = child.Relationship.SchemaName
            };

            tp.Controls.Add(this);
            Dock = DockStyle.Fill;
            parent.TabPages.Add(tp);
            gvChildren.OrganizationService = service;
            gvChildren.DataSource          = child.Results;
            RRA.SortColumns(gvChildren, child.EntityInfo, gvChildren.OrganizationService);
        }
示例#2
0
 public void OnRecordEvent(object sender, CRMRecordEventHandler RecordEventHandler)
 {
     RecordEventHandler?.Invoke(sender, this);
 }