Beispiel #1
0
        /// <summary>
        /// Gets the supplimentary details for the role
        /// </summary>
        private void GetRoleExtendedInfo()
        {
            ContactServiceClient contactService = null;

            try
            {
                CollectionRequest collectionRequest     = new CollectionRequest();
                RoleExtendedInfoSearchCriteria criteria = new RoleExtendedInfoSearchCriteria();
                criteria.AssociationRoleId = Convert.ToInt32(_ddlRole.SelectedValue);

                contactService = new ContactServiceClient();
                RoleExtendedInfoReturnValue returnValue = contactService.RoleExtendedInfoSearch(_logonSettings.LogonId,
                                                                                                criteria, collectionRequest);

                if (returnValue.Success)
                {
                    //Set to false so that the info is not fetched again from the service if the user
                    //navigates back and does not change the role
                    _hdnRefreshRoleExtInfo.Value = "false";

                    if (returnValue.RoleExtendedInfo.Rows.Length > 0)
                    {
                        _grdAdditionalAssociationInfo.DataSource = returnValue.RoleExtendedInfo.Rows;
                        _grdAdditionalAssociationInfo.DataBind();
                    }
                    else
                    {
                        _grdAdditionalAssociationInfo.DataSource = null;
                        _grdAdditionalAssociationInfo.DataBind();

                        _wizardAddAssociationsForMatter.WizardSteps.Remove(_wizardStepAdditionalAssociationInfo2);
                    }
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (contactService != null)
                {
                    if (contactService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        contactService.Close();
                    }
                }
            }
        }
        /// <summary>
        /// Gets the supplimentary details for the role
        /// </summary>
        private void GetRoleExtendedInfo()
        {
            ContactServiceClient contactService = null;
            try
            {
                CollectionRequest collectionRequest = new CollectionRequest();
                RoleExtendedInfoSearchCriteria criteria = new RoleExtendedInfoSearchCriteria();
                criteria.AssociationRoleId = Convert.ToInt32(_ddlRole.SelectedValue);

                contactService = new ContactServiceClient();
                RoleExtendedInfoReturnValue returnValue = contactService.RoleExtendedInfoSearch(_logonSettings.LogonId,
                                            criteria, collectionRequest);

                if (returnValue.Success)
                {
                    //Set to false so that the info is not fetched again from the service if the user
                    //navigates back and does not change the role
                    _hdnRefreshRoleExtInfo.Value = "false";

                    if (returnValue.RoleExtendedInfo.Rows.Length > 0)
                    {
                        _grdAdditionalAssociationInfo.DataSource = returnValue.RoleExtendedInfo.Rows;
                        _grdAdditionalAssociationInfo.DataBind();
                    }
                    else
                    {
                        _grdAdditionalAssociationInfo.DataSource = null;
                        _grdAdditionalAssociationInfo.DataBind();

                        _wizardAddAssociationsForMatter.WizardSteps.Remove(_wizardStepAdditionalAssociationInfo2);
                    }
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (contactService != null)
                {
                    if (contactService.State != System.ServiceModel.CommunicationState.Faulted)
                        contactService.Close();
                }
            }
        }
        /// <summary>
        /// Get extended info for the Roles.
        /// </summary>
        /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param>
        /// <param name="criteria">RoleExtendedInfo search criteria</param>
        /// <param name="collectionRequest">Information about the collection being requested.</param>
        /// <returns></returns>
        public RoleExtendedInfoReturnValue RoleExtendedInfoSearch(HostSecurityToken oHostSecurityToken, RoleExtendedInfoSearchCriteria criteria,
                                                CollectionRequest collectionRequest)
        {
            RoleExtendedInfoReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oContactService = new ContactService();
                returnValue = oContactService.RoleExtendedInfoSearch(Functions.GetLogonIdFromToken(oHostSecurityToken),
                    criteria, collectionRequest);
            }
            else
            {
                returnValue = new RoleExtendedInfoReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return returnValue;
        }
        /// <summary>
        /// Get extended info for the Roles.
        /// </summary>
        /// <param name="logonId">Logon id obtained when logging on to the logon service.</param>
        /// <param name="criteria">RoleExtendedInfo search criteria</param>
        /// <param name="collectionRequest">Information about the collection being requested.</param>
        /// <returns></returns>
        public RoleExtendedInfoReturnValue RoleExtendedInfoSearch(Guid logonId, RoleExtendedInfoSearchCriteria criteria,
                                                CollectionRequest collectionRequest)
        {
            RoleExtendedInfoReturnValue returnValue = new RoleExtendedInfoReturnValue();

            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 extended role info
                    DataListCreator<RoleExtendedInfoSearchItem> dataListCreator = new DataListCreator<RoleExtendedInfoSearchItem>();

                    // Declare an inline event (annonymous delegate) to read the dataset
                    dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e)
                    {
                        e.DataSet = SrvRoleExtendedInfoLookup.GetExtendedInformationByRoleID(criteria.AssociationRoleId);
                    };

                    // Create the data list
                    returnValue.RoleExtendedInfo = dataListCreator.Create(logonId,
                        // Give the query a name so it can be cached
                        "RoleExtendedInfoSearch",
                        // 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("TypeId", "RolExtInfoTypeId"),
                            new ImportMapping("TypeName", "RolExtInfoTypeName"),
                            new ImportMapping("UserCanEdit", "RolExtInfoUserCanEdit"),
                            new ImportMapping("SourceText", "RolExtInfoSourceText"),
                            new ImportMapping("DataType", "RolExtInfoDataType")
                            }
                        );
                }
                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;
        }
Beispiel #5
0
        /// <summary>
        /// Get extended info for the Roles.
        /// </summary>
        /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param>
        /// <param name="criteria">RoleExtendedInfo search criteria</param>
        /// <param name="collectionRequest">Information about the collection being requested.</param>
        /// <returns></returns>
        public RoleExtendedInfoReturnValue RoleExtendedInfoSearch(HostSecurityToken oHostSecurityToken, RoleExtendedInfoSearchCriteria criteria,
                                                                  CollectionRequest collectionRequest)
        {
            RoleExtendedInfoReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oContactService = new ContactService();
                returnValue     = oContactService.RoleExtendedInfoSearch(Functions.GetLogonIdFromToken(oHostSecurityToken),
                                                                         criteria, collectionRequest);
            }
            else
            {
                returnValue         = new RoleExtendedInfoReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }