private void btnNewLinkTo_Click(object sender, EventArgs e) { if (enterMainForm.View.CurrentRecordId > 0) { View selectedView; Epi.Windows.Enter.Dialogs.FindRecords findrecords; if (enterMainForm.View.Project.Views.Count > 1) { Epi.Enter.Dialogs.WithinProjectViewSelectionDialog viewSelection = new Epi.Enter.Dialogs.WithinProjectViewSelectionDialog(enterMainForm, enterMainForm.View.Project); if (viewSelection.ShowDialog() == DialogResult.OK) { selectedView = currentView.Project.GetViewById(viewSelection.ViewId); } else { return; } } else { selectedView = currentView; } findrecords = new Epi.Windows.Enter.Dialogs.FindRecords(selectedView, enterMainForm, currentView); DialogResult result = findrecords.ShowDialog(); this.BringToFront(); if (result == DialogResult.OK) { Query query = db.CreateQuery("Insert into metaLinks (FromRecordGuid, ToRecordGuid, FromViewId, ToViewId) values (@FromRecordGuid, @ToRecordGuid, @FromViewId, @ToViewId)"); query.Parameters.Add(new QueryParameter("@FromRecordGuid", DbType.StringFixedLength, enterMainForm.View.CurrentGlobalRecordId.ToLowerInvariant())); query.Parameters.Add(new QueryParameter("@ToRecordGuid", DbType.StringFixedLength, findrecords.GlobalRecordId.ToString("D").ToLowerInvariant())); query.Parameters.Add(new QueryParameter("@FromViewId", DbType.Int32, enterMainForm.View.Id)); query.Parameters.Add(new QueryParameter("@ToViewId", DbType.Int32, selectedView.Id)); db.ExecuteNonQuery(query); FillToNodes(); } } else { MessageBox.Show(SharedStrings.LINKED_RECS_FIRST_SAVE, SharedStrings.LINKED_RECS_CANT_CREATE, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnNewLinkFrom_Click(object sender, EventArgs e) { if (enterMainForm.View.CurrentRecordId > 0) { View selectedView; Epi.Windows.Enter.Dialogs.FindRecords findrecords; if (enterMainForm.View.Project.Views.Count > 1) { Epi.Enter.Dialogs.WithinProjectViewSelectionDialog viewSelection = new Epi.Enter.Dialogs.WithinProjectViewSelectionDialog(enterMainForm, enterMainForm.View.Project); if (viewSelection.ShowDialog() == DialogResult.OK) { selectedView = currentView.Project.GetViewById(viewSelection.ViewId); } else { return; } } else { selectedView = currentView; } findrecords = new Epi.Windows.Enter.Dialogs.FindRecords(selectedView, enterMainForm); DialogResult result = findrecords.ShowDialog(); this.BringToFront(); if (result == DialogResult.OK) { Query query = db.CreateQuery("Insert into metaLinks (FromRecordGuid, ToRecordGuid, FromViewId, ToViewId) values (@FromRecordGuid, @ToRecordGuid, @FromViewId, @ToViewId)"); query.Parameters.Add(new QueryParameter("@FromRecordGuid", DbType.StringFixedLength, findrecords.GlobalRecordId.ToString("D").ToLower())); query.Parameters.Add(new QueryParameter("@ToRecordGuid", DbType.StringFixedLength, enterMainForm.View.CurrentGlobalRecordId.ToLower())); query.Parameters.Add(new QueryParameter("@FromViewId", DbType.Int32, selectedView.Id)); query.Parameters.Add(new QueryParameter("@ToViewId", DbType.Int32, enterMainForm.View.Id)); db.ExecuteNonQuery(query); FillFromNodes(); } } else { MessageBox.Show("Please save the current record prior to adding links.", "Unable to create link", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Handles the Click event of the Find Records menu item /// </summary> /// <param name="sender">Object that fired the event</param> /// <param name="e">.NET supplied event parameters</param> private void findToolStripMenuItem_Click(object sender, EventArgs e) { Epi.Windows.Enter.Dialogs.FindRecords findrecords = new Epi.Windows.Enter.Dialogs.FindRecords(view, this); DialogResult result = findrecords.ShowDialog(); this.BringToFront(); if (result == DialogResult.OK && IsRecordCloseable) { if (this.GotoRecordEvent != null) { this.GotoRecordEvent(this, new GoToRecordEventArgs(findrecords.RecordId)); } } }