Example #1
0
 public async Task <ICollection <Company> > GetAll(int pageNumber, int pageSize) =>
 await _context.Companies
 .Where(CompanyQuery.GetAll())
 .Skip((pageNumber - 1) * pageSize)
 .Take(pageSize)
 .AsNoTracking()
 .ToListAsync();
Example #2
0
 public UnitOfWork(JobDbContext context,
                   Repository <Company> companyRepository,
                   Repository <JobApplicationAnswer> jobApplicationAnswerRepository,
                   Repository <JobApplication> jobApplicationRepository,
                   Repository <JobOfferQuestion> jobOfferQuestionRepository,
                   Repository <JobOffer> jobOfferRepository,
                   Repository <JobSeeker> jobSeekerRepository,
                   Repository <User> userRepository,
                   UserQuery userQuery,
                   JobOfferQuery jobOfferQuery,
                   CompanyQuery companyQuery,
                   JobApplicationQuery jobApplicationQuery)
 {
     this.context      = context;
     CompanyRepository = companyRepository;
     JobApplicationAnswerRepository = jobApplicationAnswerRepository;
     JobApplicationRepository       = jobApplicationRepository;
     JobOfferQuestionRepository     = jobOfferQuestionRepository;
     JobOfferRepository             = jobOfferRepository;
     JobSeekerRepository            = jobSeekerRepository;
     UserRepository      = userRepository;
     UserQuery           = userQuery;
     JobOfferQuery       = jobOfferQuery;
     CompanyQuery        = companyQuery;
     JobApplicationQuery = jobApplicationQuery;
 }
Example #3
0
        public void TestMethod3()
        {
            var svc_userid = Environment.GetEnvironmentVariable("BCREG_SERVICE_ACCT");

            var company = CompanyQuery.ProcessCompanyQuery(svc_userid, "bad_passwd", "https://twmgateway.gov.bc.ca/rest/ltsa/v1/corporations/0410721").Result;

            Assert.IsNull(company);
        }
Example #4
0
 // for tests
 public UnitOfWork(DbContextOptions <JobDbContext> contextOptions)
 {
     context           = new JobDbContext(contextOptions);
     CompanyRepository = new Repository <Company>(context);
     JobApplicationAnswerRepository = new Repository <JobApplicationAnswer>(context);
     JobApplicationRepository       = new Repository <JobApplication>(context);
     JobOfferQuestionRepository     = new Repository <JobOfferQuestion>(context);
     JobOfferRepository             = new Repository <JobOffer>(context);
     JobSeekerRepository            = new Repository <JobSeeker>(context);
     UserRepository      = new Repository <User>(context);
     UserQuery           = new UserQuery(context);
     JobOfferQuery       = new JobOfferQuery(context);
     CompanyQuery        = new CompanyQuery(context);
     JobApplicationQuery = new JobApplicationQuery(context);
 }
Example #5
0
        public int PartialUpdate([FromRoute] string id, [FromBody] JsonMergePatchDocument <Company> patch)
        {
            Guid docId = new Guid(id);

            var ops = new List <string>();

            patch.Operations.ForEach(op =>
            {
                ops.Add(op.path.TrimStart('/'));
            });

            var data = new Company();

            patch.ApplyTo(data);

            var query = new CompanyQuery();

            return(query.PartialUpdate(docId, data, ops));
        }
Example #6
0
        public void TestMethod1()
        {
            var svc_userid = Environment.GetEnvironmentVariable("BCREG_SERVICE_ACCT");
            var svc_passwd = Environment.GetEnvironmentVariable("BCREG_SERVICE_PASSWD");

            var company = CompanyQuery.ProcessCompanyQuery(svc_userid, svc_passwd, "https://twmgateway.gov.bc.ca/rest/ltsa/v1/corporations/0410721").Result;

            Assert.IsNotNull(company);
            Assert.AreEqual(company.name, "A-ZANON'S GARDENING & LANDSCAPING LTD.");
            Assert.AreEqual(company.number, "0410721");
            Assert.AreEqual(company.corporationType, "BC");
            Assert.AreEqual(company.corporationClass, "BC");
            Assert.IsNull(company.bn9);
            Assert.IsNull(company.bn15);
            Assert.AreEqual(company.jurisdiction, "BC");
            Assert.AreEqual(company.stateCode, "LRS");
            Assert.AreEqual(company.stateActive, "true");
            Assert.AreEqual(company.stateDescription, "IN LIM RESTORE");
        }
Example #7
0
 public async Task <int> Count() =>
 await _context.Companies.Where(CompanyQuery.GetAll()).CountAsync();
Example #8
0
 public async Task <int> CountMigration() =>
 await _context.Companies.Where(CompanyQuery.GetAllMigrationsCompany()).CountAsync();
Example #9
0
 public async Task <Company> GetById(Guid id) =>
 await _context.Companies.FirstOrDefaultAsync(CompanyQuery.FindById(id));
Example #10
0
 public async Task <Company> GetCompanyByCnpj(string cnpj) =>
 await _context.Companies.FirstOrDefaultAsync(CompanyQuery.FindByCnpj(cnpj));
Example #11
0
 public async Task <Company> GetCompanyByEmail(string email) =>
 await _context.Companies.FirstOrDefaultAsync(CompanyQuery.FindByEmail(email));
Example #12
0
        public void Insert([FromBody] Company data)
        {
            var cq = new CompanyQuery();

            cq.Insert(data);
        }
Example #13
0
 public async Task <bool> ExistEmail(string email) =>
 await _context.Companies.AsNoTracking().AnyAsync(CompanyQuery.FindByEmail(email));
Example #14
0
 public async Task <bool> ExistCpf(string cpf) =>
 await _context.Companies.AsNoTracking().AnyAsync(CompanyQuery.FindByCpf(cpf));
Example #15
0
 public async Task <bool> ExistCnpj(string cnpj) =>
 await _context.Companies.AsNoTracking().AnyAsync(CompanyQuery.FindByCnpj(cnpj));
Example #16
0
        public int Update([FromBody] Company data)
        {
            var cq = new CompanyQuery();

            return(cq.Update(data));
        }
Example #17
0
        public void InsertList([FromBody] List <Company> data)
        {
            var cq = new CompanyQuery();

            cq.Insert(data);
        }
Example #18
0
        public Company Get([FromRoute] string id)
        {
            var query = new CompanyQuery();

            return(query.GetSingle(new System.Guid(id)));
        }
Example #19
0
 public async Task <Company> GetCompanyByCpf(string cpf) =>
 await _context.Companies.FirstOrDefaultAsync(CompanyQuery.FindByCpf(cpf));
Example #20
0
        public int Remove([FromBody] Company data)
        {
            var cq = new CompanyQuery();

            return(cq.Remove(data));
        }
Example #21
0
        public IEnumerable <Company> Page([FromBody] PageRequest pageDoc)
        {
            var query = new CompanyQuery();

            return(query.GetPage(pageDoc.Page, pageDoc.PageSize, new System.DateTime()));
        }