/// <summary>
        /// Search departments based on the organisation ID
        /// </summary>
        /// <param name="logonId">The logon id</param>
        /// <param name="collectionRequest">Collection request value</param>
        /// <param name="criteria">Department search criteria</param>
        /// <returns>Collection of department search item</returns>
        public DepartmentSearchReturnValue DepartmentSearch(Guid logonId, CollectionRequest collectionRequest,
                                                            DepartmentSearchCriteria criteria)
        {
            DepartmentSearchReturnValue returnValue = new DepartmentSearchReturnValue();

            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:
                    case DataConstants.UserType.Client:
                    case DataConstants.UserType.ThirdParty:
                        // Can do everything
                        break;

                    default:
                        throw new Exception("Access denied");
                    }

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

                    // Declare an inline event (annonymous delegate) to read the
                    // dataset if it is required
                    dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e)
                    {
                        if (criteria.AllDepartment)
                        {
                            // Create the dataset for department search to get all departments
                            e.DataSet = SrvDepartmentLookup.GetDepartments();
                        }
                        else
                        {
                            // Create the dataset
                            e.DataSet = SrvDepartmentLookup.GetDepartments(criteria.OrganisationId, criteria.IncludeArchived);
                        }

                        DataTable dt = Functions.SortDataTable(e.DataSet.Tables[0], "deptName");
                        e.DataSet.Tables.Remove(e.DataSet.Tables[0]);
                        e.DataSet.Tables.Add(dt);
                    };

                    // Create the data list
                    returnValue.Departments = dataListCreator.Create(logonId,
                                                                     // Give the query a name so it can be cached
                                                                     "DepartmentSearch",
                                                                     // Tell it the query criteria used so if the cache is accessed
                                                                     // again it knows if it is the same query
                                                                     criteria.ToString(),
                                                                     collectionRequest,
                                                                     // Import mappings to map the dataset row fields to the data
                                                                     // list entity properties
                                                                     new ImportMapping[] {
                        new ImportMapping("Id", "deptID"),
                        new ImportMapping("No", "deptNo"),
                        new ImportMapping("Name", "deptName"),
                        new ImportMapping("IsArchived", "deptArchived")
                    }
                                                                     );
                }
                finally
                {
                    // Remove the logged on user's ApplicationSettings from the
                    // list of concurrent sessions
                    Host.UnloadLoggedOnUser();
                }
            }
            catch (System.Data.SqlClient.SqlException)
            {
                returnValue.Success = false;
                returnValue.Message = Functions.SQLErrorMessage;
            }
            catch (Exception Ex)
            {
                returnValue.Success = false;
                returnValue.Message = Ex.Message;
            }

            return(returnValue);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="logonId"></param>
        /// <param name="collectionRequest"></param>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public BranchSearchReturnValue BranchSearch(Guid logonId, CollectionRequest collectionRequest)
        {
            BranchSearchReturnValue returnValue = new BranchSearchReturnValue();

            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:
                    case DataConstants.UserType.Client:
                    case DataConstants.UserType.ThirdParty:
                        // Can do everything
                        break;

                    default:
                        throw new Exception("Access denied");
                    }

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

                    // Declare an inline event (annonymous delegate) to read the
                    // dataset if it is required
                    dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e)
                    {
                        // Create the dataset
                        //e.DataSet = service layer routine to do the query
                        e.DataSet = SrvBranchLookup.GetBranchLookup();

                        DataTable dt = Functions.SortDataTable(e.DataSet.Tables[0], "OrgName");
                        e.DataSet.Tables.Remove(e.DataSet.Tables[0]);
                        e.DataSet.Tables.Add(dt);

                        foreach (DataRow r in e.DataSet.Tables[0].Rows)
                        {
                            r["branchRef"] = r["branchRef"].ToString().Trim();
                            r["OrgName"]   = r["branchRef"].ToString().Trim() + " - " + r["OrgName"];
                        }
                    };

                    // Create the data list
                    returnValue.Branches = dataListCreator.Create(logonId,
                                                                  // Give the query a name so it can be cached
                                                                  "BranchSearch",
                                                                  // Tell it the query criteria used so if the cache is accessed
                                                                  // again it knows if it is the same query
                                                                  null,
                                                                  collectionRequest,
                                                                  // Import mappings to map the dataset row fields to the data
                                                                  // list entity properties
                                                                  new ImportMapping[] {
                        new ImportMapping("OrganisationId", "OrgID"),
                        new ImportMapping("Reference", "branchRef"),
                        new ImportMapping("Name", "OrgName"),
                        new ImportMapping("IsLondonRate", "branchLondonRate")
                    }
                                                                  );
                }
                finally
                {
                    // Remove the logged on user's ApplicationSettings from the
                    // list of concurrent sessions
                    Host.UnloadLoggedOnUser();
                }
            }
            catch (System.Data.SqlClient.SqlException)
            {
                returnValue.Success = false;
                returnValue.Message = Functions.SQLErrorMessage;
            }
            catch (Exception Ex)
            {
                returnValue.Success = false;
                returnValue.Message = Ex.Message;
            }

            return(returnValue);
        }
Esempio n. 3
0
        public BankSearchReturnValue BankSearch(Guid logonId, CollectionRequest collectionRequest,
                                                BankSearchCriteria criteria)
        {
            BankSearchReturnValue returnValue = new BankSearchReturnValue();

            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:
                    case DataConstants.UserType.Client:
                    case DataConstants.UserType.ThirdParty:
                        // Can do everything
                        break;

                    default:
                        throw new Exception("Access denied");
                    }


                    // Create a data list creator for a list of banks
                    DataListCreator <BankSearchItem> dataListCreator = new DataListCreator <BankSearchItem>();

                    // Declare an inline event (annonymous delegate) to read the
                    // dataset if it is required
                    dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e)
                    {
                        // TODO: Does not use the crtieria: BankTypeId, Description
                        e.DataSet = SrvBankLookup.GetBanks(criteria.IncludeArchived, (DataConstants.BankSearchTypes)criteria.BankSearchTypes);

                        DataTable dt = Functions.SortDataTable(e.DataSet.Tables[0], "bankName");
                        e.DataSet.Tables.Remove(e.DataSet.Tables[0]);
                        e.DataSet.Tables.Add(dt);

                        foreach (DataRow r in e.DataSet.Tables[0].Rows)
                        {
                            r["bankName"] = r["bankRef"] + " - " + r["bankName"];
                        }
                    };

                    // Create the data list
                    returnValue.Banks = dataListCreator.Create(logonId,
                                                               // Give the query a name so it can be cached
                                                               "BankSearch",
                                                               // Tell it the query criteria used so if the cache is accessed
                                                               // again it knows if it is the same query
                                                               criteria.ToString(),
                                                               collectionRequest,
                                                               // Import mappings to map the dataset row fields to the data
                                                               // list entity properties
                                                               new ImportMapping[] {
                        new ImportMapping("BankId", "bankID"),
                        new ImportMapping("BankTypeId", "bankTypeID"),
                        new ImportMapping("Description", "bankName"),
                    }
                                                               );
                }
                finally
                {
                    // Remove the logged on user's ApplicationSettings from the
                    // list of concurrent sessions
                    Host.UnloadLoggedOnUser();
                }
            }
            catch (System.Data.SqlClient.SqlException)
            {
                returnValue.Success = false;
                returnValue.Message = Functions.SQLErrorMessage;
            }
            catch (Exception Ex)
            {
                returnValue.Success = false;
                returnValue.Message = Ex.Message;
            }

            return(returnValue);
        }
Esempio n. 4
0
        /// <summary>
        /// Search for a user
        /// </summary>
        /// <param name="logonId"></param>
        /// <param name="collectionRequest"></param>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public UserSearchReturnValue UserSearch(Guid logonId, CollectionRequest collectionRequest,
                                                IRIS.Law.WebServiceInterfaces.Utilities.UserSearchCriteria criteria)
        {
            IRIS.Law.WebServiceInterfaces.Utilities.UserSearchReturnValue returnValue = new IRIS.Law.WebServiceInterfaces.Utilities.UserSearchReturnValue();

            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 Users
                    DataListCreator <IRIS.Law.WebServiceInterfaces.Utilities.UserSearchItem> dataListCreator = new DataListCreator <IRIS.Law.WebServiceInterfaces.Utilities.UserSearchItem>();

                    // Declare an inline event (annonymous delegate) to read the
                    // dataset if it is required
                    dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e)
                    {
                        e.DataSet = SrvUserLookup.UserSearch(criteria.UserType, criteria.Name);
                    };

                    // Create the data list
                    returnValue.Users = dataListCreator.Create(logonId,
                                                               // Give the query a name so it can be cached
                                                               "UserSearch",
                                                               // Tell it the query criteria used so if the cache is accessed
                                                               // again it knows if it is the same query
                                                               criteria.ToString(),
                                                               collectionRequest,
                                                               // Import mappings to map the dataset row fields to the data
                                                               // list entity properties
                                                               new ImportMapping[] {
                        new ImportMapping("UserId", "uid"),
                        new ImportMapping("UserName", "name"),
                        new ImportMapping("Forename", "PersonName"),
                        new ImportMapping("Surname", "PersonSurname")
                    }
                                                               );
                }
                finally
                {
                    // Remove the logged on user's ApplicationSettings from the
                    // list of concurrent sessions
                    Host.UnloadLoggedOnUser();
                }
            }
            catch (System.Data.SqlClient.SqlException)
            {
                returnValue.Success = false;
                returnValue.Message = Functions.SQLErrorMessage;
            }
            catch (Exception Ex)
            {
                returnValue.Success = false;
                returnValue.Message = Ex.Message;
            }

            return(returnValue);
        }
Esempio n. 5
0
        /// <summary>
        /// Get details about multiple Users.
        /// </summary>
        /// <param name="logonId">Logon id obtained when logging on to the logon service.</param>
        /// <param name="UserIds">Array of user ids</param>
        /// <returns></returns>
        public UserSearchReturnValue GetMultipleUserDetails(Guid logonId, int[] UserIds)
        {
            IRIS.Law.WebServiceInterfaces.Utilities.UserSearchReturnValue returnValue = new IRIS.Law.WebServiceInterfaces.Utilities.UserSearchReturnValue();

            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:
                        // Can only access themself
                        if (UserIds.Length != 1)
                        {
                            throw new Exception("Access denied");
                        }

                        if (UserInformation.Instance.DbUid != UserIds[0])
                        {
                            throw new Exception("Access denied");
                        }
                        break;

                    case DataConstants.UserType.ThirdParty:
                        // Can only access themself
                        if (UserIds.Length != 1)
                        {
                            throw new Exception("Access denied");
                        }

                        if (UserInformation.Instance.DbUid != UserIds[0])
                        {
                            throw new Exception("Access denied");
                        }
                        break;

                    default:
                        throw new Exception("Access denied");
                    }

                    DataListCreator <IRIS.Law.WebServiceInterfaces.Utilities.UserSearchItem> dataListCreator = new DataListCreator <IRIS.Law.WebServiceInterfaces.Utilities.UserSearchItem>();

                    returnValue.Users = new DataList <IRIS.Law.WebServiceInterfaces.Utilities.UserSearchItem>();

                    returnValue.Users.FirstRowNumber = 0;

                    foreach (IRIS.Law.PmsCommonData.DsUsersLookup.uvw_UsersRow Row in
                             SrvUserLookup.GetMultipleUsers(UserIds).Tables[0].Rows)
                    {
                        IRIS.Law.WebServiceInterfaces.Utilities.UserSearchItem Item = new IRIS.Law.WebServiceInterfaces.Utilities.UserSearchItem();

                        Item.UserId   = Row.uid;
                        Item.UserName = Row.name;
                        Item.Forename = Row.PersonName;
                        Item.Surname  = Row.PersonSurname;

                        returnValue.Users.TotalRowCount++;
                        returnValue.Users.Rows.Add(Item);
                    }
                }
                finally
                {
                    // Remove the logged on user's ApplicationSettings from the
                    // list of concurrent sessions
                    Host.UnloadLoggedOnUser();
                }
            }
            catch (System.Data.SqlClient.SqlException)
            {
                returnValue.Success = false;
                returnValue.Message = Functions.SQLErrorMessage;
            }
            catch (Exception ex)
            {
                returnValue.Success = false;
                returnValue.Message = ex.Message;
            }

            return(returnValue);
        }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="logonId"></param>
        /// <param name="collectionRequest"></param>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public EarnerSearchReturnValue EarnerSearch(Guid logonId, CollectionRequest collectionRequest,
                                                    EarnerSearchCriteria criteria)
        {
            EarnerSearchReturnValue returnValue = new EarnerSearchReturnValue();

            try
            {
                // Get the logged on user from the current logons and add their
                // ApplicationSettings the list of concurrent sessions.
                Host.LoadLoggedOnUser(logonId);

                try
                {
                    switch (UserInformation.Instance.UserType)
                    {
                    case DataConstants.UserType.Staff:
                    case DataConstants.UserType.Client:
                    case DataConstants.UserType.ThirdParty:
                        // Can do everything
                        break;

                    default:
                        throw new Exception("Access denied");
                    }

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

                    // Declare an inline event (annonymous delegate) to read the
                    // dataset if it is required
                    dataListCreator.ReadDataSet += delegate(object sender, ReadDataSetEventArgs e)
                    {
                        // TODO: Does not use criteria: FeeReference, EarnerId, UFNDate, UFNNumber
                        e.DataSet = SrvEarnerLookup.GetEarners(criteria.IncludeArchived, criteria.MultiOnly);

                        DataTable dt = Functions.SortDataTable(e.DataSet.Tables[0], "PersonSurname");
                        e.DataSet.Tables.Remove(e.DataSet.Tables[0]);
                        e.DataSet.Tables.Add(dt);
                    };

                    // Create the data list
                    returnValue.Earners = dataListCreator.Create(logonId,
                                                                 // Give the query a name so it can be cached
                                                                 "EarnerSearch",
                                                                 // Tell it the query criteria used so if the cache is accessed
                                                                 // again it knows if it is the same query
                                                                 criteria.ToString(),
                                                                 collectionRequest,
                                                                 // Import mappings to map the dataset row fields to the data
                                                                 // list entity properties
                                                                 new ImportMapping[] {
                        new ImportMapping("Id", "MemberId"),
                        new ImportMapping("Reference", "feeRef"),
                        new ImportMapping("Title", "PersonTitle"),
                        new ImportMapping("Name", "PersonName"),
                        new ImportMapping("SurName", "PersonSurname")
                    }
                                                                 );
                }
                finally
                {
                    // Remove the logged on user's ApplicationSettings from the
                    // list of concurrent sessions
                    Host.UnloadLoggedOnUser();
                }
            }
            catch (System.Data.SqlClient.SqlException)
            {
                returnValue.Success = false;
                returnValue.Message = Functions.SQLErrorMessage;
            }
            catch (Exception ex)
            {
                returnValue.Success = false;
                returnValue.Message = ex.Message;
            }

            return(returnValue);
        }
Esempio n. 7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="logonId"></param>
        /// <param name="collectionRequest"></param>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public PartnerSearchReturnValue PartnerSearch(Guid logonId, CollectionRequest collectionRequest,
                                                      PartnerSearchCriteria criteria)
        {
            PartnerSearchReturnValue returnValue = new PartnerSearchReturnValue();

            try
            {
                // Get the logged on user from the current logons and add their
                // ApplicationSettings the list of concurrent sessions.
                Host.LoadLoggedOnUser(logonId);

                try
                {
                    switch (UserInformation.Instance.UserType)
                    {
                    case DataConstants.UserType.Staff:
                    case DataConstants.UserType.Client:
                    case DataConstants.UserType.ThirdParty:
                        // Can do everything
                        break;

                    default:
                        throw new Exception("Access denied");
                    }

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

                    // Declare an inline event (annonymous delegate) to read the
                    // dataset if it is required
                    dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e)
                    {
                        // TODO: Does not use criteria: Name
                        e.DataSet = SrvEarnerLookup.GetPartnerLookup(criteria.IncludeArchived);

                        DataTable dt = Functions.SortDataTable(e.DataSet.Tables[0], "PersonSurname");
                        e.DataSet.Tables.Remove(e.DataSet.Tables[0]);
                        e.DataSet.Tables.Add(dt);
                    };

                    // Create the data list
                    DataList <PartnerSearchItem> partnerList = dataListCreator.Create(logonId,
                                                                                      // Give the query a name so it can be cached
                                                                                      "PartnerSearch",
                                                                                      // Tell it the query criteria used so if the cache is accessed
                                                                                      // again it knows if it is the same query
                                                                                      criteria.ToString(),
                                                                                      collectionRequest,
                                                                                      // Import mappings to map the dataset row fields to the data
                                                                                      // list entity properties
                                                                                      new ImportMapping[] {
                        new ImportMapping("PartnerId", "MemberId"),
                        new ImportMapping("Name", "PersonName"),
                        new ImportMapping("PersonTitle", "PersonTitle"),
                        new ImportMapping("Surname", "PersonSurname")
                    }
                                                                                      );

                    DataSet dsPartnerList;

                    partnerList.Rows.ForEach(delegate(PartnerSearchItem item)
                    {
                        dsPartnerList = SrvAddressLookup.GetMemberAddresses(item.PartnerId);
                        SrvAddress srvAddress;
                        int intCtr;

                        foreach (DataRow dr in dsPartnerList.Tables[0].Rows)
                        {
                            srvAddress          = new SrvAddress();
                            srvAddress.MemberId = item.PartnerId;
                            srvAddress.Load(int.Parse(dr["addressId"].ToString()));

                            for (intCtr = 0; intCtr < srvAddress.AdditionalInfoElements.Count; intCtr++)
                            {
                                AdditionalAddressElement additionalAddressElement = new AdditionalAddressElement();

                                if (srvAddress.AdditionalInfoElements[intCtr].AddressElTypeId == 8)
                                {
                                    item.Email = srvAddress.AdditionalInfoElements[intCtr].AddressElementText;
                                }
                            }
                        }
                    });


                    returnValue.Partners = partnerList;
                }
                finally
                {
                    // Remove the logged on user's ApplicationSettings from the
                    // list of concurrent sessions
                    Host.UnloadLoggedOnUser();
                }
            }
            catch (System.Data.SqlClient.SqlException)
            {
                returnValue.Success = false;
                returnValue.Message = Functions.SQLErrorMessage;
            }
            catch (Exception Ex)
            {
                returnValue.Success = false;
                returnValue.Message = Ex.Message;
            }

            return(returnValue);
        }