Exemple #1
0
        private void Init(ActivityConfig.ACSeriesRow acsr)
        {
            this.SuspendLayout();
            //flowLayoutPanel1.Controls.Clear();
            if (myRF != null)
            {
                myRF.Dispose();
            }
            myRF                 = null;
            MyACE                = new ACEngine(FM);
            MyACE.myAcSeries     = acsr;
            MyACE.myActivityCode = acsr.ActivityCodeRow;
            MyACE.DoRelFields();
            MyACE.DoStep(ACEngine.Step.RelatedFields0, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields1, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields2, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields3, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields4, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields5, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields6, true);

            BuildForm(acsr);
            if (first)
            {
                foreach (DataView dv in MyACE.relTables.Values)
                {
                    DataTable dt = dv.Table;
                    dt.ColumnChanged += new DataColumnChangeEventHandler(dt_ColumnChanged);
                    atLogic.ObjectBE obe = FM.GetBEFromTable(dt);
                    obe.OnUpdate += new atLogic.UpdateEventHandler(ucSSTCase_OnUpdate);
                }
                first = false;
            }
            this.ResumeLayout();
        }
Exemple #2
0
        public string A5JSON(int fileId, int acSeriesId)
        {
            atriumManager myAtmng = Helper.Atmng();
            FileManager   fm      = myAtmng.GetFile(fileId);

            lmDatasets.ActivityConfig.ACSeriesRow acsr = fm.AtMng.acMng.DB.ACSeries.FindByACSeriesId(acSeriesId);

            atriumBE.ACEngine MyACE = new ACEngine(fm);
            MyACE.myAcSeries     = acsr;
            MyACE.myActivityCode = acsr.ActivityCodeRow;
            MyACE.DoRelFields();
            MyACE.DoStep(ACEngine.Step.RelatedFields0, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields1, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields2, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields3, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields4, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields5, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields6, true);

            string curobj = "";
            string json   = "{";

            foreach (ActivityConfig.ActivityFieldRow arf in fm.AtMng.acMng.DB.ActivityField.Select("ACSeriesId=" + acSeriesId.ToString() + " and TaskType in ('F','T')", "objectalias,fieldname"))
            {
                if (curobj != arf.ObjectAlias)
                {
                    //start new row
                    curobj = arf.ObjectAlias;
                    json  += "'" + arf.ObjectAlias + "':[";

                    foreach (DataRowView dvr in MyACE.relTables[curobj])
                    {
                        json += "{";
                        json += "'atrid':" + Newtonsoft.Json.JsonConvert.ToString(dvr.Row[dvr.Row.Table.PrimaryKey[0]]) + ",";
                        foreach (ActivityConfig.ActivityFieldRow arfRow in fm.AtMng.acMng.DB.ActivityField.Select("ObjectAlias='" + curobj + "' and ACSeriesId=" + acSeriesId.ToString() + " and TaskType in ('F','T')", "objectalias,fieldname"))
                        {
                            json += "'" + arfRow.FieldName + "':" + Newtonsoft.Json.JsonConvert.ToString(dvr.Row[arfRow.DBFieldName]) + ",";
                        }
                        json  = json.TrimEnd(',');
                        json += "},";
                    }
                    json  = json.TrimEnd(',');
                    json += "]";
                }
                else
                {
                }
            }
            return(json + "}");
            // DataSet ds = new DataSet();
            // foreach(DataView dv in MyACE.relTables.Values)
            // {
            //     ds.Tables.Add(dv.ToTable());
            // }

            // return Newtonsoft.Json.JsonConvert.SerializeObject(ds, Newtonsoft.Json.Formatting.Indented);
            //// return Json(ds,JsonRequestBehavior.AllowGet);
        }
Exemple #3
0
        //public ACEngine Add(DateTime acDate, ActivityConfig.ACSeriesRow acSeries, atriumDB.ProcessRow process, bool adHoc, atriumDB.ActivityRow prevAc, string conversationIndex)
        //{
        //    if (myACE != null)
        //        throw new AtriumException("You cannot enter more than one activity at a time on a file.");

        //    myACE = new ACEngine(FM, acDate, acSeries, process, adHoc, conversationIndex, prevAc, ConnectorType.NextStep, null, 0, ACEngine.RevType.Nothing);

        //    return myACE;

        //}

        public ACEngine Add(DateTime acDate, ActivityConfig.ACSeriesRow acSeries, atriumDB.ProcessRow process, bool adHoc, atriumDB.ActivityRow prevAc)
        {
            if (myACE != null)
            {
                throw new AtriumException("You cannot enter more than one activity at a time on a file.");
            }

            myACE = new ACEngine(FM, acDate, acSeries, process, adHoc, null, prevAc, ConnectorType.NextStep, null, 0, ACEngine.RevType.Nothing, null);
            return(myACE);
        }
Exemple #4
0
        public string A5JSONUpdate(int fileId, int acSeriesId, string json)
        {
            atriumManager myAtmng = Helper.Atmng();
            FileManager   fm      = myAtmng.GetFile(fileId);

            lmDatasets.ActivityConfig.ACSeriesRow acsr = fm.AtMng.acMng.DB.ACSeries.FindByACSeriesId(acSeriesId);

            atriumBE.ACEngine MyACE = new ACEngine(fm);
            MyACE.myAcSeries     = acsr;
            MyACE.myActivityCode = acsr.ActivityCodeRow;
            MyACE.DoRelFields();
            MyACE.DoStep(ACEngine.Step.RelatedFields0, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields1, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields2, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields3, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields4, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields5, true);
            MyACE.DoStep(ACEngine.Step.RelatedFields6, true);



            Newtonsoft.Json.Linq.JObject data = Newtonsoft.Json.Linq.JObject.Parse(json);



            //foreach (ActivityConfig.ActivityFieldRow arf in fm.AtMng.acMng.DB.ActivityField.Select("ACSeriesId=" + acSeriesId.ToString() + " and TaskType in ('F','T')", "objectalias,fieldname"))
            foreach (string curobj in MyACE.relTables.Keys)
            {
                var table = data[curobj].Children().ToList();
                MyACE.relTables[curobj].Sort = MyACE.relTables[curobj].Table.PrimaryKey[0].ColumnName;
                foreach (var row in table)
                {
                    int         rid = (int)row["atrid"];
                    int         pos = MyACE.relTables[curobj].Find(row["atrid"]);
                    DataRowView dvr = MyACE.relTables[curobj][pos];
                    //need to match up rows
                    foreach (ActivityConfig.ActivityFieldRow arfRow in fm.AtMng.acMng.DB.ActivityField.Select("ObjectAlias='" + curobj + "' and ACSeriesId=" + acSeriesId.ToString() + " and TaskType in ('F','T')", "objectalias,fieldname"))
                    {
                        System.Diagnostics.Debug.WriteLine("{0}, {1}", dvr.Row[arfRow.DBFieldName], data[curobj][0][arfRow.FieldName]);
                    }
                }
            }
            return(null);
        }
Exemple #5
0
        public NextStep SillyQuestion(NextStep ns, FileManager fmCurrent)
        {
            StepType st = (StepType)ns.acs.StepType;

            //check for silly question
            if (st == StepType.Decision && ns.acs.GetActivityFieldRows().Length > 0)
            {
                NextStep answer      = null;
                ACEngine sillyEngine = new ACEngine(fmCurrent);
                bool     isTrue      = sillyEngine.SillyQuestion(ns.acs);
                //find right path
                foreach (NextStep a1 in ns.Children.NextSteps.Values)
                {
                    if (isTrue && (a1.LinkText.StartsWith("Yes") || a1.LinkText.StartsWith("Oui")))
                    {
                        answer = a1;

                        break;
                    }
                    else if (!isTrue && (a1.LinkText.StartsWith("No") || a1.LinkText.StartsWith("Non")))
                    {
                        answer = a1;

                        break;
                    }
                }


                //follow it
                if (answer.Children != null)
                {
                    return(SillyQuestion(answer, fmCurrent));
                }
                else
                {
                    return(answer);
                }
            }
            return(ns);
        }
Exemple #6
0
        private void ucActivity_ASelectedValueChanged(object sender, EventArgs e)
        {
            try
            {
                //check to see if step has templates

                ActivityConfig.ACSeriesRow acsr = SelectedACSeries();
                ACEngine ace = new ACEngine(fmCurrent);
                ace.TestForSteps(acsr.ACSeriesId);
                if (ace.HasDoc & ace.TemplateList != null)
                {
                    uiTemplate.Enabled = true;
                    UIHelper.ComboBoxInit(ace.TemplateList, uiTemplate, fmCurrent);
                }
                else
                {
                    uiTemplate.Enabled       = false;
                    uiTemplate.SelectedValue = null;
                }

                //check for fields that require prompting

                ctx = new Dictionary <string, object>();
                foreach (ActivityConfig.ActivityFieldRow afr in acsr.GetActivityFieldRows())
                {
                    if (afr.TaskType == "F" & afr.Visible & !afr.ReadOnly & afr.IsDefaultObjectNameNull() & (afr.IsDefaultValueNull() || !afr.DefaultValue.StartsWith("[")))
                    {
                        ctx.Add(afr.ObjectAlias + afr.FieldName, null);
                    }
                }
                if (ctx.Count == 0)
                {
                    ctx = null;
                }
            }
            catch (Exception x)
            {
                UIHelper.HandleUIException(x);
            }
        }
Exemple #7
0
        public ACEngine Add(DateTime acDate, ActivityConfig.ACSeriesRow acSeries, atriumDB.ProcessRow process, bool adHoc, atriumDB.ActivityRow prevAc, ConnectorType action, Stack <ParentChildStep> _flowQ, int revId, ACEngine.RevType revType, string conversationIndex, DataRow contextRow)
        {
            //if (_flowQ != null)
            //    flowQ = _flowQ;
            if (myACE != null)
            {
                throw new AtriumException("You cannot enter more than one activity at a time on a file.");
            }

            ConnectorType ct;

            if (action == ConnectorType.Reply | action == ConnectorType.ReplyAll | action == ConnectorType.Forward)
            {
                ct = action;
            }
            else
            {
                ct = ConnectorType.NextStep;
            }
            myACE = new ACEngine(FM, acDate, acSeries, process, adHoc, conversationIndex, prevAc, ct, _flowQ, revId, revType, contextRow);
            return(myACE);
        }
Exemple #8
0
        private void DisbBulkRow(string officeFileNo, DateTime disbDate, CodesDB.DisbursementTypeRow disbTypeR, decimal taxableDisb, decimal nonTaxableDisb, string comment, ref bool encounteredError, int officeId, DateTime srpDate)
        {
            if (!disbTypeR.IsBulk)//  disbTypeCode == "CO" || disbTypeCode == "FA" || disbTypeCode == "LD" || disbTypeCode == "PH" || disbTypeCode == "PO" || disbTypeCode == "RM")
            {
                if (officeFileNo == "")
                {
                    officeFileNo = "General Account";
                }
                atriumDB.EFileRow drEfile = null;

                try
                {
                    FileManager fmCur = myA.AtMng.GetFile(officeFileNo, officeId);
                    fms.Add(fmCur.CurrentFile.FileId, fmCur);
                    drEfile = fmCur.CurrentFile;

                    if (drEfile != null)
                    {
                        //fmCur.GetActivity().LoadByFileId(drEfile.FileId);
                        //JL: Change to DisbursementType from ACManagement to CodesDB bobo.
                        //string activityQuery = "officeid=" + officeId.ToString() + " and fileid=" + drEfile.FileId.ToString() + " and activitycodeid=" + disbTypeR.GetACDisbRows()[0].ActivityCodeId.ToString() + " and activitydate='" + srpDate.ToString("yyyy/MM/dd") + "'";
                        string activityQuery = "";
                        atriumDB.ActivityRow[] drActivityArr = (atriumDB.ActivityRow[])fmCur.DB.Activity.Select(activityQuery);
                        atriumDB.ActivityRow   drActivity;
                        if (drActivityArr.Length == 0)
                        {
                            //JL: Change of DisbursementType from ACMAnager dataset to CodesDB dataset bobo.
                            //ActivityConfig.ACSeriesRow bulkACS =(ActivityConfig.ACSeriesRow) myA.AtMng.acMng.DB.ACSeries.Select("ActivityCodeId=" + disbTypeR.GetACDisbRows()[0].ActivityCodeId.ToString())[0];//.FindByACSeriesId(disbTypeR.GetACDisbRows()[0].ACSeriesId);
                            ActivityConfig.ACSeriesRow bulkACS = null;
                            ACEngine ace = fmCur.InitActivityProcess().Add(srpDate, bulkACS, null, false, null);
                            drActivity = ace.NewActivity;

                            drActivity.BeginEdit();
                            drActivity.OfficeId = officeId;
                            drActivity.EndEdit();
                            if (drActivity.HasErrors)
                            {
                                if (drActivity.HasErrors)
                                {
                                    WriteErrorLog(officeFileNo, "", srpDate, Resources.CouldNotCreateAC022 + drActivity.RowError);
                                    encounteredError = true;
                                }
                            }
                        }
                        else
                        {
                            drActivity = drActivityArr[0];
                        }

                        atriumDB.DisbursementRow drDisb = (atriumDB.DisbursementRow)fmCur.GetDisbursement().Add(drActivity);
                        AddDisbursement(drDisb, officeId, disbDate, srpDate, nonTaxableDisb, taxableDisb, disbTypeR.DisbursementType, comment);
                        if (drDisb.HasErrors)
                        {
                            WriteErrorLog(officeFileNo, disbTypeR.DisbursementType, disbDate, Resources.CouldNotAddDisbursement + drDisb.RowError);
                            encounteredError = true;
                        }
                    }
                }
                catch (Exception x)
                {
                    WriteErrorLog(officeFileNo, disbTypeR.DisbursementType, disbDate, Resources.OfficeFileNumberNotValid + x.Message);
                    encounteredError = true;
                }
            }
            else
            {
                WriteErrorLog(officeFileNo, disbTypeR.DisbursementType, disbDate, Resources.InvalidDisbursmentTypeCode);
                encounteredError = true;
            }
        }
Exemple #9
0
        public atriumDB.ContactRow SwapBySIN(atriumDB.ContactRow pr, string SIN)
        {
            if (pr.RowState == DataRowState.Added)
            {
                //load exisiting party row
                LoadBySIN(SIN);

                myA.RaiseWarning(WarningLevel.Display, Properties.Resources.ExistingPartyFound, myA.AtMng.AppMan.AppName);

                var ps = from p in myPersonDT
                         where !p.IsSINNull() && p.SIN == SIN &&
                         pr.ContactId != p.ContactId
                         select p;

                atriumDB.ContactRow existingPerson = ps.Single();


                int currentContactId = pr.ContactId;


                //replace party row in related fields
                ACEngine ace = myA.CurrentActivityProcess.CurrentACE;
                if (ace.relTables.ContainsKey("Party0"))
                {
                    DataView dv = new DataView(myPersonDT, "ContactId=" + existingPerson.ContactId.ToString(), "", DataViewRowState.CurrentRows);

                    ace.relTables["Party0"].RowFilter = dv.RowFilter;
                }

                //swap address
                if (ace.relTables.ContainsKey("Address0") && !existingPerson.IsAddressCurrentIDNull())
                {
                    myA.DB.Address.FindByAddressId(pr.AddressCurrentID).Delete();
                    myA.GetAddress().Load(existingPerson.AddressCurrentID);
                    DataView dv = new DataView(myA.DB.Address, "AddressId=" + existingPerson.AddressCurrentID.ToString(), "", DataViewRowState.CurrentRows);
                    ace.relTables["Address0"].RowFilter = dv.RowFilter;
                }
                else if (ace.relTables.ContainsKey("Address0") && existingPerson.IsAddressCurrentIDNull())
                {
                    atriumDB.AddressRow adr = myA.DB.Address.FindByAddressId(pr.AddressCurrentID);
                    adr.ContactId = existingPerson.ContactId;
                    existingPerson.AddressCurrentID = adr.AddressId;
                }


                //change contact id on filecontact
                var fcs = from fc in myA.DB.FileContact
                          where !fc.IsNull("ContactId") && fc.ContactId == currentContactId
                          select fc;

                if (fcs.Count() == 1)
                {
                    atriumDB.FileContactRow fcr = fcs.Single();
                    fcr.ContactId = existingPerson.ContactId;
                }

                pr.Delete();
                //    pr.AcceptChanges();

                return(existingPerson);
            }
            else
            {
                return(pr);
            }
        }
Exemple #10
0
        private void uiButton1_Click(object sender, EventArgs e)
        {
            try
            {
                //launch Wizard passing ACSeries, ABP?
                NextStep ns = null;
                if (ebStepCode.Tag != null)
                {
                    ns = (NextStep)ebStepCode.Tag;
                }
                if (ns != null)
                {
                    ACEngine test = new ACEngine(fm);
                    test.TestForSteps(ns.acs.ACSeriesId);
                    if (!test.HasAnyRel & (!test.HasDoc | uiCheckBox1.Checked))
                    {
                        atriumBE.ActivityBP abp = fm.InitActivityProcess();
                        if (test.HasDoc)
                        {
                            abp.SkipDoc = uiCheckBox1.Checked;
                        }
                        abp.CreateAC(ns.acs.ACSeriesId, calActivityDate.Value, null, 0, 0, ACEngine.RevType.Nothing);
                        abp.SkipDoc           = false;
                        calActivityDate.Value = DateTime.Today;
                        ebStepCode.Text       = "";
                        ebNSType.Text         = "";
                        Init(fm, ffns);
                        ffns.MoreInfo("activity", abp.LastActivityId.Value);
                        ffns.fileToc.LoadTOC();
                    }
                    else
                    {
                        bool docIsSkipped = false;
                        if (uiCheckBox1.Checked)
                        {
                            docIsSkipped = true;
                        }

                        ebStepCode.Text = "";
                        ebNSType.Text   = "";

                        ffns.ReadOnly = true;
                        if (ns.prevAc != null)
                        {
                            facwr = new fACWizard(fm, (ACEngine.Step)ns.acs.InitialStep, ns.acs.ACSeriesId, ns.prevAc.ActivityId, docIsSkipped);
                        }
                        else
                        {
                            facwr = new fACWizard(fm, (ACEngine.Step)ns.acs.InitialStep, ns.acs.ACSeriesId, docIsSkipped);
                        }
                        facwr.setAcDate(calActivityDate.Value, ns);
                        facwr.Show();
                        calActivityDate.Value = DateTime.Today;
                        DoSkipCheck(null);
                        ffns.HookupWizClose(facwr);
                        ffns.fileToc.LoadTOC();
                    }
                }
                else
                {
                    MessageBox.Show(Properties.Resources.QuickACSelectAValidCode);
                }
            }
            catch (Exception x)
            {
                UIHelper.HandleUIException(x);
            }
        }
Exemple #11
0
        private void CreateDocument(FileManager fm, ActivityBP abp, string lotusDocId, string documentPath, string docSubject, DateTime docDate, List <string> listOfDocAttachments)
        {
            string ext = System.IO.Path.GetExtension(documentPath);

            docDB.FileFormatRow fmt = fm.GetDocMng().DB.FileFormat.FindByFileFormat(ext);

            if (fmt != null && fmt.AllowUpload)
            {
                iCount++;
                ACEngine             ace   = abp.Add(docDate, acsr, null, false, null);
                atriumDB.ActivityRow newAc = ace.NewActivity;
                ace.DocumentDefaults(true);

                docDB.DocumentRow dr = (docDB.DocumentRow)ace.relTables["Document0"][0].Row;

                DocumentBE.LoadFileX(dr, documentPath);

                dr.efSubject = docSubject;
                dr.efDate    = docDate;
                dr.Source    = "Lotus: " + lotusDocId;
                dr.IsDraft   = false;
                AddListItem("Document added: " + System.IO.Path.GetFileName(documentPath));

                if (listOfDocAttachments.Count > 0)
                {
                    DocManager            myDM = fm.GetDocMng();
                    atriumBE.AttachmentBE d    = myDM.GetAttachment();

                    foreach (string attachment in listOfDocAttachments)
                    {
                        string localAttach = attachment;
                        string attExt      = Path.GetExtension(localAttach);
                        if (attExt.Length > 10)
                        {
                            attExt = attExt.Substring(0, 10);
                            //modify extension on disk
                            File.Move(attachment, Path.ChangeExtension(attachment, attExt));
                            localAttach = Path.Combine(Path.GetDirectoryName(attachment), Path.GetFileNameWithoutExtension(attachment) + attExt);
                        }

                        //if extension is empty, modify doc extension
                        //.LONOEXT
                        if (string.IsNullOrEmpty(attExt))
                        {
                            AddExtensionToDocWithoutExt(attachment);
                            attExt      = ".LONOEXT";
                            localAttach = localAttach + attExt;
                        }

                        docDB.FileFormatRow attFmt = fm.GetDocMng().DB.FileFormat.FindByFileFormat(attExt);

                        //if extension not allowed, add it
                        if (attFmt == null)
                        {
                            AddExtensionToFileFormatTable(attExt, fm.GetDocMng().DB.FileFormat);
                            attFmt = fm.GetDocMng().DB.FileFormat.FindByFileFormat(attExt);
                        }

                        if (attFmt != null && attFmt.AllowUpload)
                        {
                            docDB.DocumentRow newDoc = (docDB.DocumentRow)myDM.GetDocument().Add(myDM.FM.CurrentFile, localAttach);

                            int indexOfSpaceInAttachment = localAttach.IndexOf(' ') - 1;

                            newDoc.efSubject = Path.GetFileNameWithoutExtension(localAttach).Substring(indexOfSpaceInAttachment).TrimStart(' '); //atts start with 6 digit lotus docNumber + space; let's remove that before import
                            newDoc.efType    = "ATT";
                            newDoc.IsDraft   = false;
                            newDoc.efDate    = newDoc.DocContentRow.ModDate;
                            newDoc.Source    = "Lotus: " + lotusDocId;

                            lmDatasets.docDB.AttachmentRow att = (lmDatasets.docDB.AttachmentRow)d.Add(dr);
                            att.AttachmentId = newDoc.DocId;
                            att.Version      = newDoc.CurrentVersion;
                            AddListItem("Attachment added: " + System.IO.Path.GetFileName(localAttach));
                        }
                        else
                        {
                            AddListItem("Attachment - Extension not permitted: " + System.IO.Path.GetFileName(localAttach));
                            ExtTW.WriteLine(attExt + ", " + localAttach);
                        }
                    }
                }

                ace.Save(true, false);
                abp.CurrentACE = null;
            }
            else
            {
                AddListItem("Extension not permitted: " + System.IO.Path.GetFileName(documentPath));
                ExtTW.WriteLine(ext + ", " + documentPath);
            }
        }
Exemple #12
0
        internal void DoACAllSteps(atriumDB.ActivityRow prevAC, ActivityConfig.ACSeriesRow asr, int revId, ACEngine.RevType revType, DateTime acDate, out ACEngine ace, out atriumDB.ActivityRow newAC, Stack <ParentChildStep> _flowQ, string conversationIndex)
        {
            atriumDB.ProcessRow pr = null;
            if (prevAC != null)
            {
                pr = prevAC.ProcessRow;
            }
            ace     = Add(acDate, asr, pr, false, prevAC, ConnectorType.NextStep, _flowQ, revId, revType, conversationIndex, null);
            ace.ctx = ctx;

            newAC = ace.NewActivity;
            if (ace.HasRel0)
            {
                ace.DoStep(ACEngine.Step.RelatedFields0, true);
            }
            if (ace.HasRel1)
            {
                ace.DoStep(ACEngine.Step.RelatedFields1, true);
            }
            if (ace.HasRel2)
            {
                ace.DoStep(ACEngine.Step.RelatedFields2, true);
            }
            if (ace.HasRel3)
            {
                ace.DoStep(ACEngine.Step.RelatedFields3, true);
            }
            if (ace.HasRel4)
            {
                ace.DoStep(ACEngine.Step.RelatedFields4, true);
            }
            if (ace.HasRel5)
            {
                ace.DoStep(ACEngine.Step.RelatedFields5, true);
            }
            if (ace.HasRel6)
            {
                ace.DoStep(ACEngine.Step.RelatedFields6, true);
            }
            if (ace.HasRel7)
            {
                ace.DoStep(ACEngine.Step.RelatedFields7, true);
            }
            if (ace.HasRel8)
            {
                ace.DoStep(ACEngine.Step.RelatedFields8, true);
            }
            if (ace.HasRel9)
            {
                ace.DoStep(ACEngine.Step.RelatedFields9, true);
            }
            if (ace.HasTimeline)
            {
                ace.DoStep(ACEngine.Step.Timeline, true);
            }

            if (ace.HasDoc & !SkipDoc)
            {
                docDB.DocumentRow dr = (docDB.DocumentRow)ace.relTables["Document0"][0].Row;

                //if (TemplateCode != null) //only set the template if it is provided
                //    dr.templateCode = TemplateCode;

                ace.DocumentDefaults(revId != 0);
                // if (dr.DocContentRow == null)
                //FM.GetDocMng().GetDocContent().Load(dr.DocRefId, dr.CurrentVersion);

                Doc0 = dr.DocContentRow.ContentsAsText;
            }
            else
            {
                ace.FM.GetDocMng().DB.RejectChanges();
                ace.relTables.Remove("Document0");

                ace.NewActivity.SetDocIdNull();
            }
            if (ace.HasBilling)
            {
                ace.DoStep(ACEngine.Step.Billing, true);
            }
        }
Exemple #13
0
        private void EI_WS(SST.ADMSLookupRow ADMSr, MapBE map, ADMS.ADMS_LookupClient ws)
        {
            ACEngine ace = myA.FM.CurrentActivityProcess.CurrentACE;

            DataSet ds = ws.Get_ADMS_SST_Info(ADMSr.ReconID, ADMSr.SIN, ADMSr.BusinessNumber);

            if (ds.Tables.Contains("ERROR"))
            {
                //get status message
                ADMSr.Message = ds.Tables["ERROR"].Rows[0]["MESSAGE"].ToString();
                if (ADMSr.Message.ToUpper() == "SUCCESS")
                {
                    if (ds.Tables.Contains("ADMS_SST_INFO"))
                    {
                        DataTable dtR = ds.Tables["ADMS_SST_INFO"];
                        DataRow   dr  = dtR.Rows[0];

                        SST.SSTCaseRow scr = (SST.SSTCaseRow)myA.GetSSTCase().GetCurrentRow()[0];
                        //           scr.AppelantSourceId = System.Convert.ToInt32(map.MapIn("AppelantSource", dr["CODE_SRC"].ToString()));
                        scr.ReconsiderationID = ADMSr.ReconID;
                        if (!dr.IsNull("DATE_DCSN_ISD"))
                        {
                            scr.OrigDecisionDate = System.Convert.ToDateTime(dr["DATE_DCSN_ISD"]);
                        }

                        int officeid = System.Convert.ToInt32(map.MapIn("Office", dr["ID_OFC_ANCHR"].ToString()));
                        atriumDB.FileOfficeRow focr = myA.FM.GetFileOffice().AddOfficeToFile(officeid, false, false, false);
                        focr.OfficeFileNum = scr.ReconsiderationID.ToString();

                        //find the gd account
                        OfficeManager om = myA.AtMng.GetOffice(focr.OfficeId);

                        if (om.DB.Officer.Rows.Count == 0)
                        {
                            om.GetOfficer().LoadByOfficeId(focr.OfficeId);
                        }

                        var oGD = from o in om.DB.Officer
                                  where o.PositionCode == "GD"
                                  select o;

                        if (oGD.Count() == 1)
                        {
                            atriumDB.FileContactRow fcr = myA.FM.GetFileContact().Add(oGD.Single(), "FHGD");
                            fcr.HideInToc = true;
                        }
                        if (ds.Tables.Contains("ADMS_SST_INFO_PARTICIPANTS"))
                        {
                            // string participantType = map.MapIn("Source2Participant", dr["CODE_SRC"].ToString());
                            foreach (DataRow drp in ds.Tables["ADMS_SST_INFO_PARTICIPANTS"].Rows)
                            {
                                bool isAppellant = false;
                                if (!ADMSr.IsSINNull() && !drp.IsNull("ID_SIN") && ADMSr.SIN == drp["ID_SIN"].ToString())
                                {
                                    isAppellant = true;
                                }
                                else if (!ADMSr.IsBusinessNumberNull() && !drp.IsNull("ID_BSNS_NMBR"))
                                {
                                    isAppellant = IsEmployerAppellant(ADMSr, drp, isAppellant);
                                }
                                if (isAppellant)
                                {
                                    atriumDB.ContactRow     pr   = (atriumDB.ContactRow)ace.relTables["Party0"][0].Row;
                                    atriumDB.FileContactRow fcr4 = (atriumDB.FileContactRow)ace.relTables["FileContact4"][0].Row;
                                    SST.FilePartyRow        fpr  = (SST.FilePartyRow)ace.relTables["FileParty0"][0].Row;

                                    fpr.IsAppellant = true;

                                    pr.SIN          = drp["ID_SIN"].ToString();
                                    pr.ContactClass = "P";
                                    //if (pr.GetColumnError("SIN") == Properties.Resources.DebtDuplicateSIN)
                                    //changed test to test for Added as the column error would never be present on the exisiting contact after the swap
                                    if (pr.RowState != DataRowState.Added)
                                    {
                                        //TFS#54669 CJW 2013-09-20  called in PersonBE beforechange now
                                        //pr = myA.FM.GetPerson().SwapBySIN(pr, pr.SIN);

                                        pr   = (atriumDB.ContactRow)ace.relTables["Party0"][0].Row;
                                        fcr4 = (atriumDB.FileContactRow)ace.relTables["FileContact4"][0].Row;
                                        fpr  = (SST.FilePartyRow)ace.relTables["FileParty0"][0].Row;

                                        //alert user off swap
                                        ADMSr.Message = Properties.Resources.ExistingPartyFound;
                                    }
                                    pr.LastName     = drp["NAME_INDVDL_LST"].ToString();
                                    pr.FirstName    = drp["NAME_INDVDL_FRST"].ToString();
                                    pr.LanguageCode = map.MapIn("LanguageCode", drp["CODE_LNG"].ToString());

                                    pr.BusinessNumber = drp["ID_BSNS_NMBR"].ToString();
                                    pr.LegalName      = drp["NAME_ORG"].ToString();
                                    pr.OperatingAs    = drp["NAME_ORG_UNT"].ToString();

                                    pr.PartyTypeCode = map.MapIn("ContactType", drp["CODE_PRTCPNT_TYP"].ToString());

                                    fcr4.ContactId    = pr.ContactId;
                                    fcr4.ContactType  = pr.PartyTypeCode;
                                    fpr.FileContactId = fcr4.FileContactid;

                                    pr.TelephoneNumber = drp["NMBR_TLPHN_AR_CD_H"].ToString() + "-" + drp["NMBR_TLPHN_LCL_H"].ToString();
                                    if (!pr.IsAddressCurrentIDNull())
                                    {
                                        atriumDB.AddressRow ar = myA.FM.DB.Address.FindByAddressId(pr.AddressCurrentID);
                                        ar.ContactId         = pr.ContactId;
                                        ar.EffectiveTo       = DateTime.Today;
                                        ar.AddressSourceCode = "HRDC";
                                        ar.Address1          = drp["ADRS_LN_1"].ToString();
                                        ar.Address2          = drp["ADRS_LN_2"].ToString();
                                        ar.Address3          = drp["ADRS_LN_3"].ToString();
                                        string prov = map.MapIn("Province", drp["CODE_PRVNC_OR_ST"].ToString());
                                        if (prov != null)
                                        {
                                            DataTable dtProv = myA.FM.Codes("Province");
                                            DataRow   drs    = dtProv.Rows.Find(prov);

                                            if (drs != null)
                                            {
                                                ar.CountryCode = drs["CountryCode"].ToString();
                                            }
                                            else
                                            {
                                                ar.CountryCode = "CDN";
                                            }
                                        }
                                        else
                                        {
                                            ar.CountryCode = map.MapIn("Country", drp["NAME_CNTRY"].ToString());
                                            if (drp.IsNull("NAME_CNTRY") || ar.IsNull("CountryCode"))
                                            {
                                                ar.CountryCode = "CDN";
                                            }
                                        }
                                        ar.ProvinceCode = prov;
                                        ar.City         = drp["ADRS_MNCPLTY"].ToString();
                                        ar.PostalCode   = drp["CODE_PSTL_OR_ZIP"].ToString();
                                    }
                                }
                                else
                                {
                                    //add other participants automatically
                                    AddOtherParty(map, drp);
                                }
                            }
                        }
                    }
                }
                else if (ADMSr.Message.ToUpper() == "ERROR")
                {
                    //    ADMSr.SetColumnError("Message", ADMSr.Message);
                    ADMSr.Message = ds.Tables["ERROR"].Rows[0]["SQL"].ToString();
                    if (ADMSr.Message.StartsWith("ORA-01403"))
                    {
                        ADMSr.Message = "No matching reconsideration found in ADMS. / Aucune révision correspondante trouvée dans le SGPA.";
                    }
                    else if (ADMSr.Message.StartsWith("ORA-01422"))
                    {
                        ADMSr.Message = "More than one matching reconsideration found in ADMS. / Il y a plus qu'une révision correspondante trouvée dans le SGPA.";
                    }
                    else if (ADMSr.Message.StartsWith("ORA-1017"))
                    {
                        ADMSr.Message = "Configuration problem with ADMS EI web service.  Contact IT support. / Il y a un problème de configuration avec le service web A-E SGPA. Contactez le support TI.";
                    }
                    else if (ADMSr.Message.StartsWith("ORA-12154"))
                    {
                        ADMSr.Message = "Configuration problem with ADMS EI web service.  Contact IT support. / Il y a un problème de configuration avec le service web A-E SGPA. Contactez le support TI.";
                    }
                }
            }
        }
Exemple #14
0
        private void EP_WS(SST.ADMSLookupRow ADMSr, MapBE map, ADMS.ADMS_LookupClient ws)
        {
            //only add other parties

            ACEngine ace = myA.FM.CurrentActivityProcess.CurrentACE;

            DataSet ds = ws.Get_ADMS_SST_Info(ADMSr.ReconID, ADMSr.SIN, ADMSr.BusinessNumber);

            if (ds.Tables.Contains("ERROR"))
            {
                //get status message
                ADMSr.Message = ds.Tables["ERROR"].Rows[0]["MESSAGE"].ToString();
                if (ADMSr.Message.ToUpper() == "SUCCESS")
                {
                    if (ds.Tables.Contains("ADMS_SST_INFO"))
                    {
                        DataTable dtR = ds.Tables["ADMS_SST_INFO"];
                        DataRow   dr  = dtR.Rows[0];

                        if (ds.Tables.Contains("ADMS_SST_INFO_PARTICIPANTS"))
                        {
                            // string participantType = map.MapIn("Source2Participant", dr["CODE_SRC"].ToString());
                            foreach (DataRow drp in ds.Tables["ADMS_SST_INFO_PARTICIPANTS"].Rows)
                            {
                                bool isAppellant = false;
                                if (!ADMSr.IsSINNull() && !drp.IsNull("ID_SIN") && ADMSr.SIN == drp["ID_SIN"].ToString())
                                {
                                    isAppellant = true;
                                }
                                else if (!ADMSr.IsBusinessNumberNull() && !drp.IsNull("ID_BSNS_NMBR"))
                                {
                                    isAppellant = IsEmployerAppellant(ADMSr, drp, isAppellant);
                                }
                                if (isAppellant)
                                {
                                    ////ignore
                                    //atriumDB.ContactRow pr = (atriumDB.ContactRow)ace.relTables["Party0"][0].Row;
                                    //atriumDB.FileContactRow fcr4 = (atriumDB.FileContactRow)ace.relTables["FileContact4"][0].Row;
                                    //SST.FilePartyRow fpr = (SST.FilePartyRow)ace.relTables["FileParty0"][0].Row;

                                    //fpr.IsAppellant = true;

                                    //pr.SIN = drp["ID_SIN"].ToString();
                                    //pr.ContactClass = "P";
                                    //if (pr.GetColumnError("SIN") == Properties.Resources.DebtDuplicateSIN)
                                    //{
                                    //    //TFS#54669 CJW 2013-09-20  called in PersonBE beforechange now
                                    //    //pr = myA.FM.GetPerson().SwapBySIN(pr, pr.SIN);

                                    //    pr = (atriumDB.ContactRow)ace.relTables["Party0"][0].Row;
                                    //    fcr4 = (atriumDB.FileContactRow)ace.relTables["FileContact4"][0].Row;
                                    //    fpr = (SST.FilePartyRow)ace.relTables["FileParty0"][0].Row;

                                    //    //alert user off swap
                                    //    ADMSr.Message = Properties.Resources.ExistingPartyFound;
                                    //}
                                    //pr.LastName = drp["NAME_INDVDL_LST"].ToString();
                                    //pr.FirstName = drp["NAME_INDVDL_FRST"].ToString();
                                    //pr.LanguageCode = map.MapIn("LanguageCode", drp["CODE_LNG"].ToString());

                                    //pr.BusinessNumber = drp["ID_BSNS_NMBR"].ToString();
                                    //pr.LegalName = drp["NAME_ORG"].ToString();
                                    //pr.OperatingAs = drp["NAME_ORG_UNT"].ToString();

                                    //pr.PartyTypeCode = map.MapIn("ContactType", drp["CODE_PRTCPNT_TYP"].ToString());

                                    //fcr4.ContactId = pr.ContactId;
                                    //fcr4.ContactType = pr.PartyTypeCode;
                                    //fpr.FileContactId = fcr4.FileContactid;

                                    //pr.TelephoneNumber = drp["NMBR_TLPHN_AR_CD_H"].ToString() + "-" + drp["NMBR_TLPHN_LCL_H"].ToString();
                                    //if (!pr.IsAddressCurrentIDNull())
                                    //{
                                    //    atriumDB.AddressRow ar = myA.FM.DB.Address.FindByAddressId(pr.AddressCurrentID);
                                    //    ar.ContactId = pr.ContactId;
                                    //    ar.EffectiveTo = DateTime.Today;
                                    //    ar.AddressSourceCode = "HRDC";
                                    //    ar.Address1 = drp["ADRS_LN_1"].ToString();
                                    //    ar.Address2 = drp["ADRS_LN_2"].ToString();
                                    //    ar.Address3 = drp["ADRS_LN_3"].ToString();
                                    //    ar.CountryCode = map.MapIn("Country", drp["NAME_CNTRY"].ToString());
                                    //    if (drp.IsNull("NAME_CNTRY"))
                                    //        ar.CountryCode = "CDN";
                                    //    ar.ProvinceCode = map.MapIn("Province", drp["CODE_PRVNC_OR_ST"].ToString());
                                    //    ar.City = drp["ADRS_MNCPLTY"].ToString();
                                    //    ar.PostalCode = drp["CODE_PSTL_OR_ZIP"].ToString();

                                    //}
                                }
                                else
                                {
                                    //add other participants automatically
                                    string pt = map.MapIn("ContactType", drp["CODE_PRTCPNT_TYP"].ToString());
                                    if (pt == "PCL" || pt == "PEMP")
                                    {
                                        AddOtherParty(map, drp);
                                    }
                                }
                            }
                        }
                    }
                }
                else if (ADMSr.Message.ToUpper() == "ERROR")
                {
                    //ADMSr.SetColumnError("Message", ADMSr.Message);
                    ADMSr.Message = ds.Tables["ERROR"].Rows[0]["SQL"].ToString();
                    if (ADMSr.Message.StartsWith("ORA-01403"))
                    {
                        ADMSr.Message = "No matching reconsideration found in ADMS. / Aucune révision correspondante trouvée dans le SGPA.";
                    }
                    else if (ADMSr.Message.StartsWith("ORA-01422"))
                    {
                        ADMSr.Message = "More than one matching reconsideration found in ADMS. / Il y a plus qu'une révision correspondante trouvée dans le SGPA.";
                    }
                    else if (ADMSr.Message.StartsWith("ORA-1017"))
                    {
                        ADMSr.Message = "Configuration problem with ADMS EI web service.  Contact IT support. / Il y a un problème de configuration avec le service web A-E SGPA. Contactez le support TI.";
                    }
                    else if (ADMSr.Message.StartsWith("ORA-12154"))
                    {
                        ADMSr.Message = "Configuration problem with ADMS EI web service.  Contact IT support. / Il y a un problème de configuration avec le service web A-E SGPA. Contactez le support TI.";
                    }
                }
            }
        }
Exemple #15
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);
            }
        }
Exemple #16
0
        public void ExecuteAction(FileManager fm, DataRow dr2Validate, ActivityConfig.ACSeriesRow acsr)
        {
            dr2Validate.EndEdit();

            ACEngine MyACE = new ACEngine(fm);

            MyACE.myAcSeries     = acsr;
            MyACE.myActivityCode = acsr.ActivityCodeRow;

            MyACE.AddToRelTables(dr2Validate, "CONTEXT");

            MyACE.DoRelFields();
            if (MyACE.HasRel0)
            {
                MyACE.DoStep(ACEngine.Step.RelatedFields0, true);
            }
            if (MyACE.HasRel1)
            {
                MyACE.DoStep(ACEngine.Step.RelatedFields1, true);
            }
            if (MyACE.HasRel2)
            {
                MyACE.DoStep(ACEngine.Step.RelatedFields2, true);
            }
            if (MyACE.HasRel3)
            {
                MyACE.DoStep(ACEngine.Step.RelatedFields3, true);
            }
            if (MyACE.HasRel4)
            {
                MyACE.DoStep(ACEngine.Step.RelatedFields4, true);
            }
            if (MyACE.HasRel5)
            {
                MyACE.DoStep(ACEngine.Step.RelatedFields5, true);
            }
            if (MyACE.HasRel6)
            {
                MyACE.DoStep(ACEngine.Step.RelatedFields6, true);
            }
            if (MyACE.HasRel7)
            {
                MyACE.DoStep(ACEngine.Step.RelatedFields7, true);
            }
            if (MyACE.HasRel8)
            {
                MyACE.DoStep(ACEngine.Step.RelatedFields8, true);
            }
            if (MyACE.HasRel9)
            {
                MyACE.DoStep(ACEngine.Step.RelatedFields9, true);
            }
            if (MyACE.HasTimeline)
            {
                MyACE.DoStep(ACEngine.Step.Timeline, true);
            }
            //if (MyACE.HasDoc)
            //{
            //    docDB.DocumentRow dr = (docDB.DocumentRow)MyACE.relTables["Document0"][0].Row;

            //    MyACE.DocumentDefaults(0 != 0);

            //}
            if (MyACE.HasBilling)
            {
                MyACE.DoStep(ACEngine.Step.Billing, true);
            }
        }
Exemple #17
0
        //rules
        public void EvaluateRule(FileManager fm, appDB.ddRuleRow ddrr, DataRow dr2Validate)
        {
            ActivityConfig.ACSeriesRow acsr = fm.AtMng.acMng.DB.ACSeries.FindByACSeriesId(ddrr.ACSeriesId);

            //we need to endedit on the current record so that it can be evaluated by datatable.select operations
            dr2Validate.EndEdit();

            ACEngine MyACE = new ACEngine(fm);

            MyACE.myAcSeries     = acsr;
            MyACE.myActivityCode = acsr.ActivityCodeRow;

            MyACE.AddToRelTables(dr2Validate, "CONTEXT");

            //MyACE.LoadDataForStep(-10, acsr.ACSeriesId);
            MyACE.DoRelFields();
            //consider the blocks as short-circuited or's
            //eg  A || B || C
            //we succeed on the first successful block


            if (MyACE.HasRel0)
            {
                MyACE.LoadDataForStep(0, acsr.ACSeriesId);
                if (!MyACE.skipBlock)
                {
                    return;
                }
            }
            if (MyACE.HasRel1)
            {
                MyACE.LoadDataForStep(1, acsr.ACSeriesId);
                if (!MyACE.skipBlock)
                {
                    return;
                }
            }
            if (MyACE.HasRel2)
            {
                MyACE.LoadDataForStep(2, acsr.ACSeriesId);
                if (!MyACE.skipBlock)
                {
                    return;
                }
            }
            if (MyACE.HasRel3)
            {
                MyACE.LoadDataForStep(3, acsr.ACSeriesId);
                if (!MyACE.skipBlock)
                {
                    return;
                }
            }
            if (MyACE.HasRel4)
            {
                MyACE.LoadDataForStep(4, acsr.ACSeriesId);
                if (!MyACE.skipBlock)
                {
                    return;
                }
            }
            if (MyACE.HasRel5)
            {
                MyACE.LoadDataForStep(5, acsr.ACSeriesId);
                if (!MyACE.skipBlock)
                {
                    return;
                }
            }

            //rule failed

            string msg = myA.acMng.DB.ACDocumentation.FindByACDocId(ddrr.MsgId)[myA.Translate("TextEng")].ToString();

            throw new AtriumException(msg);
        }
Exemple #18
0
        private void MakeFile(string file, FileManager fmRoot)
        {
            FileManager fm;

            fm = fmRoot;

            if (chkNewFile.Checked)
            {
                iFiles++;
                fm = AtMng.CreateFile(fmRoot);

                if (!fmRoot.CurrentFile.FileMetaTypeRow.SubFileAutoNumber)
                {
                    fm.CurrentFile.FileNumber = "999";
                }
                fm.CurrentFile.NameE    = System.IO.Path.GetFileName(file);
                fm.CurrentFile.NameF    = System.IO.Path.GetFileName(file);
                fm.CurrentFile.FileType = ucMultiDropDown2.SelectedValue.ToString();

                atLogic.BusinessProcess bp = fm.GetBP();

                bp.AddForUpdate(fm.EFile);
                bp.AddForUpdate(fm.GetFileXRef());
                bp.AddForUpdate(fm.GetFileOffice());

                bp.Update();

                AddListItem("Created file " + file);
            }

            ActivityBP abp = fm.InitActivityProcess();

            foreach (string doc in System.IO.Directory.GetFiles(file))
            {
                string ext = System.IO.Path.GetExtension(doc);
                docDB.FileFormatRow fmt = fm.GetDocMng().DB.FileFormat.FindByFileFormat(ext);
                if (fmt != null && fmt.AllowUpload)
                {
                    iCount++;
                    ACEngine             ace   = abp.Add(DateTime.Today, acsr, null, false, null);
                    atriumDB.ActivityRow newAc = ace.NewActivity;
                    ace.DocumentDefaults(true);

                    //ace.DoStep(0);

                    //get the document from related fields
                    docDB.DocumentRow dr = (docDB.DocumentRow)ace.relTables["Document0"][0].Row;

                    DocumentBE.LoadFileX(dr, doc);

                    AddListItem("Added document: " + System.IO.Path.GetFileName(doc));
                    ace.Save(true, false);
                    abp.CurrentACE = null;
                }
                else
                {
                    AddListItem("ILLEGAL EXTENSION: " + System.IO.Path.GetFileName(doc));
                }
            }


            if (chkInclude.Checked)
            {
                chkNewFile.Checked = true;
                foreach (string subfile in System.IO.Directory.GetDirectories(file))
                {
                    MakeFile(subfile, fm);
                }
            }
        }