コード例 #1
0
        /// <summary>
        /// Populate Clearance Days
        /// </summary>
        private void SetClearanceDays(int clearanceTypeId, bool isCredit)
        {
            AccountsServiceClient accountService = null;

            try
            {
                CollectionRequest collectionRequest = new CollectionRequest();

                ClearanceTypeSearchCriteria criteria = new ClearanceTypeSearchCriteria();
                criteria.IsCredit        = isCredit;
                criteria.IncludeArchived = false;

                accountService = new AccountsServiceClient();
                ClearanceTypeSearchReturnValue returnValue = accountService.ClearanceTypes(_logonSettings.LogonId,
                                                                                           collectionRequest, criteria);

                if (returnValue.Success)
                {
                    foreach (ClearanceTypeSearchItem type in returnValue.ClearanceTypes.Rows)
                    {
                        if (clearanceTypeId == type.ClearanceTypeId)
                        {
                            _txtClearanceDaysChq.Text  = type.ClearanceTypeChqDays.ToString();
                            _txtClearanceDaysElec.Text = type.ClearanceTypeElecDays.ToString();
                        }
                    }
                }
                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 (accountService != null)
                {
                    if (accountService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        accountService.Close();
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets list of clearance type
        /// </summary>
        /// <returns>Returns clearance types.</returns>
        private ClearanceTypeSearchItem[] GetClearanceType(bool isCredit)
        {
            AccountsServiceClient accountService = null;

            ClearanceTypeSearchItem[] clearanceType = null;
            try
            {
                CollectionRequest collectionRequest = new CollectionRequest();

                ClearanceTypeSearchCriteria criteria = new ClearanceTypeSearchCriteria();
                criteria.IsCredit        = isCredit;
                criteria.IncludeArchived = false;

                accountService = new AccountsServiceClient();
                ClearanceTypeSearchReturnValue returnValue = accountService.ClearanceTypes(_logonSettings.LogonId,
                                                                                           collectionRequest, criteria);

                if (returnValue.Success)
                {
                    clearanceType = returnValue.ClearanceTypes.Rows;
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
                return(clearanceType);
            }
            catch (System.ServiceModel.EndpointNotFoundException)
            {
                _lblMessage.Text     = DataConstants.WSEndPointErrorMessage;
                _lblMessage.CssClass = "errorMessage";
                return(clearanceType);
            }
            catch (Exception ex)
            {
                _lblMessage.CssClass = "errorMessage";
                _lblMessage.Text     = ex.Message;
                return(clearanceType);
            }
            finally
            {
                if (accountService != null)
                {
                    if (accountService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        accountService.Close();
                    }
                }
            }
        }
コード例 #3
0
        //Get Clearance Types
        #region GetClearanceTypes

        public ClearanceTypeSearchReturnValue ClearanceTypes(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest,
                                                             ClearanceTypeSearchCriteria criteria)
        {
            ClearanceTypeSearchReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oAccountService = new AccountsService();
                returnValue     = oAccountService.ClearanceTypes(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria);
            }
            else
            {
                returnValue         = new ClearanceTypeSearchReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
コード例 #4
0
        public ClearanceTypeSearchReturnValue ClearanceTypes(Guid logonId, CollectionRequest collectionRequest,
            ClearanceTypeSearchCriteria criteria)
        {
            ClearanceTypeSearchReturnValue returnValue = new ClearanceTypeSearchReturnValue();

            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 clearance types
                    DataListCreator<ClearanceTypeSearchItem> dataListCreator = new DataListCreator<ClearanceTypeSearchItem>();

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

                    // Create the data list
                    returnValue.ClearanceTypes = dataListCreator.Create(logonId,
                        // Give the query a name so it can be cached
                        "GetClearanceTypes",
                        // 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("ClearanceTypeId", "ClearanceTypeId"),
                            new ImportMapping("ClearanceTypeDesc", "ClearanceTypeDesc"),
                            new ImportMapping("ClearanceTypeChqDays", "ClearanceTypeChqDays"),
                            new ImportMapping("ClearanceTypeElecDays", "ClearanceTypeElecDays"),
                            new ImportMapping("ClearanceTypeIsCredit", "ClearanceTypeIsCredit"),
                            new ImportMapping("ClearanceTypeArchived", "ClearanceTypeArchived"),
                            }
                        );
                }
                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;
        }
コード例 #5
0
 public ClearanceTypeSearchReturnValue ClearanceTypes(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest,
     ClearanceTypeSearchCriteria criteria)
 {
     ClearanceTypeSearchReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oAccountService = new AccountsService();
         returnValue = oAccountService.ClearanceTypes(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest,criteria);
     }
     else
     {
         returnValue = new ClearanceTypeSearchReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }