Ejemplo n.º 1
0
        protected override void BeforeDelete(DataRow dr)
        {
            atriumDB.FileContactRow fcr = (atriumDB.FileContactRow)dr;

            if (!fcr.HideInToc)
            {
                System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
                xd.InnerXml = fcr.EFileRow.FileStructXml;
                System.Xml.XmlElement xe = (System.Xml.XmlElement)xd.SelectSingleNode("//toc[@supertype='contact' and @id=" + fcr.FileContactid.ToString() + "]");
                RemoveFileContactFromXML(xe);
                fcr.EFileRow.FileStructXml = xd.InnerXml;
            }

            if (!fcr.IsNull("ContactType") && !fcr.IsNull("ContactId"))
            {
                if (fcr.ContactType == myA.AtMng.GetSetting(AppStringSetting.LeadPLContactType))
                {
                    fcr.EFileRow.SetLeadParalegalIDNull();
                    fcr.EFileRow.EndEdit();
                }
                if (fcr.ContactType == myA.AtMng.GetSetting(AppStringSetting.LeadLawyerContactype))
                {
                    fcr.EFileRow.SetLeadLawyerIDNull();
                    fcr.EFileRow.EndEdit();
                }
            }
        }
Ejemplo n.º 2
0
        private void filePartyBindingSource_CurrentChanged(object sender, EventArgs e)
        {
            try
            {
                atriumDB.FileContactRow fcr = CurrentRow();

                if (fcr == null || fcr.IsNull("FileContactId"))
                {
                    return;
                }
                TogglePartyEditableMode(false);
                partyBindingSource.Position = partyBindingSource.Find("ContactId", fcr.ContactId.ToString());

                ApplySecurity(fcr);

                //check for address record and set binding source position
                atriumDB.ContactRow pr = CurrentRowParty();
                if (pr == null || pr.IsNull("ContactId"))
                {
                    return;
                }



                if (!pr.IsAddressCurrentIDNull() && CurrentRowAddress() != null)
                {
                    addressBindingSource.Position = addressBindingSource.Find("AddressId", pr.AddressCurrentID.ToString());
                    gbAddress.Visible             = true;
                }
                else
                {
                    gbAddress.Visible = false;
                }
            }
            catch (Exception x)
            {
                UIHelper.HandleUIException(x);
            }
        }
Ejemplo n.º 3
0
        protected override void AfterChange(DataColumn dc, DataRow ddr)
        {
            atriumDB.FileContactRow dr = (atriumDB.FileContactRow)ddr;

            //JLL: Fires too often on contactid when it hasn't changed - because of ucContactSelect control

            switch (dc.ColumnName)
            {
            case FileContactFields.ContactType:
            case FileContactFields.ContactId:
                if (!dr.IsNull("ContactType") && dr.IsNull("ContactId"))
                {
                    if (!dr.NoReassign)     // only run it if noreassign not set JLL 2015-01-22
                    {
                        int id = myA.EFile.GetOfficerForContactType(dr.EFileRow, dr.ContactType);

                        if (id != 0)
                        {
                            dr.ContactId = id;
                            dr.EndEdit();
                        }
                    }
                }

                if (!dr.IsNull("ContactType") && !dr.IsNull("ContactId"))
                {
                    if (dr.ContactType == myA.AtMng.GetSetting(AppStringSetting.LeadPLContactType) && (dr.EFileRow.IsLeadParalegalIDNull() || dr.EFileRow.LeadParalegalID != dr.ContactId))
                    {
                        dr.EFileRow.LeadParalegalID = dr.ContactId;
                        dr.EFileRow.EndEdit();
                    }
                    if (dr.ContactType == myA.AtMng.GetSetting(AppStringSetting.OfficerContactType) && (dr.EFileRow.IsOfficerIdNull() || dr.EFileRow.OfficerId != dr.ContactId))
                    {
                        dr.EFileRow.OfficerId = dr.ContactId;
                        dr.EFileRow.EndEdit();
                    }    //if (dr.ContactType == "FLL" &&(dr.EFileRow.IsLeadLawyerIDNull() || dr.EFileRow.LeadLawyerID != dr.ContactId))
                         //{
                         //    dr.EFileRow.LeadLawyerID = dr.ContactId;
                         //    dr.EFileRow.EndEdit();
                         //}

                    //JLL: 2010/11/16 Can only have one Lead Lawyer on file
                    //update current Lead Lawyer to Assisting Lawyer, unless trying to update to same
                    if (dr.ContactType == myA.AtMng.GetSetting(AppStringSetting.LeadLawyerContactype))
                    {
                        foreach (atriumDB.FileContactRow fcr in myA.CurrentFile.GetFileContactRows())
                        {
                            if (!fcr.IsNull("ContactType") && dr != fcr && fcr.ContactType == "FLL" && fcr.Active)
                            {
                                if (dr.ContactId == fcr.ContactId)
                                {
                                    throw new AtriumException(String.Format(Properties.Resources.LeadLawyerAlreadyOnFile, myA.AtMng.AppMan.AppName));
                                }
                                else
                                {
                                    //found current - update to assisting and leave
                                    fcr.ContactType = "FAL";
                                    fcr.EndEdit();
                                    break;
                                }
                            }
                        }
                        if (dr.EFileRow.IsLeadLawyerIDNull() || dr.EFileRow.LeadLawyerID != dr.ContactId)
                        {
                            dr.EFileRow.LeadLawyerID = dr.ContactId;
                            dr.EFileRow.EndEdit();
                        }
                    }

                    //JLL: 2009/07/23 Can only have one Lead Client Contact on file
                    //update current Lead Client Contact to Secondary Client Contact
                    if (dr.ContactType == "FCC")
                    {
                        foreach (atriumDB.FileContactRow fcr in myA.CurrentFile.GetFileContactRows())
                        {
                            if (!fcr.IsNull("ContactType") && dr != fcr && fcr.ContactType == "FCC" && fcr.Active)
                            {
                                //if (dr.ContactId == fcr.ContactId)
                                //{

                                //    //We need to delete the duplicate somehow.
                                //    //to skip the error entirely means we end up with two contacts on the file that is the same person
                                //    // opinion/requestdocid beforeChange fires and adds another filecontact record when it is not needed
                                //    // maybe perform a check in opinion/requestdocid beforeChange to see if contactids match already and don't add if already OK
                                //    throw new AtriumException("The selected contact is already the Lead Client Contact on this file.  LawMate does not allow duplicate lead client contacts.");
                                //}
                                //else
                                //found current - update to secondary and leave
                                fcr.ContactType = "FSCC";
                                fcr.EndEdit();
                                break;
                            }
                        }
                    }
                }

                if (dr.RowState == DataRowState.Added & !dr.IsNull("ContactId") & !dr.IsNull("ContactType"))
                {
                    //find officeid

                    officeDB.OfficerRow orr = myA.AtMng.OfficeMng.GetOfficer().FindLoad(dr.ContactId);
                    if (orr != null)
                    {
                        //add office to file
                        //if (myA.DB.FileOffice.Rows.Count == 0)
                        //    myA.GetFileOffice().LoadByFileId(dr.FileId);

                        if (myA.DB.FileOffice.Select("OfficeID=" + orr.OfficeId.ToString()).Length == 0)
                        {
                            atriumDB.FileOfficeRow fo = (atriumDB.FileOfficeRow)myA.GetFileOffice().Add(myA.CurrentFile);
                            fo.OfficeId = orr.OfficeId;
                            if (dr.ContactType == "FCC" || dr.ContactType == "FHGD")
                            {
                                fo.IsClient = true;
                                object alloc = myA.DB.FileOffice.Compute("Sum(PercentAlloc)", "isclient=1");
                                if (alloc.GetType() == typeof(decimal))
                                {
                                    fo.PercentAlloc = 100 - System.Convert.ToDecimal(alloc);
                                }
                                else
                                {
                                    fo.PercentAlloc = 100;
                                }
                            }
                        }
                    }
                }
                break;

            case FileContactFields.EndDate:
                //JLL: 2009/07/23 - set active based on end date
                dr.Active    = dr.IsEndDateNull();
                dr.HideInToc = !dr.IsEndDateNull();
                dr.EndEdit();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 4
0
        private void fileContactBindingSource_CurrentChanged(object sender, EventArgs e)
        {
            try
            {
                atriumDB.FileContactRow fcr = CurrentRow();

                if (fcr==null|| fcr.IsNull("FileContactid"))
                    return;

                TogglePartyEditableMode(false);
                
                switch (fcr.ContactClass)
                {
                    case "O":
                        verifyContactType(true, false);
                        UIHelper.ComboBoxInit("ContactTypeFile", ucMultiDropDown1, FM);
                        break;
                    case "P":
                        displayParticipant();
                        UIHelper.ComboBoxInit("Test", ucMultiDropDown1, FM);
                        //verifyContactType(false, true);
                        break;
                    default:
                        verifyContactType(false,false);
                        UIHelper.ComboBoxInit("ContactType", ucMultiDropDown1, FM);
                        break;
                }

                

                atriumDB.ContactRow pr = CurrentRowContact();
                if (pr == null || pr.IsNull("ContactId"))
                    return;

                

                contactBindingSource.Position = contactBindingSource.Find("ContactId", fcr.ContactId);

                if (!CurrentRowContact().IsAddressCurrentIDNull() && (CurrentRow().IsPositionCodeNull() || CurrentRow().PositionCode !="TM"))
                {
                    atriumDB.AddressRow adr = FM.DB.Address.FindByAddressId(CurrentRowContact().AddressCurrentID);
                    if (adr == null)
                        FM.GetAddress().Load(CurrentRowContact().AddressCurrentID);

                    addressBindingSource.Filter = "";
                    addressBindingSource.Position = addressBindingSource.Find("AddressId", CurrentRowContact().AddressCurrentID.ToString());
                    ucAddress1.Visible = true;
                    btnAddAddress.Visible = false;
                }
                else
                {
                    //addressBindingSource.Filter = "contactid=0";
                    if(fcr.ContactClass=="P" || fcr.ContactClass=="B")
                        btnAddAddress.Visible = true;
                    else
                        btnAddAddress.Visible = false;
                    ucAddress1.Visible = false;
                }

                if (!CurrentRow().IsPositionCodeNull() &&  CurrentRow().PositionCode == "TM")
                {
                    btnAddAddress.Visible = false;
                    ucAddress1.Visible = false;
                }

                ApplySecurity(fcr);
            }
            catch (Exception x)
            {
                UIHelper.HandleUIException(x);
            }
        }
Ejemplo n.º 5
0
        protected override void BeforeChange(DataColumn dc, DataRow row)
        {
            SST.FilePartyRow dr = (SST.FilePartyRow)row;

            if (!dr.IsFileContactIdNull()) // ensure FileContactId is not null
            {
                atriumDB.FileContactRow fcr = myA.FM.DB.FileContact.FindByFileContactid(dr.FileContactId);
                switch (dc.ColumnName)
                {
                case "IsRespondent":
                    //add this test to prevent duplicate IsRespondent on a file

                    if (dr.IsRespondent)
                    {
                        if (!fcr.IsNull("ContactType"))
                        {
                            if (fcr.ContactType.EndsWith("R"))
                            {
                                throw new AtriumException("A rep. cannot be the respondent");
                            }
                        }
                    }
                    foreach (SST.FilePartyRow fcr1 in myFilePartyDT)
                    {
                        if (fcr1.RowState != DataRowState.Deleted)
                        {
                            fcr1.SetColumnError(dc, "");
                            if (dr.IsRespondent && fcr1.IsRespondent && dr.FilePartyId != fcr1.FilePartyId)
                            {
                                throw new AtriumException(Properties.Resources.DuplicateRespondent);
                            }
                        }
                    }

                    break;

                case "IsAddedParty":
                    if (dr.IsAddedParty)
                    {
                        if (!fcr.IsNull("ContactType"))
                        {
                            if (fcr.ContactType.EndsWith("R"))
                            {
                                throw new AtriumException("A rep. cannot be an added party");
                            }
                        }
                    }
                    break;

                case "IsAppellant":
                    //TFS#51004 CJW 2013-8-26
                    //add this test to prevent duplicate appellants on a file

                    if (dr.IsAppellant)
                    {
                        if (!fcr.IsNull("ContactType"))
                        {
                            if (fcr.ContactType.EndsWith("R"))
                            {
                                throw new AtriumException("A rep. cannot be the appellant");
                            }
                        }
                    }
                    foreach (SST.FilePartyRow fcr1 in myFilePartyDT)
                    {
                        if (fcr1.RowState != DataRowState.Deleted)
                        {
                            fcr1.SetColumnError(dc, "");
                            if (dr.IsAppellant && fcr1.IsAppellant && dr.FilePartyId != fcr1.FilePartyId)
                            {
                                throw new AtriumException(Properties.Resources.DuplicateAppellant);     //JLL 2013-09-27: Translation for 2013/10 build - string moved to resource.
                            }
                        }
                    }

                    break;

                default:
                    break;
                }
            }
        }