コード例 #1
0
        private void WriteErrorLog(string errorMsg)
        {
            if (errorLog == null)
            {
                //create error log doc
                errorLog = (docDB.DocumentRow)myA.GetDocMng().GetDocument().Add(myA.CurrentFile);
                myA.GetDocMng().GetDocContent().Add(errorLog);
                errorLog.IsDraft                      = true;
                errorLog.DocContentRow.Ext            = ".txt";
                errorLog.efSubject                    = DocumentBE.VerifySubjectLength(Resources.DisbursementImportErrorLog);
                errorLog.DocContentRow.ContentsAsText = Resources.DisbErrorHeader + Environment.NewLine;
            }
            //StreamWriter sr;

            //if (!File.Exists(filePath))
            //    sr = File.CreateText(filePath);
            //else
            //    sr = new StreamWriter(filePath, true);

            //sr.WriteLine (errorMsg);
            //sr.Close();

            errorLog.DocContentRow.ContentsAsText += errorMsg + Environment.NewLine;

            BusinessProcess bp = myA.GetDocMng().GetBP();

            bp.AddForUpdate(myA.GetDocMng().GetDocContent());
            bp.AddForUpdate(myA.GetDocMng().GetDocument());
            bp.Update();
        }
コード例 #2
0
        public DocumentBE GetDocument()
        {
            if (myDocument == null)
            {
                myDocument = new DocumentBE(this);
            }

            return(myDocument);
        }
コード例 #3
0
        private void DumpDocs(SST.DocDumpRow ddr)
        {
            SST.DocTransferRow drDocTran = myA.DB.DocTransfer[0];

            ActivityBP abp = myA.FM.CurrentActivityProcess;

            if (abp.CurrentACE != null)
            {
                drDocTran = (SST.DocTransferRow)abp.CurrentACE.relTables["DocTransfer0"][0].Row;
            }

            string dir = myA.GetDocTransfer().GetDocDumpShare(drDocTran) + @"\" + drDocTran.OutSubFolder;

            DocContentBE dcBE = myA.FM.GetDocMng().GetDocContent();
            DocumentBE   dBE  = myA.FM.GetDocMng().GetDocument();

            if (ddr.Dump)
            {
                docDB.DocumentRow dr = myA.FM.GetDocMng().DB.Document.FindByDocId(ddr.DocId);
                if (dr.DocContentRow == null)
                {
                    dcBE.Load(dr.DocRefId, dr.CurrentVersion);
                }

                string fileName = dcBE.GetTempFileName(dr, dir);

                //dcBE.WriteDoc(dBE.Print(dr), false, fileName);
                try
                {
                    dcBE.WriteDoc(dBE.Print(dr), false, fileName);
                    dr.SentToShareFolder = 2;
                }
                catch (Exception x)
                {
                    dr.SentToShareFolder = 3;

                    ddr.SetColumnError("Dump", String.Format(Properties.Resources.DocDumpFailed + " " + x.Message, dr.Name));  //setting this error will prevent saving the records
                    myA.AtMng.LogError(x);
                    //myA.FM.RaiseWarning(WarningLevel.Display,String.Format( Properties.Resources.DocDumpFailed,fileName), "ATRIUM");
                }
                dr.DocDumpDate     = DateTime.Now;
                dr.DocDumpFullPath = fileName;
                dr.DocDumpUser     = myA.AtMng.OfficerLoggedOn.UserName;
            }
        }
コード例 #4
0
        private void LoadOutlookFreeBusy(int ContactId, DateTime startDate, DateTime endDate)
        {
            //get email for contact
            officeDB.OfficerRow or = myA.AtMng.OfficeMng.DB.Officer.FindByOfficerId(ContactId);
            if (or == null)
            {
                or = myA.AtMng.OfficeMng.GetOfficer().Load(ContactId);
            }

            if (or != null)
            {
                string sEmail = or.EmailAddress;

                //get addressentry from RDO
                Redemption.RDOSession sess = DocumentBE.RDOSession();
                sess.Logon(missing, missing, missing, missing, missing, missing);
                //Redemption.RDOAddressList gal = sess.AddressBook.GAL;
                Redemption.RDOAddressEntry ae = sess.AddressBook.ResolveName(sEmail);
                //get free busy
                if (ae.Type == "EX")
                {
                    string s = ae.GetFreeBusy(startDate, 30);
                    Redemption.RDOFreeBusyRange fbr = ae.FreeBusyList;
                    //loop over array
                    foreach (Redemption.RDOFreeBusySlot fbs in fbr)
                    {
                        //load myTimelineDT
                        atriumDB.TimeLineRow tlr = myTimelineDT.NewTimeLineRow();
                        tlr.ContactId = ContactId;
                        tlr.StartDate = fbs.Start;
                        tlr.EndDate   = fbs.End;
                        myTimelineDT.AddTimeLineRow(tlr);
                    }
                }
            }
        }
コード例 #5
0
        private void ddListSelectionMade()
        {
            switch (cbNameList.SelectedValue.ToString())
            {
            case "Search":
                IsSearch = true;

                pnlContact.Closed     = false;
                pnlFileContact.Closed = true;
                pnlOwner.Closed       = true;
                pnlLists.Closed       = true;

                contactBindingSource.DataSource = null;
                contactBindingSource.DataMember = "";
                tbSearchName.Focus();
                this.AcceptButton = btnSearch;

                break;

            case "MyAddressBook":
            case "CurrentFileContacts":
                IsSearch = false;

                pnlFileContact.Closed = false;
                pnlContact.Closed     = true;
                pnlOwner.Closed       = true;
                pnlLists.Closed       = true;
                string activeFilter3 = "";
                if (ActiveOnly)
                {
                    activeFilter3 = "Active=1";
                }
                if (PartiesOnly)
                {
                    if (ActiveOnly)
                    {
                        activeFilter3 += " and ";
                    }

                    activeFilter3 += "ContactClass='P'";
                }
                DataView dvFC;
                if (cbNameList.SelectedValue.ToString() == "CurrentFileContacts")
                {
                    //fmCurrent.GetFileContact().LoadByFileId(fmCurrent.CurrentFile.FileId);
                    dvFC = new DataView(fmCurrent.DB.FileContact, activeFilter3, "", DataViewRowState.CurrentRows);
                }
                else     //Address Book
                {
                    FileManager fm = fmCurrent.AtMng.GetFile(fmCurrent.AtMng.WorkingAsOfficer.MyFileId);
                    //fm.GetFileContact().LoadByFileId(fm.CurrentFile.FileId);
                    dvFC = new DataView(fm.DB.FileContact, activeFilter3, "", DataViewRowState.CurrentRows);
                }

                fileContactBindingSource.DataSource = dvFC;
                fileContactBindingSource.DataMember = "";
                fileContactGridEX.SetDataBinding(fileContactBindingSource, null);
                fileContactGridEX.Focus();
                this.AcceptButton = null;

                break;

            case "LawMateDistributionList":
                IsSearch = false;

                pnlFileContact.Closed = true;
                pnlContact.Closed     = true;
                pnlOwner.Closed       = true;
                pnlLists.Closed       = false;

                fmCurrent.AtMng.GetList().Load();

                listBindingSource.DataSource = fmCurrent.AtMng.DB;
                listBindingSource.DataMember = fmCurrent.AtMng.DB.List.TableName;
                listBindingSource.Filter     = "SyncExchange=True";
                listGridEX.SetDataBinding(listBindingSource, null);
                listGridEX.Focus();
                this.AcceptButton = null;
                break;

            case "OwnerOffice":
            case "LeadOffice":
            case "MyOffice":
            case "AllOffices":
                IsSearch = false;

                pnlFileContact.Closed = true;
                pnlContact.Closed     = true;
                pnlOwner.Closed       = false;
                pnlLists.Closed       = true;

                string activeFilter = "", activeFilter1 = "";
                if (ActiveOnly)
                {
                    activeFilter  = "CurrentEmployee=1";
                    activeFilter1 = "CurrentEmployee=1 and ";
                }

                switch (cbNameList.SelectedValue.ToString())
                {
                case "AllOffices":
                    if (!AllOfficesLoaded)
                    {
                        fmCurrent.AtMng.OfficeMng.GetOfficer().Load();
                        dvAllOffices     = new DataView(fmCurrent.AtMng.OfficeMng.DB.Officer, activeFilter, "", DataViewRowState.CurrentRows);
                        AllOfficesLoaded = true;
                    }
                    officerBindingSource.DataSource = dvAllOffices;
                    break;

                case "OwnerOffice":
                    if (!OwnerLoaded)
                    {
                        fmCurrent.AtMng.OfficeMng.GetOfficer().LoadByOfficeId(fmCurrent.CurrentFile.OwnerOfficeId);
                        dvOwner     = new DataView(fmCurrent.AtMng.OfficeMng.DB.Officer, activeFilter1 + "OfficeId=" + fmCurrent.CurrentFile.OwnerOfficeId.ToString(), "", DataViewRowState.CurrentRows);
                        OwnerLoaded = true;
                    }
                    officerBindingSource.DataSource = dvOwner;
                    break;

                case "LeadOffice":
                    if (!LeadLoaded)
                    {
                        fmCurrent.AtMng.OfficeMng.GetOfficer().LoadByOfficeId(fmCurrent.CurrentFile.LeadOfficeId);
                        dvLead     = new DataView(fmCurrent.AtMng.OfficeMng.DB.Officer, activeFilter1 + "OfficeId=" + fmCurrent.CurrentFile.LeadOfficeId.ToString(), "", DataViewRowState.CurrentRows);
                        LeadLoaded = true;
                    }
                    officerBindingSource.DataSource = dvLead;
                    break;

                case "MyOffice":
                    if (!MyOfficeLoaded)
                    {
                        fmCurrent.AtMng.OfficeMng.GetOfficer().LoadByOfficeId(fmCurrent.AtMng.OfficeLoggedOn.OfficeId);
                        dvMyOffice     = new DataView(fmCurrent.AtMng.OfficeMng.DB.Officer, activeFilter1 + "OfficeId=" + fmCurrent.AtMng.OfficeLoggedOn.OfficeId.ToString(), "", DataViewRowState.CurrentRows);
                        MyOfficeLoaded = true;
                    }
                    officerBindingSource.DataSource = dvMyOffice;
                    break;
                }
                OwnerGridEx.Focus();
                this.AcceptButton = null;

                break;

            case "Outlook":
                IsSearch = false;
                Redemption.MAPIUtils mapiUtil = DocumentBE.MAPIUtils();
                try
                {
                    Redemption.SafeRecipients recips = mapiUtil.AddressBook(missing, missing, 3, true, missing, missing, missing, missing, missing);
                    if (recips != null)
                    {
                        for (int i = 1; i <= recips.Count; i++)
                        {
                            Redemption.SafeRecipient recip = recips.Item(i);

                            if (recip.Type == 1)
                            {
                                ucRecipientTextBoxTo.Add(recip.AddressEntry.SMTPAddress, recip.Name);
                            }
                            else if (recip.Type == 2)
                            {
                                ucRecipientTextBoxCc.Add(recip.AddressEntry.SMTPAddress, recip.Name);
                            }
                        }
                    }
                }
                catch (Exception x)
                {
                    UIHelper.HandleUIException(x);
                }
                mapiUtil.Cleanup();
                break;
            }

            lblTypeName.Visible  = IsSearch;
            tbSearchName.Visible = IsSearch;
            btnSearch.Visible    = IsSearch;
        }
コード例 #6
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);
                }
            }
        }
コード例 #7
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);
            }
        }
コード例 #8
0
        public void Resolve(string userInput, string display, docDB.RecipientRow newR, bool showDialog)
        {
            officeDB.OfficerRow or = null;

            //TODO:resolve from autocomplete first!
            userInput = userInput.Replace("'", "''");

            //not sure why auto-complete was taking precedence
            //this will prevent look up from resolving officer before they were created
            or = myA.AtMng.OfficeMng.GetOfficer().LoadByEmail(userInput);
            if (or != null && or.CurrentEmployee)
            {
                Resolve(or, newR);
                return;
            }

            //JL: old email addresses with 'INET[' fail on line below:  Address='" + userInput +"
            //data clean up required?
            //userInput = userInput.Replace("INET[", "");
            //userInput = userInput.Replace("]", "");

            DataRow[] drAuto = myA.AtMng.RecipientGetRecentSent().Select("Address='" + userInput + "'");
            if (drAuto.Length > 0)
            {
                //add recipient row
                if (drAuto[0].IsNull("OfficerId"))
                {
                    newR.Address = drAuto[0]["email"].ToString();
                    newR.Name    = drAuto[0]["Name"].ToString();
                    if (!drAuto[0].IsNull("ListId"))
                    {
                        newR.ListId = (int)drAuto[0]["ListId"];
                    }
                }
                else
                {
                    or = myA.AtMng.OfficeMng.GetOfficer().FindLoad((int)drAuto[0]["OfficerId"]);
                    if (or != null)
                    {
                        Resolve(or, newR);
                    }
                    else
                    {
                        newR.OfficerId = (int)drAuto[0]["OfficerId"];
                        newR.Address   = drAuto[0]["email"].ToString();
                        newR.Name      = drAuto[0]["Name"].ToString();
                    }
                }
                return;
            }

            ////resolve by officecode
            //try
            //{
            //    officeDB.OfficeRow off = myA.AtMng.GetOffice(userInput).CurrentOffice;
            //    Resolve(off,   newR);
            //    return;
            //}
            //catch (Exception xo)
            //{
            //    //do nothing it just means the office didn't exist
            //}

            //resolve by list
            appDB.ListRow[] lr = (appDB.ListRow[])myA.AtMng.DB.List.Select("ListNameEng like '" + userInput + "%'");
            if (lr.Length > 0)
            {
                Resolve(lr[0], newR);
                return;
            }

            //resolve by role on file
            atriumDB.FileContactRow fcr = myA.FM.GetFileContact().GetByRole(userInput);
            if (fcr != null && fcr.Active)
            {
                //if it is not an officer then get the contact record
                if (fcr.IsOfficeIdNull())
                {
                    atriumDB.ContactRow cr = fcr.ContactRow;
                    if (cr == null)
                    {
                        myA.FM.GetPerson().Load(fcr.ContactId);
                    }

                    Resolve(cr, newR);
                    return;
                }
                else
                {
                    or = myA.AtMng.OfficeMng.GetOfficer().FindLoad(fcr.ContactId);
                }
            }

            if (or == null)
            {
                //resolve by officer code first
                or = myA.AtMng.OfficeMng.GetOfficer().LoadByOfficerCode(userInput);
                if (or != null && !or.CurrentEmployee)
                {
                    or = null;
                }
            }
            if (or != null)
            {
                Resolve(or, newR);
                return;
            }

            //or = myA.AtMng.OfficeMng.GetOfficer().LoadByEmail(userInput);
            //if (or != null && or.CurrentEmployee )
            //{
            //    Resolve(or, newR);
            //    return;
            //}

            if (!newR.DocumentRow.isLawmail)
            {
                //this is good for non-comm documents
                newR.Address     = userInput;
                newR.Name        = display;
                newR.AddressType = "NONE";
            }
            else
            {
                string addrType = "SMTP";


                try
                {
                    Redemption.MAPIUtils mapiUtil = DocumentBE.MAPIUtils();

                    Redemption.SafeRecipient rdoRecip = mapiUtil.CreateRecipient(userInput, showDialog, 0);

                    addrType = "SMTP";//always get the SMTP address rdoRecip.AddressEntry.Type;
                    //resolution of distrib lists gets done  on acbf now
                    //if (addrType == "SMTP")
                    //    userInput = rdoRecip.AddressEntry.SMTPAddress;
                    //else if (addrType == "MAPIPDL")
                    //{
                    //    //go thorugh all entries in list
                    //    Redemption.AddressEntry ade = rdoRecip.AddressEntry;
                    //    Redemption.AddressEntries mbrs = (Redemption.AddressEntries)ade.Members;
                    //    foreach (Redemption.AddressEntry addr in mbrs)
                    //    {
                    //        if (addr.Type == "EX")
                    //            Add(addr.Address, addr.Name);
                    //        else
                    //            Add(addr.SMTPAddress, addr.Name);
                    //    }
                    //    return;
                    //}
                    //else

                    userInput = rdoRecip.AddressEntry.SMTPAddress;
                    if (userInput == null || userInput == "")
                    {
                        addrType  = "X400";
                        userInput = rdoRecip.Address;
                    }
                    display = rdoRecip.Name;
                }
                catch (System.NullReferenceException xnull)
                {
                    // myA.AtMng.LogError(xnull);
                    //address not found in address book or cancel hit
                    throw new AtriumException("Cancel of address pick");
                }
                catch (Exception x)
                {
                    myA.AtMng.LogError(x);
                    //address not found in address book or cancel hit
                    throw x;
                }

                if (userInput == null) //personal\outlook distribution lists cause this
                {
                    userInput = display;
                }

                or = myA.AtMng.OfficeMng.GetOfficer().LoadByEmail(userInput);
                if (or == null || !or.CurrentEmployee)
                {
                    //add recipient row
                    newR.Address     = userInput;
                    newR.Name        = display;
                    newR.AddressType = addrType;

                    return;
                }
                else
                {
                    Resolve(or, newR);
                }
            }
        }