コード例 #1
0
        public VarlikResult <List <MainOrderLogAdminDto> > GetAllOrderAdmin([FromUri] MainOrderLogDto dto)
        {
            int limit  = 1000;
            int offset = 0;

            return(_mainOrderLogManager.GetAllOrderAdmin(dto, limit, offset));
        }
コード例 #2
0
        public VarlikResult <List <MainOrderLogDto> > GetAllOrder(long idUser)
        {
            var result = new VarlikResult <List <MainOrderLogDto> >();

            using (var ctx = new VarlikContext())
            {
                var fromEntity = new MainOrderLogDto().FromEntity().Expand();
                result.Data = ctx.MainOrderLog
                              .AsExpandable()
                              .Where(l => l.IdUser == idUser)
                              .Select(fromEntity)
                              .ToList();
                result.Success();
            }
            return(result);
        }
コード例 #3
0
        public VarlikResult <List <MainOrderLogDto> > GetAllWalletOrder(long idUser, string idCoinType)
        {
            var result = new VarlikResult <List <MainOrderLogDto> >();

            using (var ctx = new VarlikContext())
            {
                var fromEntity = new MainOrderLogDto().FromEntity().Expand();
                result.Data = ctx.MainOrderLog
                              .AsExpandable()
                              .Where(l => l.IdUser == idUser &&
                                     (l.IdTransactionType == TransactionTypeEnum.FromWallet ||
                                      l.IdTransactionType == TransactionTypeEnum.ToWallet) &&
                                     l.IdCoinType == idCoinType)
                              .Select(fromEntity)
                              .ToList();
                result.Success();
            }
            return(result);
        }
コード例 #4
0
        public VarlikResult <List <MainOrderLogDto> > GetAllRealCoinOrderAdmin(int limit, int offset)
        {
            var result = new VarlikResult <List <MainOrderLogDto> >();

            using (var ctx = new VarlikContext())
            {
                var fromEntity = new MainOrderLogDto().FromEntityForAdmin().Expand();
                result.Data = ctx.MainOrderLog
                              .AsExpandable()
                              .Where(l => l.IdUser > 1000 &&
                                     (l.IdTransactionType == TransactionTypeEnum.CoinSales || l.IdTransactionType == TransactionTypeEnum.CoinPurchasing) &&
                                     l.IdTransactionState != TransactionStateEnum.Completed)
                              .OrderByDescending(l => l.CreatedAt)
                              .Take(limit)
                              .Skip(offset)
                              .Select(fromEntity)
                              .ToList();
                result.Success();
            }
            return(result);
        }
コード例 #5
0
        public VarlikResult Save(MainOrderLogDto mainOrderLogDto)
        {
            var result = new VarlikResult();

            using (var ctx = new VarlikContext())
            {
                var entity = mainOrderLogDto.ToEntity(mainOrderLogDto);
                ctx.MainOrderLog.Add(entity);
                try
                {
                    ctx.SaveChanges();
                    result.Success();
                    result.ObjectId = entity.Id;
                }
                catch (Exception e)
                {
                    Log.Error("Save", e);
                }
            }
            return(result);
        }
コード例 #6
0
        public VarlikResult <List <MainOrderLogAdminDto> > GetAllOrderAdmin(MainOrderLogDto dto, int limit, int offset)
        {
            if (limit > 1000 || limit == 0)
            {
                limit = 1000;
            }

            var userId = IdentityHelper.Instance.CurrentUserId;

            if (userId > 0 && userId < 501)
            {
                if (string.IsNullOrEmpty(dto?.IdTransactionType))
                {
                    Expression <Func <MainOrderLog, bool> > predicateNull = l => true;
                    return(_mainOrderLogOperation.GetAllOrderAdmin(predicateNull, limit, offset));
                }
                var transactionTypeArr = dto.IdTransactionType.Split(',');
                Expression <Func <MainOrderLog, bool> > predicate = l => transactionTypeArr.Contains(l.IdTransactionType);

                if (!string.IsNullOrEmpty(dto.IdTransactionState))
                {
                    var transactionStateArr = dto.IdTransactionState.Split(',');
                    predicate = predicate.And(l => transactionStateArr.Contains(l.IdTransactionState));
                }

                if (!string.IsNullOrEmpty(dto.IdCoinType))
                {
                    var coinTypeArr = dto.IdCoinType.Split(',');
                    predicate = predicate.And(l => coinTypeArr.Contains(l.IdCoinType));
                }
                return(_mainOrderLogOperation.GetAllOrderAdmin(predicate, limit, offset));
            }
            var result = new VarlikResult <List <MainOrderLogAdminDto> >();

            result.Status = ResultStatus.Unauthorized;
            return(result);
        }
コード例 #7
0
        public VarlikResult <List <MainOrderLogDto> > GetAllMainOrderByIdCoinType(long idUser, string idCoinType)
        {
            var result = new VarlikResult <List <MainOrderLogDto> >();

            using (var ctx = new VarlikContext())
            {
                var fromEntity = new MainOrderLogDto().FromEntity().Expand();
                try
                {
                    result.Data = ctx.MainOrderLog
                                  .AsExpandable()
                                  .Where(l => l.IdUser == idUser && l.IdCoinType == idCoinType &&
                                         (l.IdTransactionType == TransactionTypeEnum.CoinPurchasing ||
                                          l.IdTransactionType == TransactionTypeEnum.CoinSales))
                                  .Select(fromEntity)
                                  .ToList();
                }
                catch (Exception e)
                {
                }
                result.Success();
            }
            return(result);
        }
コード例 #8
0
 public VarlikResult Save(MainOrderLogDto mainOrderLogDto)
 {
     return(_mainOrderLogOperation.Save(mainOrderLogDto));
 }