public ClientRevenueQueryOptions(ScopeOptions scope, string sortColumn, string sortDirection, int pageSize, int pageNumber, string filters = null)
            : base(sortColumn, sortDirection, pageSize, pageNumber, filters)
        {
            Scope = scope;

            BranchId     = new List <Guid>();
            UserId       = new List <Guid>();
            PolicyTypeId = new List <Guid>();

            //Defaults
            var lastMonth = DateTime.UtcNow.AddMonths(-1);

            YearEnding  = lastMonth.Year;
            MonthEnding = lastMonth.Month;

            var result = GetFilterValue <int>("YearEnding");

            if (result.Success)
            {
                YearEnding = result.Value;
            }

            result = GetFilterValue <int>("MonthEnding");
            if (result.Success)
            {
                MonthEnding = result.Value;
            }

            var resultString = GetFilterValue <string>("ClientLastName");

            if (resultString.Success)
            {
                ClientLastName = resultString.Value;
            }

            var resultGuids = GetFilterValues <Guid>("BranchId");

            if (resultGuids.Success)
            {
                BranchId = resultGuids.Value;
            }

            resultGuids = GetFilterValues <Guid>("UserId");
            if (resultGuids.Success)
            {
                UserId = resultGuids.Value;
            }

            resultGuids = GetFilterValues <Guid>("PolicyTypeId");
            if (resultGuids.Success)
            {
                PolicyTypeId = resultGuids.Value;
            }

            //Set start and end dates
            var date = new DateTime(YearEnding, MonthEnding, 1);

            EndDate   = date.LastDayOfMonth();
            StartDate = EndDate.AddYears(-1);
        }
Esempio n. 2
0
        public virtual string NextMangled(ScopeOptions options, SymbolDef symbolDef)
        {
            var ext = Enclosed;

            while (true)
            {
again:
                var m = Base54(options.Chars, Cname++);
                if (!OutputContext.IsIdentifier(m))
                {
                    continue;                                 // skip over "do"
                }
                // https://github.com/mishoo/UglifyJS2/issues/242 -- do not
                // shadow a name reserved from mangling.
                if (options.Reserved.Contains(m))
                {
                    continue;
                }

                // we must ensure that the mangled name does not shadow a name
                // from some parent scope that is referenced in this or in
                // inner scopes.
                for (var i = 0u; i < ext.Count; i++)
                {
                    var sym  = ext[i];
                    var name = sym.MangledName ?? (sym.Unmangleable(options) ? sym.Name : null);
                    if (m == name)
                    {
                        goto again;
                    }
                }

                return(m);
            }
        }
Esempio n. 3
0
        public async Task AutoResolveMappingErrors(ScopeOptions scope, Guid commissionStatementId, Guid policyId)
        {
            var policy = await _context.Policy.FindAsync(policyId);

            var organisationQuery = ScopeQuery.GetOrganisationEntityQuery(_context, scope);

            var query = from commissionError in GetCommissionErrorEditQuery(scope)
                        where commissionError.CommissionStatementId == commissionStatementId
                        select commissionError;

            var errors = await query.ToListAsync();

            foreach (var error in errors)
            {
                var policyNumbers = policy.NumberAliases.ToList();
                policyNumbers.Add(policy.Number);

                if (!policyNumbers.Any(p => p.IgnoreCaseEquals(error.Data.PolicyNumber)))
                {
                    continue;
                }

                error.ClientId = policy.ClientId;
                error.PolicyId = policyId;
                await ResolveMappingError(scope, error);
            }
        }
Esempio n. 4
0
        private IQueryable <CommissionError> GetCommissionErrorQuery(ScopeOptions scope)
        {
            var query = from entity in GetCommissionErrorEntityQuery(scope)
                        join commissionStatement in _context.CommissionStatement on entity.CommissionStatementId equals commissionStatement.Id
                        join company in _context.Company on commissionStatement.CompanyId equals company.Id
                        join commissionType in _context.CommissionType on entity.CommissionTypeId equals commissionType.Id into commissionTypeGroup
                        from commissionType in commissionTypeGroup.DefaultIfEmpty()
                        join policyType in _context.PolicyType on commissionType.PolicyTypeId equals policyType.Id into policyTypeGroup
                        from policyType in policyTypeGroup.DefaultIfEmpty()
                        select new CommissionError()
            {
                Id = entity.Id,
                CommissionStatementId    = entity.CommissionStatementId,
                CommissionStatementMonth = commissionStatement.DateMonth,
                CommissionStatementYear  = commissionStatement.DateYear,
                CommissionTypeId         = entity.CommissionTypeId,
                Data           = entity.Data,
                ClientId       = entity.ClientId,
                PolicyId       = entity.PolicyId,
                PolicyTypeCode = policyType.Code,
                CompanyId      = company.Id,
                CompanyName    = company.Name
            };

            return(query);
        }
        private IQueryable <OrganisationEntity> GetOrganisationEnitiyQuery(ScopeOptions scope)
        {
            var query = from organisation in ScopeQuery.GetOrganisationEntityQuery(_context, scope)
                        select organisation;

            return(query);
        }
        public async Task <Result> InsertOrganisation(ScopeOptions scope, OrganisationEdit organisation)
        {
            var validator = new OrganisationValidator(_context, true, organisation.Id);
            var result    = validator.Validate(organisation).GetResult();

            if (!result.Success)
            {
                return(result);
            }

            //Only for super admins
            if (!scope.IgnoreScope)
            {
                return(new Result());
            }

            var entity = MapModelToEntity(organisation);
            await _context.Organisation.AddAsync(entity);

            await _context.SaveChangesAsync();

            organisation.Id = entity.Id;
            result.Tag      = organisation;

            return(result);
        }
Esempio n. 7
0
        public async Task <Result> UpdatePolicy(ScopeOptions scope, PolicyEdit policy)
        {
            var validator = new PolicyValidator(_context, scope, false);
            var result    = validator.Validate(policy, ruleSet: "default,availability").GetResult();

            if (!result.Success)
            {
                return(result);
            }

            var entity = await GetPolicyEntityQuery(scope).FirstOrDefaultAsync(p => p.Id == policy.Id);

            if (entity == null)
            {
                return(new Result());
            }

            var clientEntity = MapModelToEntity(policy, entity);

            await _context.SaveChangesAsync();

            await _auditService.InsertAuditLog(scope, AuditLog.ACTION_UPDATE, "Policy", entity.Id, policy);

            return(result);
        }
        public async Task <Result> UpdateOrganisation(ScopeOptions scope, OrganisationEdit organisation)
        {
            var validator = new OrganisationValidator(_context, false, organisation.Id);
            var result    = validator.Validate(organisation).GetResult();

            if (!result.Success)
            {
                return(result);
            }

            //Only organisation scope
            if (scope.Scope == Scope.Branch || scope.Scope == Scope.User)
            {
                return(new Result());
            }

            var entity = await ScopeQuery
                         .GetOrganisationEntityQuery(_context, scope)
                         .FirstOrDefaultAsync(o => o.Id == organisation.Id);

            if (entity == null)
            {
                return(new Result());
            }

            entity = MapModelToEntity(organisation, entity);
            await _context.SaveChangesAsync();

            return(result);
        }
Esempio n. 9
0
        public async Task <Result> UpdateCommissionSplitRulePolicy(ScopeOptions scope, CommissionSplitRulePolicy commissionSplitRulePolicy)
        {
            var validator = new CommissionSplitRulePolicyValidator(_context, scope, false);
            var result    = validator.Validate(commissionSplitRulePolicy).GetResult();

            if (!result.Success)
            {
                return(result);
            }

            var entity = await GetCommissionSplitRulePolicyEntityQuery(scope).FirstOrDefaultAsync(b => b.Id == commissionSplitRulePolicy.Id);

            if (entity == null)
            {
                return(new Result());
            }

            var defaultRule = await GetDefaultCommissionSplitRule(scope, commissionSplitRulePolicy.PolicyId.Value);

            //If this is the default rule, then remove this instance
            if (defaultRule != null && commissionSplitRulePolicy.CommissionSplitRuleId == defaultRule.Id)
            {
                await DeleteCommissionSplitRulePolicy(scope, commissionSplitRulePolicy.Id.Value);

                return(result);
            }

            var commissionSplitRulePolicyEntity = MapModelToEntity(commissionSplitRulePolicy, entity);

            await _context.SaveChangesAsync();

            await _auditService.InsertAuditLog(scope, AuditLog.ACTION_UPDATE, "CommissionSplitRulePolicy", entity.Id, commissionSplitRulePolicy);

            return(result);
        }
Esempio n. 10
0
        public async Task <Result> InsertCommissionSplitRulePolicy(ScopeOptions scope, CommissionSplitRulePolicy commissionSplitRulePolicy)
        {
            var validator = new CommissionSplitRulePolicyValidator(_context, scope, true);
            var result    = validator.Validate(commissionSplitRulePolicy).GetResult();

            if (!result.Success)
            {
                return(result);
            }

            var defaultRule = await GetDefaultCommissionSplitRule(scope, commissionSplitRulePolicy.PolicyId.Value);

            //If the rule is already the default dont add it
            if (defaultRule != null && commissionSplitRulePolicy.CommissionSplitRuleId == defaultRule.Id)
            {
                return(result);
            }

            var entity = MapModelToEntity(commissionSplitRulePolicy);
            await _context.CommissionSplitRulePolicy.AddAsync(entity);

            await _context.SaveChangesAsync();

            commissionSplitRulePolicy.Id = entity.Id;
            result.Tag = commissionSplitRulePolicy;

            await _auditService.InsertAuditLog(scope, AuditLog.ACTION_INSERT, "CommissionSplitRulePolicy", entity.Id, commissionSplitRulePolicy);

            return(result);
        }
        public async Task Invoke(HttpContext httpContext)
        {
            if (!Options.Value.Enabled)
            {
                await Next(httpContext);

                return;
            }

            var serviceProvider          = httpContext.RequestServices;
            var azureDevOpsScopeProvider = serviceProvider.GetRequiredService <IAzureDevOpsScopeProvider>();

            azureDevOpsScopeProvider.Scope = new AzureDevOpsScope(ScopeOptions.Project, ScopeOptions.Title, ScopeOptions.Tags);
            var azureDevOpsWorkItemCreator = serviceProvider.GetRequiredService <IAzureDevOpsWorkItemCreator>();


            try
            {
                await Next(httpContext);

                if (ScopeOptions.IsBug != null && ScopeOptions.IsBug(httpContext))
                {
                    await CreateBug(azureDevOpsScopeProvider, azureDevOpsWorkItemCreator, httpContext, null);
                }
            }
            catch (Exception ex)
            {
                await CreateBug(azureDevOpsScopeProvider, azureDevOpsWorkItemCreator, httpContext, ex);

                throw;
            }
        }
Esempio n. 12
0
        public CommissionErrorQueryOptions(ScopeOptions scope, string sortColumn, string sortDirection, int pageSize, int pageNumber, string filters = null)
            : base(sortColumn, sortDirection, pageSize, pageNumber, filters)
        {
            Scope = scope;

            var resultGuid = GetFilterValue <Guid>("CommissionStatementId");

            if (resultGuid.Success)
            {
                CommissionStatementId = resultGuid.Value;
            }

            var resultInt = GetFilterValue <int>("CommissionStatementYear");

            if (resultInt.Success)
            {
                CommissionStatementYear = resultInt.Value;
            }

            resultInt = GetFilterValue <int>("CommissionStatementMonth");
            if (resultInt.Success)
            {
                CommissionStatementMonth = resultInt.Value;
            }
        }
Esempio n. 13
0
        public async Task Delete()
        {
            var clientId = Guid.NewGuid();

            var service     = new Mock <IClientService>();
            var authService = TestHelper.MockAuthenticationService(Scope.Branch);

            var result = new Result()
            {
                Success = true
            };

            ScopeOptions options = null;
            Guid         deleted = Guid.Empty;

            service.Setup(c => c.DeleteClient(It.IsAny <ScopeOptions>(), It.Is <Guid>(m => m == clientId)))
            .Callback((ScopeOptions o, Guid d) =>
            {
                deleted = d;
                options = o;
            })
            .ReturnsAsync(result);

            var controller = new ClientsController(service.Object, authService.Object);

            var actual = await controller.Delete(clientId);

            Assert.Equal(clientId, deleted);
            Assert.Equal(Scope.Branch, options.Scope);

            var okResult    = Assert.IsType <OkObjectResult>(actual);
            var returnValue = Assert.IsType <Result>(okResult.Value);

            Assert.Same(result, returnValue);
        }
Esempio n. 14
0
        private async Task <Result> ImportCellphone(ScopeOptions scope, ImportClient data, ClientEdit client)
        {
            var result = new Result(true);

            if (string.IsNullOrEmpty(data.Cellphone))
            {
                return(result);
            }

            //Clean
            data.Cellphone = data.Cellphone.TrimWhiteSpace().Replace("-", "");

            //See if email exits
            var email = await _contactService.GetContact(scope, client.Id.Value, data.Cellphone);

            if (email == null)
            {
                var contact = new Contact()
                {
                    ClientId      = client.Id,
                    Value         = data.Cellphone,
                    ContactTypeId = ContactType.CONTACT_TYPE_CELLPHONE
                };

                result = await _contactService.InsertContact(scope, contact);
            }

            return(result);
        }
Esempio n. 15
0
        public async Task GetBranchesSimple()
        {
            var branch = new BranchSimple()
            {
                Id   = Guid.NewGuid(),
                Name = "Branch1"
            };

            var branches = new List <BranchSimple>()
            {
                branch
            };

            var service     = new Mock <IBranchService>();
            var authService = TestHelper.MockAuthenticationService(Scope.Branch);

            ScopeOptions queryOptions = null;

            service.Setup(c => c.GetBranchesSimple(It.IsAny <ScopeOptions>()))
            .Callback((ScopeOptions options) => queryOptions = options)
            .ReturnsAsync(branches);

            var controller = new BranchesController(service.Object, authService.Object);

            controller.ControllerContext = TestHelper.GetControllerContext(new ClaimsPrincipal());

            var result = await controller.GetBranchesSimple();

            var okResult    = Assert.IsType <OkObjectResult>(result);
            var returnValue = Assert.IsType <List <BranchSimple> >(okResult.Value);

            Assert.Same(branches, returnValue);
        }
Esempio n. 16
0
        private async Task <Result> ImportEmail(ScopeOptions scope, ImportClient data, ClientEdit client)
        {
            var result = new Result(true);

            if (string.IsNullOrEmpty(data.Email))
            {
                return(result);
            }

            //See if email exits
            var email = await _contactService.GetContact(scope, client.Id.Value, data.Email);

            if (email == null)
            {
                var contact = new Contact()
                {
                    ClientId      = client.Id,
                    Value         = data.Email,
                    ContactTypeId = ContactType.CONTACT_TYPE_EMAIL
                };

                result = await _contactService.InsertContact(scope, contact);
            }

            return(result);
        }
Esempio n. 17
0
        public async Task <Result> InsertCommissionSplitRule(ScopeOptions scope, CommissionSplitRule commissionSplitRule)
        {
            var validator = new CommissionSplitRuleValidator(_context, scope, true);
            var result    = validator.Validate(commissionSplitRule).GetResult();

            if (!result.Success)
            {
                return(result);
            }

            if (commissionSplitRule.IsDefault)
            {
                await ClearDefaults(commissionSplitRule.UserId.Value);
            }

            var entity = MapModelToEntity(commissionSplitRule);
            await _context.CommissionSplitRule.AddAsync(entity);

            await _context.SaveChangesAsync();

            commissionSplitRule.Id = entity.Id;
            result.Tag             = commissionSplitRule;

            await _auditService.InsertAuditLog(scope, AuditLog.ACTION_INSERT, "CommissionSplitRule", entity.Id, commissionSplitRule);

            return(result);
        }
Esempio n. 18
0
        public async Task <Result> UpdateClient(ScopeOptions scope, ClientEdit client)
        {
            var validator = new ClientValidator(_context, scope, false);
            var result    = validator.Validate(client, ruleSet: "default,availability").GetResult();

            if (!result.Success)
            {
                return(result);
            }

            var entity = await GetClientEntityQuery(scope).FirstOrDefaultAsync(m => m.Id == client.Id);

            if (entity == null)
            {
                return(new Result());
            }

            var clientEntity = MapModelToEntity(client, entity);

            await _context.SaveChangesAsync();

            await _auditService.InsertAuditLog(scope, AuditLog.ACTION_UPDATE, "Client", entity.Id, client);

            return(result);
        }
Esempio n. 19
0
        public async Task <Result> DeleteCommissionSplitRule(ScopeOptions scope, Guid id)
        {
            var result = new Result();

            var entity = await GetCommissionSplitRuleEntityQuery(scope).FirstOrDefaultAsync(b => b.Id == id);

            if (entity == null)
            {
                return(new Result());
            }

            //Delete dependancies
            var policyRules = await _context.CommissionSplitRulePolicy.Where(r => r.CommissionSplitRuleId == id).ToListAsync();

            foreach (var policyRule in policyRules)
            {
                _context.CommissionSplitRulePolicy.Remove(policyRule);
            }

            _context.CommissionSplitRule.Remove(entity);

            await _context.SaveChangesAsync();

            await _auditService.InsertAuditLog(scope, AuditLog.ACTION_DELETE, "CommissionSplitRule", entity.Id, new { commissionSplitRuleId = id });

            return(new Result(true));
        }
Esempio n. 20
0
        public async Task <Result> UpdateCommissionSplitRule(ScopeOptions scope, CommissionSplitRule commissionSplitRule)
        {
            var validator = new CommissionSplitRuleValidator(_context, scope, false);
            var result    = validator.Validate(commissionSplitRule).GetResult();

            if (!result.Success)
            {
                return(result);
            }

            var entity = await GetCommissionSplitRuleEntityQuery(scope).FirstOrDefaultAsync(c => c.Id == commissionSplitRule.Id);

            if (entity == null)
            {
                return(new Result());
            }

            if (commissionSplitRule.IsDefault)
            {
                await ClearDefaults(commissionSplitRule.UserId.Value);
            }

            var commissionSplitRuleEntity = MapModelToEntity(commissionSplitRule, entity);

            await _context.SaveChangesAsync();

            await _auditService.InsertAuditLog(scope, AuditLog.ACTION_UPDATE, "CommissionSplitRule", entity.Id, commissionSplitRule);

            return(result);
        }
Esempio n. 21
0
        public void MarkEnclosed(ScopeOptions options)
        {
            for (var s = Scope; s != null; s = s.ParentScope)
            {
                // Faster AddUnique
                var span = s.Enclosed.AsReadOnlySpan();
                var def  = Thedef !;
                foreach (var symb in span)
                {
                    if (symb == def)
                    {
                        goto alreadyExists;
                    }
                }
                s.Enclosed.Add(Thedef !);
alreadyExists:
                if (options.KeepFunctionNames)
                {
                    foreach (var keyValuePair in s.Functions !)
                    {
                        Thedef !.Scope.Enclosed.AddUnique(keyValuePair.Value);
                    }
                }

                if (s == Thedef !.Scope)
                {
                    break;
                }
            }
        }
Esempio n. 22
0
        public async Task <Result> UpdateCommissionStatement(ScopeOptions scope, CommissionStatementEdit commissionStatement)
        {
            var validator = new CommissionStatementValidator(_context, scope, false);
            var result    = validator.Validate(commissionStatement).GetResult();

            if (!result.Success)
            {
                return(result);
            }

            var entity = await GetCommissionStatementEntityQuery(scope).FirstOrDefaultAsync(c => c.Id == commissionStatement.Id);

            if (entity == null)
            {
                return(new Result());
            }

            entity = MapModelToEntity(commissionStatement, entity);

            await _context.SaveChangesAsync();

            await _auditService.InsertAuditLog(scope, AuditLog.ACTION_UPDATE, "CommissionStatement", entity.Id, commissionStatement);

            return(result);
        }
Esempio n. 23
0
        public async Task <Result> InsertUser(ScopeOptions scope, UserEdit user, string password, bool emailConfirmed)
        {
            var validator = new UserValidator(_context, scope, true);
            var result    = validator.Validate(user).GetResult();

            if (!result.Success)
            {
                return(result);
            }

            var entity = MapModelToEntity(user);

            entity.EmailConfirmed = emailConfirmed;

            var createResult = await _userManager.CreateAsync(entity, password);

            result.Success = createResult.Succeeded;

            if (!result.Success)
            {
                result.ValidationFailures = createResult.Errors.Select(e => new ValidationFailure("", e.Description)).ToList();
                return(result);
            }

            await UpdateRoles(entity, user.Roles);
            await UpdateIsLocked(entity, user.IsLocked);

            await _auditService.InsertAuditLog(scope, AuditLog.ACTION_INSERT, "User", entity.Id, user);

            user.Id    = entity.Id;
            result.Tag = user;

            return(result);
        }
        public PolicyQueryOptions(ScopeOptions scope, string sortColumn, string sortDirection, int pageSize, int pageNumber, string filters = null)
            : base(sortColumn, sortDirection, pageSize, pageNumber, filters)
        {
            Scope        = scope;
            CompanyId    = new List <Guid>();
            PolicyTypeId = new List <Guid>();
            UserId       = new List <Guid>();

            var result = GetFilterValue <string>("Number");

            if (result.Success)
            {
                Number = result.Value;
            }

            result = GetFilterValue <string>("ClientLastName");
            if (result.Success)
            {
                ClientLastName = result.Value;
            }

            var resultGuid = GetFilterValue <Guid>("ClientId");

            if (resultGuid.Success)
            {
                ClientId = resultGuid.Value;
            }

            resultGuid = GetFilterValue <Guid>("Id");
            if (resultGuid.Success)
            {
                Id = resultGuid.Value;
            }

            var resultGuids = GetFilterValues <Guid>("CompanyId");

            if (resultGuids.Success)
            {
                CompanyId = resultGuids.Value;
            }

            resultGuids = GetFilterValues <Guid>("PolicyTypeId");
            if (resultGuids.Success)
            {
                PolicyTypeId = resultGuids.Value;
            }

            resultGuids = GetFilterValues <Guid>("UserId");
            if (resultGuids.Success)
            {
                UserId = resultGuids.Value;
            }

            var resultBool = GetFilterValue <bool>("IsActive");

            if (resultBool.Success)
            {
                IsActive = resultBool.Value;
            }
        }
Esempio n. 25
0
        public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest request,
            ILogger log)
        {
            Guid organisationId                = Guid.Parse(request.Query["organisationId"]);
            Guid commissionStatementId         = Guid.Parse(request.Query["commissionStatementId"]);
            Guid commissionStatementTemplateId = Guid.Parse(request.Query["commissionStatementTemplateId"]);

            var scope     = new ScopeOptions(organisationId, Guid.Empty, Guid.Empty, Scope.Organisation);
            var statement = await CommissionStatementService.GetCommissionStatement(scope, commissionStatementId);

            if (statement == null)
            {
                return(new NotFoundObjectResult(commissionStatementId));
            }

            var path  = new CommissionStatementPath(scope.OrganisationId, commissionStatementId);
            var files = await FileStorageService.GetFilesAsync(path);

            if (!files.Any())
            {
                return(Utils.GetBadRequestObject("Reimport failed as there are no existing statement files.", commissionStatementId.ToString()));
            }

            var queryOptions = new CommissionStatementTemplateQueryOptions("", "", 0, 0);

            queryOptions.CompanyId.Add(statement.CompanyId.Value);
            queryOptions.Date = statement.Date;

            var templates = (await CommissionStatementTemplateService.GetTemplates(queryOptions)).Items;

            if (!templates.Any(t => t.Id == commissionStatementTemplateId))
            {
                return(Utils.GetBadRequestObject("Reimport failed as the commissionStatementTemplateId is not valid.", commissionStatementTemplateId.ToString()));
            }

            var template = await CommissionStatementTemplateService.GetTemplate(commissionStatementTemplateId);

            await CommissionStatementService.DeleteCommissions(scope, commissionStatementId);

            var result = new ImportResult();

            foreach (var fileInfo in files)
            {
                using (var stream = new MemoryStream())
                {
                    await FileStorageService.GetFile(fileInfo.Url, stream);

                    var vatRate = await DirectoryLookupService.GetVATRate(statement.Date ?? DateTime.Now);

                    var reader = new CommissionImportReader(template.Config, vatRate);
                    var items  = reader.Read(stream);

                    result = await CommissionImportService.ImportCommissions(scope, commissionStatementId, items);
                }
            }

            return(new OkObjectResult(result));
        }
Esempio n. 26
0
        public async Task <Branch> GetBranch(ScopeOptions scope, Guid id)
        {
            var query = from branch in GetBranchQuery(scope)
                        where branch.Id == id
                        select branch;

            return(await query.FirstOrDefaultAsync());
        }
Esempio n. 27
0
        public async Task <CommissionSplitRule> GetCommissionSplitRule(ScopeOptions scope, Guid id)
        {
            var query = from rule in GetCommissionSplitRuleQuery(scope)
                        where rule.Id == id
                        select rule;

            return(await query.FirstOrDefaultAsync());
        }
Esempio n. 28
0
        public async Task <Contact> GetContact(ScopeOptions scope, Guid id)
        {
            var query = from contact in GetContactQuery(scope)
                        where contact.Id == id
                        select contact;

            return(await query.FirstOrDefaultAsync());
        }
Esempio n. 29
0
        public Task <CommissionStatementEdit> GetCommissionStatement(ScopeOptions scope, Guid id)
        {
            var query = from statement in GetCommissionStatementEditQuery(scope)
                        where statement.Id == id
                        select statement;

            return(query.FirstOrDefaultAsync());
        }
Esempio n. 30
0
 public void FigureOutScope(ScopeOptions options = null)
 {
     if (options == null)
     {
         options = new ScopeOptions();
     }
     new ScopeParser(options).FigureOutScope(this);
 }
Esempio n. 31
0
 /// <summary>
 /// Establishes the resource manager context (the scope) within which database operations are performed.
 /// </summary>
 /// <param name="Scope">Scope of the resource manager context.</param>
 public void EstablishContext(ScopeOptions Scope)
 {
     if (_hContext != IntPtr.Zero)
         throw new SCardException("Context already established.  Must call SCard.ReleaseContext() first.");
     IntPtr hContext = IntPtr.Zero;
     int rtn = SCardDll.SCardEstablishContext((UInt32)Scope, IntPtr.Zero, IntPtr.Zero, ref hContext);
     EvalReturnCode(rtn);
     _hContext = hContext;
 }
Esempio n. 32
0
		internal static extern SmartCardErrors EstablishContext(ScopeOptions scope, IntPtr reserved1, IntPtr reserved2, ref IntPtr context);
Esempio n. 33
0
 public object Get(IScope scope, string key, ScopeOptions options) {
     return string.Join(", ", scope.GetKeys().OrderBy(_=>_));
 }