Esempio n. 1
0
        private void BindPartner()
        {
            EarnerServiceClient earnerService = null;

            try
            {
                PartnerSearchCriteria criteria = new PartnerSearchCriteria();
                earnerService = new EarnerServiceClient();

                CollectionRequest collectionRequest = new CollectionRequest();
                collectionRequest.ForceRefresh = true;
                collectionRequest.StartRow     = 0;
                collectionRequest.RowCount     = 0;

                PartnerSearchReturnValue returnValue = new PartnerSearchReturnValue();
                returnValue = earnerService.PartnerSearch(_logonSettings.LogonId, collectionRequest, criteria);

                if (returnValue.Success)
                {
                    foreach (PartnerSearchItem partner in returnValue.Partners.Rows)
                    {
                        ListItem item = new ListItem();
                        item.Text  = CommonFunctions.MakeFullName(partner.PersonTitle, partner.Name, partner.Surname);
                        item.Value = partner.PartnerId.ToString();
                        _ddlPartner.Items.Add(item);
                    }
                    _ddlPartner.Items.Insert(0, new ListItem("All Partners", ""));
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException)
            {
                _lblMessage.Text     = DataConstants.WSEndPointErrorMessage;
                _lblMessage.CssClass = "errorMessage";
            }
            catch (Exception ex)
            {
                _lblMessage.CssClass = "errorMessage";
                _lblMessage.Text     = ex.Message;
            }
            finally
            {
                if (earnerService != null)
                {
                    if (earnerService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        earnerService.Close();
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="oHostSecurityToken"></param>
        /// <param name="collectionRequest"></param>
        /// <returns></returns>
        public PartnerSearchReturnValue PersonDealingSearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest)
        {
            PartnerSearchReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oEarnerService = new EarnerService();
                returnValue    = oEarnerService.PersonDealingSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest);
            }
            else
            {
                returnValue         = new PartnerSearchReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
        /// <summary>
        /// Gets the fee earners.
        /// </summary>
        private void GetFeeEarners()
        {
            EarnerServiceClient earnerService = null;

            try
            {
                earnerService = new EarnerServiceClient();

                PartnerSearchCriteria criteria          = new PartnerSearchCriteria();
                CollectionRequest     collectionRequest = new CollectionRequest();

                PartnerSearchReturnValue returnValue = new PartnerSearchReturnValue();
                returnValue = earnerService.PartnerSearch(_logonId, collectionRequest, criteria);

                if (returnValue.Success)
                {
                    _ddlFeeEarner.Items.Clear();
                    foreach (PartnerSearchItem partner in returnValue.Partners.Rows)
                    {
                        ListItem item = new ListItem();
                        item.Text  = CommonFunctions.MakeFullName(partner.PersonTitle, partner.Name, partner.Surname);
                        item.Value = partner.PartnerId.ToString();
                        _ddlFeeEarner.Items.Add(item);
                    }
                    _ddlFeeEarner.Items.Insert(0, new ListItem("All Partners", ""));
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (earnerService != null)
                {
                    if (earnerService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        earnerService.Close();
                    }
                }
            }
        }
        private void BindPartner()
        {
            EarnerServiceClient earnerService = null;
            try
            {
                PartnerSearchCriteria criteria = new PartnerSearchCriteria();
                earnerService = new EarnerServiceClient();

                CollectionRequest collectionRequest = new CollectionRequest();
                collectionRequest.ForceRefresh = true;
                collectionRequest.StartRow = 0;
                collectionRequest.RowCount = 0;

                PartnerSearchReturnValue returnValue = new PartnerSearchReturnValue();
                returnValue = earnerService.PartnerSearch(_logonSettings.LogonId, collectionRequest, criteria);

                if (returnValue.Success)
                {
                    foreach (PartnerSearchItem partner in returnValue.Partners.Rows)
                    {
                        ListItem item = new ListItem();
                        item.Text = CommonFunctions.MakeFullName(partner.PersonTitle, partner.Name, partner.Surname);
                        item.Value = partner.PartnerId.ToString();
                        _ddlPartner.Items.Add(item);
                    }
                    _ddlPartner.Items.Insert(0, new ListItem("All Partners", ""));
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException)
            {
                _lblMessage.Text = DataConstants.WSEndPointErrorMessage;
                _lblMessage.CssClass = "errorMessage";
            }
            catch (Exception ex)
            {
                _lblMessage.CssClass = "errorMessage";
                _lblMessage.Text = ex.Message;
            }
            finally
            {
                if (earnerService != null)
                {
                    if (earnerService.State != System.ServiceModel.CommunicationState.Faulted)
                        earnerService.Close();
                }
            }
        }
        /// <summary>
        /// Gets the fee earners.
        /// </summary>
        private void GetFeeEarners()
        {
            EarnerServiceClient earnerService = null;
            try
            {
                earnerService = new EarnerServiceClient();

                PartnerSearchCriteria criteria = new PartnerSearchCriteria();
                CollectionRequest collectionRequest = new CollectionRequest();

                PartnerSearchReturnValue returnValue = new PartnerSearchReturnValue();
                returnValue = earnerService.PartnerSearch(_logonId, collectionRequest, criteria);

                if (returnValue.Success)
                {
                    _ddlFeeEarner.Items.Clear();
                    foreach (PartnerSearchItem partner in returnValue.Partners.Rows)
                    {
                        ListItem item = new ListItem();
                        item.Text = CommonFunctions.MakeFullName(partner.PersonTitle, partner.Name, partner.Surname);
                        item.Value = partner.PartnerId.ToString();
                        _ddlFeeEarner.Items.Add(item);
                    }
                    _ddlFeeEarner.Items.Insert(0, new ListItem("All Partners", ""));
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (earnerService != null)
                {
                    if (earnerService.State != System.ServiceModel.CommunicationState.Faulted)
                        earnerService.Close();
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="logonId"></param>
        /// <param name="collectionRequest"></param>
        /// <returns></returns>
        public PartnerSearchReturnValue PersonDealingSearch(Guid logonId, CollectionRequest collectionRequest)
        {
            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 the criteria
                        e.DataSet = SrvMatterLookup.GetPersonDealingLookup();

                        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.Partners = dataListCreator.Create(logonId,
                        // Give the query a name so it can be cached
                        "PersonDealingSearch",
                        // 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("UId", "uid"),
                        new ImportMapping("Name", "PersonName"),
                        new ImportMapping("PersonTitle", "PersonTitle"),
                        new ImportMapping("Surname", "PersonSurname"),
                        new ImportMapping("PartnerId", "MemberId")
                        }
                        );
                }
                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 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;
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="oHostSecurityToken"></param>
 /// <param name="collectionRequest"></param>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public PartnerSearchReturnValue PartnerSearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest,
     PartnerSearchCriteria criteria)
 {
     PartnerSearchReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oEarnerService = new EarnerService();
         returnValue = oEarnerService.PartnerSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria);
     }
     else
     {
         returnValue = new PartnerSearchReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }
        private void LoadMatterFeeEarner(Guid ProjectID)
        {
            MatterServiceClient matterService = new MatterServiceClient();

            try
            {
                MatterReturnValue matterReturnValue = new MatterReturnValue();
                matterReturnValue = matterService.GetMatter(_logonSettings.LogonId, ProjectID);

                if (matterReturnValue.Success)
                {
                    if (matterReturnValue != null)
                    {
                        if (matterReturnValue.Matter.FeeEarnerMemberId != null)
                        {
                            EarnerServiceClient partnerClient = new EarnerServiceClient();
                            try
                            {
                                PartnerSearchCriteria partnerCriteria   = new PartnerSearchCriteria();
                                CollectionRequest     collectionRequest = new CollectionRequest();
                                collectionRequest.StartRow = 0;

                                PartnerSearchReturnValue partnerReturnValue = partnerClient.PartnerSearch(_logonSettings.LogonId, collectionRequest, partnerCriteria);

                                if (partnerReturnValue.Success)
                                {
                                    if (partnerReturnValue.Partners != null)
                                    {
                                        for (int i = 0; i < partnerReturnValue.Partners.Rows.Length; i++)
                                        {
                                            if (partnerReturnValue.Partners.Rows[i].PartnerId.ToString() == matterReturnValue.Matter.FeeEarnerMemberId.ToString())
                                            {
                                                _txtAttendees.Text          = CommonFunctions.MakeFullName(partnerReturnValue.Partners.Rows[i].PersonTitle, partnerReturnValue.Partners.Rows[i].Name, partnerReturnValue.Partners.Rows[i].Surname);
                                                _hdnAttendeesMemberId.Value = partnerReturnValue.Partners.Rows[i].PartnerId.ToString() + ";";
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    _lblError.Text = partnerReturnValue.Message;
                                }
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                            finally
                            {
                                if (partnerClient.State != System.ServiceModel.CommunicationState.Faulted)
                                {
                                    partnerClient.Close();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (matterService.State != System.ServiceModel.CommunicationState.Faulted)
                {
                    matterService.Close();
                }
            }
        }
Esempio n. 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="logonId"></param>
        /// <param name="collectionRequest"></param>
        /// <returns></returns>
        public PartnerSearchReturnValue PersonDealingSearch(Guid logonId, CollectionRequest collectionRequest)
        {
            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 the criteria
                        e.DataSet = SrvMatterLookup.GetPersonDealingLookup();

                        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.Partners = dataListCreator.Create(logonId,
                                                                  // Give the query a name so it can be cached
                                                                  "PersonDealingSearch",
                                                                  // 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("UId", "uid"),
                        new ImportMapping("Name", "PersonName"),
                        new ImportMapping("PersonTitle", "PersonTitle"),
                        new ImportMapping("Surname", "PersonSurname"),
                        new ImportMapping("PartnerId", "MemberId")
                    }
                                                                  );
                }
                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. 11
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);
        }