Beispiel #1
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);
                }
            }
        }
Beispiel #2
0
        private void MyXml(atriumDB.FileContactRow fcr, System.Xml.XmlDocument xd)
        {
            try
            {
                //JLL: MODIFIED 2009/07/24: take FileContact.Active into account - remove where not active
                bool removeNode = false;
                if (!fcr.HideInToc)
                {
                    System.Xml.XmlElement xe = (System.Xml.XmlElement)xd.SelectSingleNode("//toc[@supertype='contact' and @id=" + fcr.FileContactid.ToString() + "]");

                    if (!fcr.Active)
                    {
                        removeNode = true;
                    }
                    else if (xe == null)
                    {
                        xe = xd.CreateElement("toc");
                        xe.SetAttribute("supertype", "contact");
                    }


                    if (removeNode)
                    {
                        RemoveFileContactFromXML(xe);
                    }
                    else
                    {
                        xe.SetAttribute("id", fcr.FileContactid.ToString());
                        //if (fcr.IsLastNameNull())
                        //{
                        //    xe.SetAttribute("titlee", String.Format(atriumRes.FileContactXmlTitle + " (" + fcr.ContactTypeDescEng.ToString() + ")", fcr.LegalName, ""));
                        //    xe.SetAttribute("titlef", String.Format(atriumRes.FileContactXmlTitle + " (" + fcr.ContactTypeDescFre.ToString() + ")", fcr.LegalName, ""));
                        //}
                        //else
                        //{
                        //    xe.SetAttribute("titlee", String.Format(atriumRes.FileContactXmlTitle + " (" + fcr.ContactTypeDescEng.ToString() + ")", fcr.LastName, fcr.FirstName));
                        //    xe.SetAttribute("titlef", String.Format(atriumRes.FileContactXmlTitle + " (" + fcr.ContactTypeDescFre.ToString() + ")", fcr.LastName, fcr.FirstName));
                        //}

                        xe.SetAttribute("titlee", String.Format(atriumRes.FileContactXmlTitle + " (" + fcr.ContactTypeDescEng.ToString() + ")", fcr.DisplayName, ""));
                        xe.SetAttribute("titlef", String.Format(atriumRes.FileContactXmlTitle + " (" + fcr.ContactTypeDescFre.ToString() + ")", fcr.DisplayName, ""));

                        if (fcr.ContactType == "FDB")
                        {
                            CLAS.DebtorRow debtor = myA.GetCLASMng().GetDebtor().CurrentDebtor;

                            xe.SetAttribute("type", "opponent");
                            //check for Contact/Notes
                            if (debtor != null && !debtor.IsNotesNull())
                            {
                                //tweek title
                                xe.SetAttribute("titlee", "*** " + xe.GetAttribute("titlee") + " ***");
                                xe.SetAttribute("titlef", "*** " + xe.GetAttribute("titlef") + " ***");
                                xe.SetAttribute("bold", "true");
                                xe.SetAttribute("tooltipe", "There are notes");
                                xe.SetAttribute("tooltipf", "Il y a des notes");
                            }
                            else
                            {
                                xe.SetAttribute("bold", "false");
                                xe.SetAttribute("tooltipe", "");
                                xe.SetAttribute("tooltipf", "");
                            }
                            //2014-06-11
                            //JLL
                            //calculate address country to determine icon
                            //assumes data is already loaded
                            //DOES NOT WORK WHEN OPENING A FILE; CONTACT ROW IS NULL ... ARG
                            if (debtor != null && !debtor.IsAddressCurrentIDNull())
                            {
                                atriumDB.AddressRow dbAddress = myA.DB.Address.FindByAddressId(debtor.AddressCurrentID);
                                if (dbAddress != null)
                                {
                                    string country = dbAddress.CountryCode;
                                    switch (country)
                                    {
                                    case "CDN":
                                        xe.SetAttribute("icon", "34");
                                        break;

                                    case "USA":
                                        xe.SetAttribute("icon", "35");
                                        break;

                                    default:
                                        xe.SetAttribute("icon", "36");
                                        break;
                                    }
                                }
                            }
                        }
                        else
                        {
                            xe.SetAttribute("type", "contact");
                        }

                        if (xe.GetAttribute("isParticipant") != "true" && !fcr.IsOfficeIdNull())
                        {
                            xe.SetAttribute("icon", "43"); //atrium officer; not necessarily a user
                        }
                        if (xe.ParentNode == null)
                        {
                            System.Xml.XmlElement xes = null;
                            if (fcr.IsOfficeIdNull())
                            {
                                xes = EFileBE.XmlAddFld(xd, "basecontacts", "Contacts", "Contacts", 210);
                                xes.AppendChild(xe);
                            }
                            else
                            {
                                System.Xml.XmlElement xe1 = (System.Xml.XmlElement)xd.SelectSingleNode("//toc[@type='fileoffice' and @officeid=" + fcr.OfficeId.ToString() + "]");
                                if (xe1 != null)
                                {
                                    xe1.AppendChild(xe);
                                }
                                else
                                {
                                    xes = EFileBE.XmlAddFld(xd, "basecontacts", "Contacts", "Contacts", 210);
                                    xes.AppendChild(xe);
                                }
                                //xes.AppendChild(xe);

                                //xes = EFileBE.XmlAddFld(xe1, "contacts", "Contacts", "Contacts", 320);
                                //else

                                //{
                                //JLL: Bug 2009/07/24
                                //When new contact is added through process (CM03.02), and no File Office record is present,
                                // it sticks File Contact record on first "contact" match on filestructxml document
                                //    xes = EFileBE.XmlAddFld(xd, "contacts", "Contacts", "Contacts", 320);
                                //}
                            }
                            //xes.AppendChild(xe);
                        }
                    }
                }
            }
            catch (Exception x)
            { }
        }
Beispiel #3
0
        protected override void BeforeChange(DataColumn dc, DataRow ddr)
        {
            Advisory.OpinionRow dr = (Advisory.OpinionRow)ddr;
            string ObjectName      = this.myOpinionDT.TableName;

            switch (dc.ColumnName)
            {
            case "AssignedToId":
                //JLL 2018-04-23
                //commented out lawyer list rule for demo
                //if (!myA.CheckDomain(dr.AssignedToId,myA.FM.Codes("LawyerList")))
                //    throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, "Assigned To",dr.Table.TableName,"Lawyer List");
                break;

            case "RequestDocId":

                if (dr.IsRequestContactIdNull())
                {
                    //myA.FM.GetDocMng().GetRecipient().LoadByDocId(dr.RequestDocId);
                    docDB.RecipientRow[] rs = (docDB.RecipientRow[])myA.FM.GetDocMng().DB.Recipient.Select("Type='0' and DocId=" + dr.RequestDocId.ToString());
                    if (rs.Length == 1 && rs[0].Address != rs[0].Name)
                    {
                        atriumDB.FileContactRow fcr = myA.FM.GetDocMng().GetRecipient().AddRecipToFile(rs[0], false, "FCC");
                        if (!fcr.IsOfficeIdNull())
                        {
                            dr.RequestOfficeId = fcr.OfficeId;
                        }

                        dr.RequestContactId = fcr.ContactId;
                    }
                }
                break;

            case "ReceivedDate":
                if (dr.IsReceivedDateNull())
                {
                    throw new RequiredException(Resources.OpinionReceivedDate);
                }
                //if(dr.EFileRow.IsOpenedDateNull())
                //	this.myA.RaiseError(AtriumEnum.AppErrorCodes.RelatedDateRequired, myA.GetLabelLeft(ObjectName, dc.ColumnName), myA.GetLabelLeft("Efile", "ReceivedByJusticeDate"));
                myA.IsValidDate(Resources.OpinionReceivedDate, dr.ReceivedDate, false, DateTime.MinValue, DateTime.Today, Resources.ValidationTheBeginning, Resources.ValidationToday);
                break;

            case "RequestDate":
                if (dr.IsRequestDateNull())
                {
                    throw new RequiredException(Resources.OpinionRequestDate);
                }
                myA.IsValidDate(Resources.OpinionRequestDate, dr.RequestDate, false, DateTime.MinValue, DateTime.Today, Resources.ValidationTheBeginning, Resources.ValidationToday);
                break;

            case "AssignedDate":
                if (!dr.IsAssignedDateNull())
                {
                    if (dr.IsRequestDateNull())
                    {
                        throw new RelatedException(Resources.OpinionAssignedDate, Resources.OpinionRequestDate);
                    }
                    myA.IsValidDate(Resources.OpinionAssignedDate, dr.AssignedDate, true, dr.RequestDate, DateTime.Today, Resources.OpinionRequestDate, Resources.ValidationToday);
                }
                break;

            case "DueDate":
                if (!dr.IsDueDateNull())
                {
                    if (dr.IsAssignedDateNull())
                    {
                        throw new RelatedException(Resources.OpinionDueDate, Resources.OpinionAssignedDate);
                    }
                    myA.IsValidDate(Resources.OpinionDueDate, dr.DueDate, true, dr.AssignedDate, DateTime.Today.AddMonths(6), Resources.OpinionAssignedDate, Resources.ValidationSixMonthsFromNow);
                }
                break;

            case "CompletedDate":
                if (!dr.IsCompletedDateNull())
                {
                    if (dr.IsAssignedDateNull())
                    {
                        throw new RelatedException(Resources.OpinionCompletedDate, Resources.OpinionAssignedDate);
                    }
                    myA.IsValidDate(Resources.OpinionCompletedDate, dr.CompletedDate, true, dr.AssignedDate, DateTime.Today, Resources.OpinionAssignedDate, Resources.ValidationToday);
                }
                break;

            case "Subject":
                //case "Number":
                if (dr.IsNull(dc))
                {
                    throw new RequiredException(Resources.ResourceManager.GetString(ObjectName + dc.ColumnName));
                }
                break;

            case "OpinionTypeId":
                if (!myA.CheckDomain(dr.OpinionTypeId, myA.FM.Codes("OpinionType")))
                {
                    throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dr.Table.TableName, "Opinion Type");
                }
                break;

            default:
                break;
            }
        }