Example #1
0
        public async Task <long> AllocateSectionListAsync(IEnumerable <AllocationOperation> sections, string company, long?dataVersionId)
        {
            AllocationOperation firstSection = sections.First <AllocationOperation>();
            var queryParameters = new DynamicParameters();

            queryParameters.Add("@CompanyId", company);
            queryParameters.Add("@TransferShipping", firstSection.ShippingType);
            queryParameters.Add("@AllocationSourceType", (int)firstSection.allocationSourceType);
            queryParameters.Add("@AllocationTargetType", (int)firstSection.allocationTargetType);
            queryParameters.Add("@Section", ToArrayTVP(sections));
            queryParameters.Add(DataVersionIdParameter, dataVersionId);

            var result = await ExecuteNonQueryAsync(StoredProcedureNames.AllocateSections, queryParameters, true);

            return(result);
        }
Example #2
0
        public async Task <long> AllocateAsync(AllocationOperation allocationOperation)
        {
            var allocationOperationList = new List <AllocationOperation>();

            allocationOperationList.Add(allocationOperation);
            var queryParameters = new DynamicParameters();

            queryParameters.Add("@CompanyId ", allocationOperation.Company);
            queryParameters.Add(DataVersionIdParameter, allocationOperation.DataVersionId);
            queryParameters.Add("@TransferShipping", (int)allocationOperation.ShippingType);
            queryParameters.Add("@AllocationSourceType", (int)allocationOperation.allocationSourceType);
            queryParameters.Add("@AllocationTargetType", (int)allocationOperation.allocationTargetType);
            queryParameters.Add("@Section", ToArrayTVP(allocationOperationList));
            //queryParameters.Add("@ContractInvoiceTypeId", allocationOperation.ContractInvoiceTypeId);
            var groupNumber = await ExecuteQueryFirstOrDefaultAsync <long>(StoredProcedureNames.AllocateSections, queryParameters, true);

            return(groupNumber);
        }