예제 #1
0
        private void btnValidateSIN_Click(object sender, EventArgs e)
        {
            try
            {
                string typedSIN = sINMaskedEditBox.Text.Replace(" ", "");

                if (typedSIN.Length != 9)
                {
                    MessageBox.Show("SIN must be 9 digits. You must provide an exact match for SIN");
                    sINMaskedEditBox.Focus();
                    return;
                }

                lmDatasets.appDB.EFileSearchDataTable efsdt = FM.AtMng.FileSearchBySIN(typedSIN);
                if (efsdt.Count > 0)
                {
                    lmDatasets.appDB.EFileSearchRow efr = efsdt[0];
                    CurrentRowIRP().FileID = efr.FileId;
                    CurrentRowIRP().EndEdit();
                    btnValidateSIN.Visible = false;
                }
            }
            catch (Exception x)
            {
                UIHelper.HandleUIException(x);
            }
        }
예제 #2
0
 private static bool RemoveSuccess(DataRow dr)
 {
     lmDatasets.appDB.EFileSearchRow efsr = (lmDatasets.appDB.EFileSearchRow)dr;
     if (efsr.IsResultNull() || efsr.Result == "Failed" || efsr.Result == "Raté")
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
예제 #3
0
        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);
            }
        }