private void HookupNewOpinionDoc(bool ForOpinion) { if (ForOpinion) { OpenDocDialog.SetDocFilter("opinion=1"); } OpenDocDialog.AllowBrowseFiles = false; OpenDocDialog.FindFile(FM.CurrentFileId); DialogResult dRes = OpenDocDialog.ShowDialog(FileForm()); OpenDocDialog.SetDocFilter(""); OpenDocDialog.AllowBrowseFiles = true; if (dRes == DialogResult.OK && OpenDocDialog.SelectedDocument != null) { docDB.DocumentRow newOpnDoc = OpenDocDialog.SelectedDocument; if (ForOpinion) { CurrentRow().DocId = newOpnDoc.DocId; } else { CurrentRow().RequestDocId = newOpnDoc.DocId; } LoadDocs(CurrentRow()); } }
private void btnRun_Click(object sender, EventArgs e) { try { List <DataRow> toAction = UIHelper.GridGetSelectedData(gridFileList); toAction.RemoveAll(RemoveSuccess); if (toAction.Count > 0 && MessageBox.Show("Are you sure you want to proceed? You have selected " + toAction.Count.ToString() + " files.", "Mass Activity", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { string massMailingPath = null; ActivityConfig.ACSeriesRow acsr = SelectedACSeries(); ACEngine ace = new ACEngine(fmCurrent); ace.TestForSteps(acsr.ACSeriesId); if (ace.HasDoc && chkConcatenate.Checked) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "rtf files (*.rtf)|*.rtf|All files (*.*)|*.*"; saveFileDialog1.FileName = "Merge_" + acsr.StepCode.Replace(".", "") + "_" + DateTime.Today.ToString("yyyyMMdd") + ".rtf"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { massMailingPath = saveFileDialog1.FileName; } } docDB.DocumentRow doc2Copy = null; if (acsr.ACSeriesId == AtMng.GetSetting(AppIntSetting.DocumentCopyAcId)) { fBrowseDocs fdoc = ((fMain)Application.OpenForms["fMain"]).OpenDocDialog; massMailingPath = null; if (fdoc.ShowDialog(this) == DialogResult.OK && fdoc.SelectedDocuments() != null) { doc2Copy = fdoc.SelectedDocument; } else { MessageBox.Show("You can't proceed without selecting a document.", "Mass Activity", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } } //if (ctx != null && ctx.Count > 0) //{ //we need to prompt for input //launch wiz for first file to capture user input lmDatasets.appDB.EFileSearchRow efsr = (lmDatasets.appDB.EFileSearchRow)toAction[0]; FileManager fmFirst = AtMng.GetFile(efsr.FileId); fACWizard facw; lmDatasets.atriumDB.ActivityRow newAC = null; if (doc2Copy != null) { docDB.DocumentRow docCopy = fmFirst.GetDocMng().GetDocument().MakeCopy(doc2Copy, fmFirst.CurrentFile, doc2Copy.IsDraft); facw = new fACWizard(fmFirst, ACEngine.Step.Document, acsr.ACSeriesId, docCopy.DocId, "REVISE"); } else { facw = new fACWizard(fmFirst, ACEngine.Step.ACInfo, acsr.ACSeriesId); } facw.ctx = ctx; if (facw.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { //get newly added activity newAC = fmFirst.DB.Activity[fmFirst.DB.Activity.Count - 1]; efsr.Result = "Success"; efsr.Message = "Prototype activity"; efsr.EndEdit(); toAction.Remove(efsr); } else { MessageBox.Show("You can't proceed without completing the prototype activity.", "Mass Activity", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } //} using (fWait fProgress = new fWait("Generating activities, please wait")) { AtMng.MassActivity(toAction, acsr, (string)uiTemplate.SelectedValue, massMailingPath, 0, ACEngine.RevType.Document, ctx, doc2Copy, newAC); } } else if (toAction.Count == 0) { MessageBox.Show("No files selected", "Mass Activity", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } catch (Exception x) { UIHelper.HandleUIException(x); } }