Ejemplo n.º 1
0
        public void RemoveConclusion()
        {
            ConclusionDto conclusion = SampleEntityDto.CreateConclusion();

            OnTestOfRemove <ConclusionDto, Conclusion>(
                ref conclusion,
                service => service.RemoveConclusion(conclusion));
        }
Ejemplo n.º 2
0
        public void UpdateConclusion()
        {
            ConclusionDto conclusion = SampleEntityDto.CreateConclusion();

            OnTestOfUpdate <ConclusionDto, Conclusion>(
                ref conclusion,
                service => { conclusion.NOTE = "new note!!!!!"; service.UpdateConclusion(conclusion); },
                (dto, entity) => dto.NOTE == entity.Note);
        }
        public IActionResult Conclusion(ConclusionDto model)
        {
            try
            {
                _registrationConclusion.Conclude(model.RegistrationId, model.ExpectedGrade);
            }
            catch (DomainException exception)
            {
                return(new JsonResult(exception.ListOfRules));
            }
            catch (Exception ex)
            {
                return(new JsonResult(ex.Message));
            }

            return(Ok());
        }
        public ConclusionDto GetConclusion(int coinId, DateTime to)
        {
            decimal clientAmount  = 0;
            decimal companyAmount = 0;
            decimal boxBalance    = 0;

            if (to.Date == DateTime.Now.Date && to.Month == DateTime.Now.Month && to.Year == DateTime.Now.Year)
            {
                clientAmount  = _unitOfWork.GenericRepository <ClientCash>().FindBy(c => c.CoinId == coinId).Sum(c => c.Total);
                companyAmount = _unitOfWork.GenericRepository <CompanyCash>().FindBy(c => c.CoinId == coinId).Sum(c => c.Total);
                boxBalance    = _unitOfWork.GenericRepository <BranchCash>().FindBy(c => c.CoinId == coinId).First().Total;
            }
            else
            {
                clientAmount = _unitOfWork.GenericRepository <ClientCashFlow>().FindBy(c => c.CoinId == coinId & c.Created <= to)
                               .GroupBy(c => c.ClientId)
                               .Select(c => c.OrderByDescending(s => s.Id).FirstOrDefault())
                               .Select(c => c.Total).DefaultIfEmpty(0).Sum();
                companyAmount = _unitOfWork.GenericRepository <CompanyCashFlow>().FindBy(c => c.CoinId == coinId)
                                .Where(c => c.Created <= to)
                                .GroupBy(c => c.CompanyId)
                                .Select(c => c.OrderByDescending(s => s.Id).FirstOrDefault())
                                .Select(c => c.Total).DefaultIfEmpty(0).Sum();
                boxBalance = _unitOfWork.GenericRepository <BranchCashFlow>().FindBy(c => c.CoinId == coinId && c.Created <= to)
                             .LastOrDefault() != null?_unitOfWork.GenericRepository <BranchCashFlow>().FindBy(c => c.CoinId == coinId && c.Created <= to)
                             .LastOrDefault().Total : 0;
            }
            var transactionDontDeleivred = _unitOfWork.GenericRepository <Transaction>()
                                           .FindBy(c => c.CoinId == coinId && c.DeliverdDate <= to)
                                           .Select(c => c.Amount).DefaultIfEmpty(0).Sum();
            var actualyBalnce = boxBalance - clientAmount - companyAmount - transactionDontDeleivred;

            var dto = new ConclusionDto
            {
                ClientAmount       = clientAmount * -1,
                CompanyAmount      = companyAmount * -1,
                NotDeliveredAmount = transactionDontDeleivred,
                TreasuryAmount     = boxBalance,
                Total = actualyBalnce
            };

            return(dto);
        }
Ejemplo n.º 5
0
        public void GetConclusion()
        {
            var rn = _nhHelper.Create <Conclusion>(Mapper.Map <Conclusion>(SampleEntityDto.CreateConclusion()), true);

            _helper.CreateCoordinatorOfServices(serviceScope =>
            {
                IPlanReceiptOrderService service = serviceScope.CreatePlanService();
                var filterDto  = new ConclusionDto();
                filterDto.RN   = rn;
                const int skip = 0;
                const int take = 0;
                int total;


                IEnumerable <ConclusionDto> result =
                    service.GetConclusionFilter(filterDto, skip, take, out total);

                Assert.That(result, Is.Not.Null);
            });
        }
 public virtual void RemoveConclusion(ConclusionDto con)
 {
     throw new NotImplementedException();
 }
 public virtual ConclusionDto AddConclusion(ConclusionDto con)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 8
0
 public virtual void UpdateConclusion(ConclusionDto entity)
 {
     this.UpdateEntity <Conclusion, ConclusionDto>(entity);
 }
Ejemplo n.º 9
0
 public virtual void RemoveConclusion(ConclusionDto entity)
 {
     this.RemoveEntity <Conclusion, ConclusionDto>(entity);
 }
Ejemplo n.º 10
0
 public virtual ConclusionDto AddConclusion(ConclusionDto entity)
 {
     return(this.AddEntity <Conclusion, ConclusionDto>(entity));
 }