public void BuildQuery(PagedOrgId parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);

            builder.AddColumns <CostItem>();

            builder.AddConditions <CostItem>(
                i => i.OrganizationId == parameter.OrganizationId && i.IsDeleted == false);

            builder.AddOrderBy <CostItem>(parameter.Sort, parameter.IsDesc);

            builder.AddContains <CostItem>(parameter.SearchTerm);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                organizationId = parameter.OrganizationId,
                offset         = parameter.Offset,
                pageSize       = parameter.PageSize,
                searchTerm     = parameter.SearchTerm
            };
        }
        public void BuildQuery(ListStaff parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            var isWorking = parameter.IsWorking ?? true;

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <BasicStaffPoco>();
            builder.AddConditions <BasicStaffPoco>(
                i => i.OrganizationId == parameter.OrganizationId &&
                i.IsWorking == isWorking &&
                i.IsDeleted == false);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                organizationId = parameter.OrganizationId,
                offset         = parameter.Offset,
                pageSize       = parameter.PageSize,
                isworking      = isWorking,
                isdeleted      = parameter.IsDeleted
            };
        }
Exemple #3
0
        public void BuildQuery(ListSuppliers parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);

            builder.AddColumns <Supplier>();

            parameter.IsActive = parameter.IsActive ?? true;

            builder.AddConditions <Supplier>(
                i => i.OrganizationId == parameter.OrganizationId &&
                i.IsDeleted == false &&
                i.IsActive == parameter.IsActive);

            builder.AddOrderBy <Supplier>(parameter.Sort, parameter.IsDesc);

            builder.AddContains <Supplier>(parameter.SearchTerm);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                organizationId = parameter.OrganizationId,
                offset         = parameter.Offset,
                pageSize       = parameter.PageSize,
                searchTerm     = parameter.SearchTerm,
                isactive       = parameter.IsActive.Value
            };
        }
Exemple #4
0
        public void BuildQuery(CreateJob parameter)
        {
            var builder = _sqlBuilderFactory.Create <CreateSqlBuilder <Job> >();

            builder.Analyze <CreateJob>();
            builder.AddValueParameters(parameter);

            var sql = builder.GetSql();

            Query      = sql;
            Parameters = builder.Parameters;
        }
        public void BuildQuery(CreateCostItem input)
        {
            var builder = _sqlBuilderFactory.Create <CreateSqlBuilder <CostItem> >();

            builder.Analyze <CreateCostItem>();
            builder.AddValueParameters(input);

            var sql = builder.GetSql();

            Query      = sql;
            Parameters = builder.Parameters;
        }
        public void BuildQuery(CreateStaff input)
        {
            var builder = _sqlBuilderFactory.Create <CreateSqlBuilder <Data.Entity.DataEntities.Staff> >();

            builder.Analyze <CreateStaff>();
            builder.AddValueParameters(input);

            var sql = builder.GetSql();

            Query      = sql;
            Parameters = builder.Parameters;
        }
Exemple #7
0
        public void BuildQuery(CreateTaskDefinition parameter)
        {
            var builder = _sqlBuilderFactory.Create <CreateSqlBuilder <TaskDefinition> >();

            builder.Analyze <CreateTaskDefinition>();
            builder.AddValueParameters(parameter);

            var sql = builder.GetSql();

            Query      = sql;
            Parameters = builder.Parameters;
        }
Exemple #8
0
        public void BuildQuery(CreateInvoiceTask input)
        {
            var builder = _sqlBuilderFactory.Create <CreateSqlBuilder <InvoiceTask> >();

            builder.Analyze <CreateInvoiceTask>();
            builder.AddValueParameters(input);

            var sql = builder.GetSql();

            Query      = sql;
            Parameters = builder.Parameters;
        }
        public void BuildQuery(ListOrgEntities parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <PriorityType>();

            var sql = builder.GetSql();

            Query = sql;

            Parameters = null;
        }
Exemple #10
0
        public void BuildQuery(UpdateJobTask input)
        {
            var builder = _sqlBuilderFactory.Create <UpdateSqlBuilder <JobTask> >();

            builder.Analyze(input);
            builder.AddValueParameters(input);

            builder.AddConditions <JobTask>(i => i.Id == input.Id && i.JobId == input.JobId);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = builder.Parameters;
        }
        public void BuildQuery(UpdateTaskDefinition input)
        {
            var builder = _sqlBuilderFactory.Create <UpdateSqlBuilder <TaskDefinition> >();

            builder.Analyze(input);
            builder.AddValueParameters(input);

            builder.AddConditions <TaskDefinition>(i => i.OrganizationId == input.OrganizationId && i.Id == input.Id);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = builder.Parameters;
        }
Exemple #12
0
        public void BuildQuery(UpdateCustomer parameter)
        {
            var builder = _sqlBuilderFactory.Create <UpdateSqlBuilder <Customer> >();

            builder.Analyze(parameter);
            builder.AddValueParameters(parameter);

            builder.AddConditions <Customer>(i => i.OrganizationId == parameter.OrganizationId && i.Id == parameter.Id);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = builder.Parameters;
        }
Exemple #13
0
        public void BuildQuery(UpdateInvoiceCostItem parameter)
        {
            var builder = _sqlBuilderFactory.Create <UpdateSqlBuilder <InvoiceCostItem> >();

            builder.Analyze(parameter);
            builder.AddValueParameters(parameter);

            builder.AddConditions <InvoiceCostItem>(i => i.Id == parameter.Id);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = builder.Parameters;
        }
Exemple #14
0
        public void BuildQuery(UpdateQuoteTask parameter)
        {
            var builder = _sqlBuilderFactory.Create <UpdateSqlBuilder <QuoteTask> >();

            builder.Analyze(parameter);

            builder.AddValueParameters(parameter);

            builder.AddConditions <QuoteTask>(i => i.Id == parameter.Id);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = builder.Parameters;
        }
Exemple #15
0
        public void BuildQuery(UpdateJobTimesheet parameter)
        {
            var builder = _sqlBuilderFactory.Create <UpdateSqlBuilder <Data.Entity.DataEntities.JobTimesheet> >();

            builder.Analyze(parameter);

            builder.AddValueParameters(parameter);

            builder.AddConditions <Data.Entity.DataEntities.JobTimesheet>(i => i.Id == parameter.Id);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = builder.Parameters;
        }
        public void BuildQuery(GetCredential parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <Credential>();
            builder.AddConditions <Credential>(i => i.Email == parameter.Email);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                email = parameter.Email
            };
        }
        public void BuildQuery(ListCredentials parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <ValidCredential>();
            builder.AddConditions <ValidCredential>(i => i.Email == parameter.Email && i.Password == parameter.Password);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                email    = parameter.Email,
                password = parameter.Password
            };
        }
Exemple #18
0
        public void BuildQuery(ListJobTasks parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <JobTaskBasicPoco>();
            builder.AddConditions <JobTaskBasicPoco>(i => i.JobId == parameter.JobId && i.IsDeleted == false);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                organizationId = parameter.OrganizationId,
                jobId          = parameter.JobId
            };
        }
        public void BuildQuery(ListOrgEntities parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <JobStatus>();
            builder.AddConditions <JobStatus>(i =>
                                              i.IsDeleted == false && i.OrganizationId == parameter.OrganizationId);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                organizationid = parameter.OrganizationId
            };
        }
        public void BuildQuery(GetAddress parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <Address>();
            builder.AddConditions <Address>(i => i.OrganizationId == parameter.OrganizationId && i.Id == parameter.Id);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                organizationId = parameter.OrganizationId,
                id             = parameter.Id
            };
        }
        public void BuildQuery(ListInvoiceTasks parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <InvoiceTaskBasicPoco>();
            builder.AddConditions <InvoiceTaskBasicPoco>(i => i.InvoiceId == parameter.InvoiceId);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                organizationId = parameter.OrganizationId,
                offset         = parameter.Offset,
                pageSize       = parameter.PageSize
            };
        }
Exemple #22
0
        public void BuildQuery(GetJob parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <JobWithDetailsPoco>();
            builder.AddJoin <JobWithDetailsPoco>();
            builder.AddConditions <JobWithDetailsPoco>(i => i.OrganizationId == parameter.OrganizationId && i.Id == parameter.JobId);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                organizationId = parameter.OrganizationId,
                jobId          = parameter.JobId
            };
        }
        public void BuildQuery(GetJobTask parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <JobTask>();
            builder.AddConditions <JobTask>(
                i => i.Id == parameter.JobTaskId && i.JobId == parameter.JobId && i.IsDeleted == false);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                jobId     = parameter.JobId,
                jobTaskId = parameter.JobTaskId
            };
        }
Exemple #24
0
        public void BuildQuery(GetInvoiceCostItem parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <InvoiceCostItem>();
            builder.AddConditions <InvoiceCostItem>(i => i.Id == parameter.Id && i.InvoiceId == parameter.InvoiceId);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                id             = parameter.Id,
                quoteid        = parameter.InvoiceId,
                organizationid = parameter.OrganizationId
            };
        }
Exemple #25
0
        public void BuildQuery(GetJobCostItem parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <JobCostItem>();
            builder.AddConditions <JobCostItem>(
                i => i.JobId == parameter.JobId && i.Id == parameter.Id && i.IsDeleted == false && i.OrganizationId == parameter.OrganizationId);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                jobId          = parameter.JobId,
                id             = parameter.Id,
                organizationid = parameter.OrganizationId
            };
        }
Exemple #26
0
        public void BuildQuery(ListCustomers parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);

            builder.AddColumns <Customer>();

            if (parameter.IsProspect.HasValue)
            {
                builder.AddConditions <Customer>(
                    i => i.OrganizationId == parameter.OrganizationId &&
                    i.IsDeleted == false &&
                    i.IsProspect == parameter.IsProspect);
            }
            else
            {
                builder.AddConditions <Customer>(
                    i => i.OrganizationId == parameter.OrganizationId &&
                    i.IsDeleted == false);
            }

            builder.AddOrderBy <Customer>(parameter.Sort, parameter.IsDesc);

            builder.AddContains <Customer>(parameter.SearchTerm);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                organizationId = parameter.OrganizationId,
                offset         = parameter.Offset,
                pageSize       = parameter.PageSize,
                searchTerm     = parameter.SearchTerm,
                isProspect     = parameter.IsProspect
            };
        }
        public void BuildQuery(GetAuthClient parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <OAuthClient>();
            builder.AddConditions <OAuthClient>(
                i => i.ClientId == parameter.ClientId &&
                i.ClientSecret == parameter.ClientSecret &&
                i.IsInternal == parameter.IsInternal);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                clientId     = parameter.ClientId,
                clientSecret = parameter.ClientSecret,
                isInternal   = parameter.IsInternal
            };
        }
Exemple #28
0
        public void BuildQuery(ListCustomerJobs parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <JobWithStatusPoco>();
            builder.AddJoin <JobWithStatusPoco>();
            builder.AddConditions <JobWithStatusPoco>(
                i => i.OrganizationId == parameter.OrganizationId && i.CustomerId == parameter.CustomerId);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                organizationId = parameter.OrganizationId,
                offset         = parameter.Offset,
                pageSize       = parameter.PageSize,
                customerId     = parameter.CustomerId
            };
        }
        public void BuildQuery(PagedJobs parameter)
        {
            var builder = _sqlBuilderFactory.Create <SelectSqlBuilder>();

            builder.AddTemplate(_sqlTemplate);
            builder.AddColumns <JobWithCustomerAndStatusPoco>();
            builder.AddJoin <JobWithCustomerAndStatusPoco>();
            builder.AddConditions <JobWithCustomerAndStatusPoco>(i => i.OrganizationId == parameter.OrganizationId);
            builder.AddOrderBy <JobWithCustomerAndStatusPoco>(parameter.Sort, parameter.IsDesc);
            builder.AddContains <JobWithCustomerAndStatusPoco>(parameter.SearchTerm);

            var sql = builder.GetSql();

            Query = sql;

            Parameters = new
            {
                organizationId = parameter.OrganizationId,
                offset         = parameter.Offset,
                pageSize       = parameter.PageSize,
                searchTerm     = parameter.SearchTerm
            };
        }