コード例 #1
0
        private void BindFeeEarner()
        {
            EarnerServiceClient earnerService = null;

            try
            {
                CollectionRequest collectionRequest = new CollectionRequest();

                EarnerSearchCriteria criteria = new EarnerSearchCriteria();
                criteria.IncludeArchived = false;
                criteria.MultiOnly       = false;

                earnerService = new EarnerServiceClient();
                EarnerSearchReturnValue returnValue = earnerService.EarnerSearch(((LogonReturnValue)Session[SessionName.LogonSettings]).LogonId,
                                                                                 collectionRequest, criteria);

                if (returnValue.Success)
                {
                    _ddlFeeEarner.Items.Clear();
                    foreach (EarnerSearchItem feeEarner in returnValue.Earners.Rows)
                    {
                        ListItem item = new ListItem();
                        item.Text  = CommonFunctions.MakeFullName(feeEarner.Title, feeEarner.Name, feeEarner.SurName);
                        item.Value = feeEarner.Reference + "$" + feeEarner.Id.ToString();

                        if (!_editMode)
                        {
                            if (((LogonReturnValue)Session[SessionName.LogonSettings]).MemberId == feeEarner.Id)
                            {
                                item.Selected = true;
                            }
                        }

                        _ddlFeeEarner.Items.Add(item);
                    }
                    AddDefaultToDropDownList(_ddlFeeEarner);
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (earnerService != null)
                {
                    if (earnerService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        earnerService.Close();
                    }
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="oHostSecurityToken"></param>
 /// <param name="collectionRequest"></param>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public EarnerSearchReturnValue EarnerSearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest,
     EarnerSearchCriteria criteria)
 {
     EarnerSearchReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oEarnerService = new EarnerService();
         returnValue = oEarnerService.EarnerSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria);
     }
     else
     {
         returnValue = new EarnerSearchReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="oHostSecurityToken"></param>
        /// <param name="collectionRequest"></param>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public EarnerSearchReturnValue EarnerSearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest,
                                                    EarnerSearchCriteria criteria)
        {
            EarnerSearchReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oEarnerService = new EarnerService();
                returnValue    = oEarnerService.EarnerSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria);
            }
            else
            {
                returnValue         = new EarnerSearchReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
コード例 #4
0
        /// <summary>
        /// Binds fee earners
        /// </summary>
        private void BindFeeEarner()
        {
            EarnerServiceClient earnerService = null;
            try
            {
                CollectionRequest collectionRequest = new CollectionRequest();

                EarnerSearchCriteria criteria = new EarnerSearchCriteria();
                criteria.IncludeArchived = false;
                criteria.MultiOnly = false;

                earnerService = new EarnerServiceClient();
                EarnerSearchReturnValue returnValue = earnerService.EarnerSearch(_logonSettings.LogonId,
                                            collectionRequest, criteria);

                if (returnValue.Success)
                {
                    _ddlFeeEarner.Items.Clear();
                    foreach (EarnerSearchItem feeEarner in returnValue.Earners.Rows)
                    {
                        ListItem item = new ListItem();
                        item.Text = CommonFunctions.MakeFullName(feeEarner.Title, feeEarner.Name, feeEarner.SurName);
                        item.Value = feeEarner.Id.ToString();
                        _ddlFeeEarner.Items.Add(item);
                    }
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
                AppFunctions.AddDefaultToDropDownList(_ddlFeeEarner);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (earnerService != null)
                {
                    if (earnerService.State != System.ServiceModel.CommunicationState.Faulted)
                        earnerService.Close();
                }
            }
        }
コード例 #5
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;
        }
コード例 #6
0
        private void BindFeeEarner()
        {
            EarnerServiceClient earnerService = null;
            try
            {
                CollectionRequest collectionRequest = new CollectionRequest();

                EarnerSearchCriteria criteria = new EarnerSearchCriteria();
                criteria.IncludeArchived = false;
                criteria.MultiOnly = false;

                earnerService = new EarnerServiceClient();
                EarnerSearchReturnValue returnValue = earnerService.EarnerSearch(((LogonReturnValue)Session[SessionName.LogonSettings]).LogonId,
                                            collectionRequest, criteria);

                if (returnValue.Success)
                {
                    _ddlFeeEarner.Items.Clear();
                    foreach (EarnerSearchItem feeEarner in returnValue.Earners.Rows)
                    {
                        ListItem item = new ListItem();
                        item.Text = CommonFunctions.MakeFullName(feeEarner.Title, feeEarner.Name, feeEarner.SurName);
                        item.Value = feeEarner.Reference + "$" + feeEarner.Id.ToString();

                        if (!_editMode)
                        {
                            if (((LogonReturnValue)Session[SessionName.LogonSettings]).MemberId == feeEarner.Id)
                            {
                                item.Selected = true;
                            }
                        }

                        _ddlFeeEarner.Items.Add(item);
                    }
                    AddDefaultToDropDownList(_ddlFeeEarner);
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (earnerService != null)
                {
                    earnerService.Close();
                }
            }
        }
コード例 #7
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);
        }