예제 #1
0
        public ConflictCheckStandardReturnValue ConflictCheck(HostSecurityToken oHostSecurityToken,
                                                              CollectionRequest collectionRequest,
                                                              IRISLegal.IlbCommon.ContactType clientType,
                                                              Person person,
                                                              Organisation organisation,
                                                              Address addresses,
                                                              List <AdditionalAddressElement> addressInformation,
                                                              bool checkOnAllRoles)
        {
            ConflictCheckStandardReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oClientService = new ClientService();
                returnValue    = oClientService.ConflictCheck(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest,
                                                              clientType, person, organisation, addresses, addressInformation, checkOnAllRoles);
            }
            else
            {
                returnValue         = new ConflictCheckStandardReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
예제 #2
0
        /// <summary>
        /// Conflicts the check.
        /// </summary>
        /// <returns></returns>
        private bool ConflictCheck()
        {
            bool canSave = false;

            try
            {
                if (_ddlRole.SelectedItem.Text.Trim() == "Otherside")
                {
                    Guid memId = new Guid(_hdnMemberId.Value);
                    Guid orgId = new Guid(_hdnOrganisationId.Value);

                    string       conflictName = string.Empty;
                    Organisation organisation = null;
                    Person       person       = new Person();

                    if (memId != DataConstants.DummyGuid)
                    {
                        conflictName = GetPersonName(memId);
                    }
                    else
                    {
                        conflictName = GetOrganisationName(orgId);
                    }

                    person.ForeName = "";
                    person.Title    = "";

                    _conflictCheck.Person = person;

                    organisation              = new Organisation();
                    organisation.Name         = conflictName;
                    _conflictCheck.ClientType = IRIS.Law.Services.Pms.Client.ClientType.Organisation;

                    Address address = new Address();
                    address.Line1               = GetAddress(memId, orgId);
                    address.Line3               = "";
                    address.PostCode            = "";
                    _conflictCheck.Organisation = organisation;
                    _conflictCheck.Address      = address;
                    ConflictCheckStandardReturnValue returnValue = _conflictCheck.PerformConflictCheck();
                    if (returnValue.Success)
                    {
                        //Display conflict check screen if conflict is found
                        if (returnValue.IsConflict)
                        {
                            _wizardAddAssociationsForMatter.Visible = false;
                            _tblConflictCheck.Visible          = true;
                            _conflictCheck.ReturnConflictCheck = returnValue;
                            _conflictCheck.BindConflictCheckGridView();
                        }
                        canSave = !returnValue.IsConflict;
                    }
                    else
                    {
                        throw new Exception(returnValue.Message);
                    }
                }
                else
                {
                    canSave = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(canSave);
        }
 public ConflictCheckStandardReturnValue ConflictCheck(HostSecurityToken oHostSecurityToken,
     CollectionRequest collectionRequest,
     IRISLegal.IlbCommon.ContactType clientType,
     Person person,
     Organisation organisation,
     Address addresses,
     List<AdditionalAddressElement> addressInformation,
     bool checkOnAllRoles)
 {
     ConflictCheckStandardReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oClientService = new ClientService();
         returnValue = oClientService.ConflictCheck(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest,
            clientType, person, organisation, addresses, addressInformation, checkOnAllRoles);
     }
     else
     {
         returnValue = new ConflictCheckStandardReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }
예제 #4
0
        /// <summary>
        /// Performs conflict check on fields for adding contact.
        /// </summary>
        /// <returns></returns>
        private bool ConflictCheck()
        {
            bool         canSave      = false;
            Person       person       = null;
            Address      address      = null;
            Organisation organisation = null;

            try
            {
                if (_ddlServiceType.SelectedItem.Value == "General Contact")
                {
                    if (_ddlContactType.SelectedValue == Convert.ToString(ContactType.Individual))
                    {
                        person                    = new Person();
                        person.ForeName           = _txtForename.Text;
                        person.Surname            = _txtSurname.Text;
                        person.Title              = _ddlTitle.Text;
                        _conflictCheck.ClientType = ClientType.Individual;
                    }
                    else if (_ddlContactType.SelectedValue == Convert.ToString(ContactType.Organisation))
                    {
                        organisation              = new Organisation();
                        organisation.Name         = _txtOrgName.Text;
                        _conflictCheck.ClientType = ClientType.Organisation;
                    }
                }
                else if (_ddlServiceType.SelectedItem.Value == "Service")
                {
                    person          = new Person();
                    person.ForeName = _cdServiceContactDetails.ForeName;
                    person.Surname  = _cdServiceContactDetails.SurName;
                    person.Title    = _cdServiceContactDetails.Title;

                    // In case of "Service" client type as "Individual"
                    _conflictCheck.ClientType = ClientType.Individual;
                }
                else if (_ddlServiceType.SelectedItem.Value == "Service Contact")
                {
                    person                    = new Person();
                    person.ForeName           = _cdContactDetails.ForeName;
                    person.Surname            = _cdContactDetails.SurName;
                    person.Title              = _cdContactDetails.Title;
                    _conflictCheck.ClientType = ClientType.Individual;
                }

                address = _addressDetails.Address;

                _conflictCheck.Person            = person;
                _conflictCheck.Organisation      = organisation;
                _conflictCheck.Address           = address;
                _conflictCheck.AdditionalDetails = _aadContactInfo.AdditionalDetails;

                ConflictCheckStandardReturnValue returnValue = _conflictCheck.PerformConflictCheck();

                if (returnValue.Success)
                {
                    if (returnValue.IsConflict)
                    {
                        _tblConflictCheck.Style["display"] = "";
                        _conflictCheck.ReturnConflictCheck = returnValue;
                        _conflictCheck.BindConflictCheckGridView();
                    }

                    canSave = !returnValue.IsConflict;
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }

                // Sets the return value to get the conflict summary and note content while save.
                _conflictCheck.ReturnConflictCheck = returnValue;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(canSave);
        }
        public ConflictCheckStandardReturnValue ConflictCheck(Guid logonId,
            CollectionRequest collectionRequest,
            IRISLegal.IlbCommon.ContactType clientType,
            Person person,
            Organisation organisation,
            Address addresses,
            List<AdditionalAddressElement> addressInformation, 
            bool checkOnAllRoles)
        {
            ConflictCheckStandardReturnValue returnValue = new ConflictCheckStandardReturnValue();
            try
            {
                // Get the logged on user from the current logons and add their
                // ApplicationSettings the list of concurrent sessions.
                Host.LoadLoggedOnUser(logonId);

                try
                {
                    Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid);
                    switch (UserInformation.Instance.UserType)
                    {
                        case DataConstants.UserType.Staff:
                            // Can do everything
                            break;
                        case DataConstants.UserType.Client:
                        case DataConstants.UserType.ThirdParty:
                            throw new Exception("Access denied");
                        default:
                            throw new Exception("Access denied");
                    }

                    // Create a data list creator for a list of matters
                    DataListCreator<ConflictCheckStandardItem> dataListCreator = new DataListCreator<ConflictCheckStandardItem>();
                    DsConflictCheckStandard dsConflictCheckStandard = new DsConflictCheckStandard();

                    //Assign all control values to ConflictCheckFields
                    SrvConflictCheckFields conflictFields = new SrvConflictCheckFields();
                    SrvConflictCheck conflictCheck = new SrvConflictCheck();
                    conflictFields.ConflictCheckClientType = clientType;

                    if (person != null)
                    {
                        conflictFields.PersonSurname = person.Surname;
                        conflictFields.PersonName = person.ForeName;
                        conflictFields.PersonTitle = person.Title;
                    }
                    if (organisation != null)
                    {
                        conflictFields.OrgName = organisation.Name;
                    }
                    if (addresses != null)
                    {
                        conflictFields.AddressLine1 = addresses.Line1;
                        conflictFields.AddressLine2 = addresses.Line2;
                        conflictFields.AddressLine3 = addresses.Line3;
                        conflictFields.AddressCountry = addresses.Country;
                        conflictFields.AddressCounty = addresses.County;
                        conflictFields.AddressDepLocality = addresses.DependantLocality;
                        conflictFields.AddressDept = addresses.Department;
                        conflictFields.AddressDXNumber = addresses.DXNumber;
                        conflictFields.AddressDXTown = addresses.DXTown;
                        conflictFields.AddressHouseName = addresses.HouseName;
                        conflictFields.AddressOrgName = addresses.OrganisationName;
                        conflictFields.AddressPoBox = addresses.PostBox;
                        conflictFields.AddressPostCode = addresses.PostCode;
                        conflictFields.AddressStreetNo = addresses.StreetNumber;
                        conflictFields.AddressSubBldg = addresses.SubBuilding;
                        conflictFields.AddressTown = addresses.Town;
                    }

                    if (addressInformation != null)
                    {
                        for (int i = 0; i <= addressInformation.Count - 1; i++)
                        {
                            switch (i)
                            {
                                case 0:
                                    conflictFields.ConflictCheck1 = addressInformation[i].ElementText;
                                    break;
                                case 1:
                                    conflictFields.ConflictCheck2 = addressInformation[i].ElementText;
                                    break;
                                case 2:
                                    conflictFields.ConflictCheck3 = addressInformation[i].ElementText;
                                    break;
                                case 3:
                                    conflictFields.ConflictCheck4 = addressInformation[i].ElementText;
                                    break;
                                case 4:
                                    conflictFields.ConflictCheck5 = addressInformation[i].ElementText;
                                    break;
                                case 5:
                                    conflictFields.ConflictCheck6 = addressInformation[i].ElementText;
                                    break;
                                case 6:
                                    conflictFields.ConflictCheck7 = addressInformation[i].ElementText;
                                    break;
                                case 7:
                                    conflictFields.ConflictCheck8 = addressInformation[i].ElementText;
                                    break;
                                case 8:
                                    conflictFields.ConflictCheck9 = addressInformation[i].ElementText;
                                    break;
                                case 9:
                                    conflictFields.ConflictCheck10 = addressInformation[i].ElementText;
                                    break;
                            }
                        }
                    }

                    //dsConflictCheckStandard = conflictCheck.DoConflictCheck(conflictFields, ApplicationSettings.Instance.DbUid);
                    IRIS.Law.PmsCommonData.DsConflictCheckStandard dsConflictCheckStandard1 = null;
                    IRIS.Law.PmsCommonData.DsConflictCheckAddress dsConflictCheckAddress1 = null;
                    IRIS.Law.PmsCommonData.DsConflictCheckAdditionalAddress dsConflictCheckAdditionalAddress1 = null;
                    IRIS.Law.PmsCommonData.DsConflictCheckExtendedInfo dsConflictCheckExtendedInfo1 = null;
                    var sbSummary = conflictCheck.DoConflictCheck(conflictFields, out dsConflictCheckStandard1, out dsConflictCheckAddress1, out dsConflictCheckAdditionalAddress1, out dsConflictCheckExtendedInfo1, DataConstants.DummyGuid, checkOnAllRoles);

                    if (dsConflictCheckStandard1.uvw_ConflictCheckStandard.Rows.Count > 0 || dsConflictCheckAddress1.uvw_ConflictCheckAddress.Rows.Count > 0 || dsConflictCheckAdditionalAddress1.uvw_ConflictCheckAdditionalAddress.Rows.Count > 0 || dsConflictCheckExtendedInfo1.uvw_ConflictCheckExtendedInfo.Rows.Count > 0)
                    {
                        returnValue.IsConflict = true;
                    }
                    else
                    {
                        returnValue.IsConflict = false;
                    }

                    returnValue.Summary = new StringBuilder(sbSummary);

                    collectionRequest.ForceRefresh = true;

                    //returnValue.IsConflict = conflictCheck.IsConflict;

                    dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e)
                    {
                        // Perform Sorting on SelectType
                        DataView dvConflictCheck = new DataView(dsConflictCheckStandard1.Tables[0]);
                        dvConflictCheck.Sort = "SelectType asc";

                        DataSet dsSorted = new DataSet();
                        dsSorted.Tables.Add(dvConflictCheck.ToTable());
                        e.DataSet = dsSorted;
                        //e.DataSet = dsConflictCheckStandard1;
                    };

                    returnValue.ConflictCheckStandard = dataListCreator.Create(logonId,
                        // Give the query a name so it can be cached
                        "ConflictCheckStandard",
                        // Tell it the query criteria used so if the cache is accessed
                        // again it knows if it is the same query
                        "",
                        collectionRequest,
                        // Import mappings to map the dataset row fields to the data
                        // list entity properties
                        new ImportMapping[] {
                            new ImportMapping("ClientRef", "cliRef"),
                            new ImportMapping("SelectType", "SelectType"),
                            new ImportMapping("PersonTitle", "PersonTitle"),
                            new ImportMapping("PersonName", "PersonName"),
                            new ImportMapping("PersonSurName", "PersonSurName"),
                            new ImportMapping("AddressStreetNo", "AddressStreetNo"),
                            new ImportMapping("AddressHouseName", "AddressHouseName"),
                            new ImportMapping("AddressLine1", "AddressLine1"),
                            new ImportMapping("OrgName", "OrgName"),
                            new ImportMapping("IsMember", "IsMember")
                            }
                        );
                }
                finally
                {
                    // Remove the logged on user's ApplicationSettings from the
                    // list of concurrent sessions
                    Host.UnloadLoggedOnUser();
                }
            }
            catch (Exception Ex)
            {
                returnValue.Success = false;
                returnValue.Message = "Could not load conflict check fields for the current user." + Ex.Message;
            }

            return returnValue;
        }