Beispiel #1
0
        public BranchVatReturnValue GetBranchVatForProject(HostSecurityToken oHostSecurityToken, Guid projectId)
        {
            BranchVatReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oAccountService = new AccountsService();
                returnValue     = oAccountService.GetBranchVatForProject(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId);
            }
            else
            {
                returnValue         = new BranchVatReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
        public BranchVatReturnValue GetBranchVatForProject(Guid logonId, Guid projectId)
        {
            BranchVatReturnValue returnValue = new BranchVatReturnValue();

            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");
                    }

                    Guid matterBranchId = SrvMatterCommon.GetMatterBranchGuid(projectId);
                    returnValue.BranchNoVat = SrvBranchCommon.GetBranchNoVAT(matterBranchId);
                }
                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;
        }
 public BranchVatReturnValue GetBranchVatForProject(HostSecurityToken oHostSecurityToken, Guid projectId)
 {
     BranchVatReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oAccountService = new AccountsService();
         returnValue = oAccountService.GetBranchVatForProject(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId);
     }
     else
     {
         returnValue = new BranchVatReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }