Exemplo n.º 1
0
        public async Task <IEnumerable <RetrievalTracker> > GetRetrievalTracker(string customerCode,
                                                                                DateTime fromDate, DateTime toDate, bool includeSubAccount)
        {
            List <SqlParameter> parms = new List <SqlParameter>
            {
                new SqlParameter {
                    ParameterName = RetreivalTrackerStoredProcedure.StoredProcedureParameters[0].ToString(),
                    Value         = customerCode.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = RetreivalTrackerStoredProcedure.StoredProcedureParameters[1].ToString(),
                    Value         = includeSubAccount.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = RetreivalTrackerStoredProcedure.StoredProcedureParameters[2].ToString(),
                    Value         = fromDate.DateToInt().AsDbValue()
                },
                new SqlParameter {
                    ParameterName = RetreivalTrackerStoredProcedure.StoredProcedureParameters[3].ToString(),
                    Value         = toDate.DateToInt().AsDbValue()
                }
            };

            return(await _tcContext.Set <RetrievalTracker>().FromSqlRaw(RetreivalTrackerStoredProcedure.Sql, parms.ToArray()).ToListAsync());
        }
Exemplo n.º 2
0
        public async Task <IEnumerable <LongOutstanding> > GetLongOutStanding(string customerCode, DateTime asAtDate, bool includeSubAccount)
        {
            List <SqlParameter> parms = new List <SqlParameter>
            {
                new SqlParameter {
                    ParameterName = LongOutStandingStoredProcedure.StoredProcedureParameters[0].ToString(),
                    Value         = customerCode.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = LongOutStandingStoredProcedure.StoredProcedureParameters[1].ToString(),
                    Value         = includeSubAccount.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = LongOutStandingStoredProcedure.StoredProcedureParameters[2].ToString(),
                    Value         = asAtDate.DateToInt().AsDbValue()
                }
            };

            return(await _tcContext.Set <LongOutstanding>().FromSqlRaw(LongOutStandingStoredProcedure.Sql, parms.ToArray()).ToListAsync());
        }
Exemplo n.º 3
0
        private List <SqlParameter> SendResponse(int customerId, string woType,
                                                 DateTime asAtDate, string reportType, bool includeSubAccount, out SqlParameter outParam)
        {
            List <SqlParameter> parms = new List <SqlParameter>
            {
                new SqlParameter {
                    ParameterName = InventoryByCustomerStoredProcedure.StoredProcedureParameters[0].ToString(),
                    Value         = customerId.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = InventoryByCustomerStoredProcedure.StoredProcedureParameters[1].ToString(),
                    Value         = woType.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = InventoryByCustomerStoredProcedure.StoredProcedureParameters[2].ToString(),
                    Value         = asAtDate.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = InventoryByCustomerStoredProcedure.StoredProcedureParameters[3].ToString(),
                    Value         = includeSubAccount.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = InventoryByCustomerStoredProcedure.StoredProcedureParameters[4].ToString(),
                    Value         = reportType.AsDbValue()
                },
            };

            outParam = new SqlParameter
            {
                ParameterName = InventoryByCustomerStoredProcedure.StoredProcedureParameters[5].ToString(),
                SqlDbType     = SqlDbType.Int,
                Direction     = ParameterDirection.Output
            };
            parms.Add(outParam);
            return(parms);
        }
Exemplo n.º 4
0
        public async Task <IEnumerable <ViewTobeDisposedCartonList> > GetToBeDisposedCartonList(string customerCode, bool includeSubAccount)
        {
            List <SqlParameter> parms = new List <SqlParameter>
            {
                new SqlParameter {
                    ParameterName = ToBeDisposedCartonListStoredProcedure.StoredProcedureParameters[0].ToString(), Value = customerCode.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = ToBeDisposedCartonListStoredProcedure.StoredProcedureParameters[1].ToString(), Value = includeSubAccount.AsDbValue()
                }
            };

            return(await _tcContext.Set <ViewTobeDisposedCartonList>().FromSqlRaw(ToBeDisposedCartonListStoredProcedure.Sql, parms.ToArray()).ToListAsync());
        }
Exemplo n.º 5
0
        public async Task <PagedResponse <OperationOverviewByUserLocaion> > GetOperationOverviewByUserLocationAsync(int date, string user, string locationCode,
                                                                                                                    bool isRcLocation, bool isVehicle, string searchText, int pageIndex, int pageSize)
        {
            List <SqlParameter> parms = new List <SqlParameter>
            {
                new SqlParameter {
                    ParameterName = InquiryOperationOverviewByUserLocationStoredProcedure.StoredProcedureParameters[0].ToString(), Value = date.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = InquiryOperationOverviewByUserLocationStoredProcedure.StoredProcedureParameters[1].ToString(), Value = user.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = InquiryOperationOverviewByUserLocationStoredProcedure.StoredProcedureParameters[2].ToString(), Value = locationCode.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = InquiryOperationOverviewByUserLocationStoredProcedure.StoredProcedureParameters[3].ToString(), Value = isRcLocation.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = InquiryOperationOverviewByUserLocationStoredProcedure.StoredProcedureParameters[4].ToString(), Value = isVehicle.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = InquiryOperationOverviewByUserLocationStoredProcedure.StoredProcedureParameters[5].ToString(), Value = searchText.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = InquiryOperationOverviewByUserLocationStoredProcedure.StoredProcedureParameters[6].ToString(), Value = pageIndex.AsDbValue()
                },
                new SqlParameter {
                    ParameterName = InquiryOperationOverviewByUserLocationStoredProcedure.StoredProcedureParameters[7].ToString(), Value = pageSize.AsDbValue()
                },
            };
            var outParam = new SqlParameter {
                ParameterName = InquiryOperationOverviewByUserLocationStoredProcedure.StoredProcedureParameters[8].ToString(), SqlDbType = SqlDbType.Int, Direction = ParameterDirection.Output
            };

            parms.Add(outParam);
            var operationOverviewByUserLocation = await _tcContext.Set <OperationOverviewByUserLocaion>().FromSqlRaw(InquiryOperationOverviewByUserLocationStoredProcedure.Sql, parms.ToArray()).ToListAsync();

            var totalRows = (int)outParam.Value;

            #region paging
            var postResponse = _mapper.Map <List <OperationOverviewByUserLocaion> >(operationOverviewByUserLocation);

            var paginationResponse = new PagedResponse <OperationOverviewByUserLocaion>
            {
                Data       = postResponse,
                pageNumber = pageIndex,
                pageSize   = pageSize,
                totalCount = totalRows,
                totalPages = (int)Math.Ceiling(totalRows / (double)pageSize),
            };
            #endregion
            return(paginationResponse);
        }