Beispiel #1
0
        public async Task UpdateFinancialYear(FinancialYearDto input)
        {
            var year = _financialYearRepository.FirstOrDefault(input.Id);

            year.Name = input.Name;

            await _financialYearRepository.UpdateAsync(year);
        }
Beispiel #2
0
        // Sum of  Bills in a Financial Year by station
        public int GetTotalBillsByStation(StationDto Station, FinancialYearDto FinancialYear)
        {
            var bills = _billRepository.GetAll()
                        .Where(x => x.StationId == Station.Id)
                        .Where(x => x.FinancialYearId == FinancialYear.Id)
                        .Count();

            return(bills);
        }
        public List <HarvestingPlanDto> GetHarvestingPlans(FinancialYearDto FinancialYear)
        {
            var plan = _harvestingPlanRepository
                       .GetAll()
                       .Where(P => P.FinancialYearId == FinancialYear.Id)
                       .ToList();

            return(new List <HarvestingPlanDto>(plan.MapTo <List <HarvestingPlanDto> >()));
        }
Beispiel #4
0
        //get applied volume per station
        public double GetTotalAppliedVolumeByStation(StationDto Station, FinancialYearDto FinancialYear)
        {
            var Volume = _candidateRepository.GetAll()
                         .Where(x => x.StationId == Station.Id)
                         .Where(x => x.FinancialYearId == FinancialYear.Id)
                         .Sum(x => (double?)x.AllocatedCubicMetres) ?? 0.00;

            return(Volume);
        }
Beispiel #5
0
        //tottal selected candidates
        public int GetTotalCandidatesByStationId(StationDto Station, FinancialYearDto FinancialYear)
        {
            var candidates = _candidateRepository.GetAll()
                             .Where(x => x.StationId == Station.Id)
                             .Where(x => x.FinancialYearId == FinancialYear.Id)
                             .Count();

            return(candidates);
        }
Beispiel #6
0
        //submitted application for registrtation for online user
        public DealerDto GetRegApplication(int applicantId, FinancialYearDto FinancialYear)
        {
            var dealer = _dealerRepository.GetAll()
                         .Where(p => p.ApplicantId == applicantId)
                         .Where(p => p.FinancialYearId == FinancialYear.Id)
                         .FirstOrDefault();

            return(dealer.MapTo <DealerDto>());
        }
Beispiel #7
0
        //get registration bill
        public BillDto GetBillForRegistrationByFyr(int applicantId, FinancialYearDto FinancialYear)
        {
            var bill = (from b in _billRepository.GetAll()
                        join dealer in _dealerRepository.GetAll() on b.ApplicantId equals dealer.ApplicantId
                        where dealer.ApplicantId == applicantId
                        where dealer.FinancialYearId == FinancialYear.Id
                        select b).FirstOrDefault();

            return(bill.MapTo <BillDto>());
        }
Beispiel #8
0
        public int GetTotalPendingBillsByStation(StationDto Station, FinancialYearDto FinancialYear)
        {
            var bills = _billRepository.GetAll()
                        .Where(p => p.PaidAmount == 0)
                        .Where(p => p.FinancialYearId == FinancialYear.Id)
                        .Where(p => p.StationId == Station.Id)
                        .Count();

            return(bills);
        }
Beispiel #9
0
        // Sum of Registered Dealers in a Financial Year
        public int GetTotalPendingDealerByStationId(StationDto Station, FinancialYearDto FinancialYear)
        {
            var dealers = _dealerRepository.GetAll()
                          .Where(x => x.StationId == Station.Id)
                          .Where(x => x.FinancialYearId == FinancialYear.Id)
                          .Where(x => x.BillControlNumber == null)
                          .Count();

            return(dealers);
        }
        public HarvestingPlanDto GetHarvestingPlanByStation(FinancialYearDto FinancialYear, int StationId)
        {
            var plan = _harvestingPlanRepository
                       .GetAll()
                       .Where(P => P.FinancialYearId == FinancialYear.Id)
                       .Where(p => p.StationId == StationId)
                       .FirstOrDefault();

            return(plan.MapTo <HarvestingPlanDto>());
        }
Beispiel #11
0
        public int GetTotalMonthPendingBillsByStation(StationDto Station, FinancialYearDto FinancialYear)
        {
            var bills = _billRepository.GetAll()
                        .Where(x => x.StationId == Station.Id)
                        .Where(x => x.FinancialYearId == FinancialYear.Id)
                        .Where(p => p.PaidAmount == 0)
                        .Where(x => x.IssuedDate.Month == DateTime.Today.Month && x.IssuedDate.Year == DateTime.Today.Year)
                        .Count();

            return(bills);
        }
Beispiel #12
0
        // Sum of Registered Dealers in a Month in  Financial Year
        public int GetTotalMonthPendingDealerByStationId(StationDto Station, FinancialYearDto FinancialYear)
        {
            var dealers = _dealerRepository.GetAll()
                          .Where(x => x.StationId == Station.Id)
                          .Where(x => x.FinancialYearId == FinancialYear.Id)
                          .Where(x => x.BillControlNumber == null)
                          .Where(x => x.CreationTime.Month == DateTime.Today.Month && x.CreationTime.Year == DateTime.Today.Year)
                          .Count();

            return(dealers);
        }
Beispiel #13
0
        public List <double> GetTotalPaymentsAmountByStation(StationDto Station, FinancialYearDto FinancialYear)
        {
            var bills = _billRepository.GetAll()
                        .Where(p => p.PaidAmount > 0)
                        .Where(p => p.FinancialYearId == FinancialYear.Id)
                        .Where(p => p.StationId == Station.Id)
                        .Select(p => p.PaidAmount)
                        .ToList();

            return(bills);
        }
Beispiel #14
0
        public List <BillDto> GetPayedBills(FinancialYearDto FinancialYear)
        {
            var bills = _billRepository
                        .GetAll()
                        .Where(p => p.PaidAmount > 0)
                        .Where(p => p.FinancialYearId == FinancialYear.Id)
                        .OrderByDescending(p => p.IssuedDate)
                        .ToList();

            return(new List <BillDto>(bills.MapTo <List <BillDto> >()));
        }
Beispiel #15
0
        public List <CandidateDto> GetCandidates(FinancialYearDto FinancialYear, StationDto Station)
        {
            var candidates = _candidateRepository
                             .GetAll()
                             .OrderBy(p => p.Name)
                             .Where(p => p.FinancialYearId == FinancialYear.Id)
                             .Where(p => p.StationId == Station.Id)
                             .Where(p => p.IsRegistered == false)
                             .ToList();

            return(new List <CandidateDto>(candidates.MapTo <List <CandidateDto> >()));
        }
Beispiel #16
0
        public async Task DeleteFinancialYearAsync(FinancialYearDto input)
        {
            var year = _financialYearRepository.FirstOrDefault(input.Id);

            if (year == null && year.IsActive == true)
            {
                throw new UserFriendlyException("Financial Year Is Active or not Found!");
            }
            else
            {
                await _financialYearRepository.DeleteAsync(year);
            }
        }
Beispiel #17
0
        public List <DealerDto> GetDeniedRegApplicationByStation(StationDto Station, FinancialYearDto FinancialYear)
        {
            var dealers = _dealerRepository
                          .GetAll()
                          .Where(p => p.IsSubmitted == true)
                          .Where(p => p.IsApproved == false)
                          .Where(p => p.IsDenied == true)
                          .Where(p => p.StationId == Station.Id)
                          .Where(p => p.FinancialYearId == FinancialYear.Id)
                          .OrderBy(p => p.CreationTime)
                          .ToList();

            return(new List <DealerDto>(dealers.MapTo <List <DealerDto> >()));
        }
Beispiel #18
0
        //get total fees from dealer registration in a financial year in a current month per station

        public List <double> GetTotalMonthDealerFeesByStation(StationDto Station, FinancialYearDto FinancialYear)
        {
            var fees = from l in _dealerRepository.GetAll()
                       join a in _dealerActivityRepository.GetAll() on l.Id equals a.DealerId
                       join i in _activityRepository.GetAll() on a.ActivityId equals i.Id
                       where l.FinancialYearId == FinancialYear.Id
                       where l.StationId == Station.Id
                       //where l.ReceiptNumber != null
                       where (l.CreationTime.Month == DateTime.Today.Month && l.CreationTime.Year == DateTime.Today.Year)
                       group i by l.StationId into g
                       select g.Sum(x => x.Fee);

            return(fees.ToList());
        }
Beispiel #19
0
        //Is application exists for current financial Year
        public bool IsApplicationExists(int id, FinancialYearDto FinancialYear)
        {
            var dealer = _dealerRepository.GetAll()
                         .Where(p => p.ApplicantId == id)
                         .Where(p => p.FinancialYearId == FinancialYear.Id)
                         .FirstOrDefault();

            if (dealer != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #20
0
        //Is Registered exists for current financial Year

        public bool IsRegistered(int id, FinancialYearDto FinancialYear)  // Add Registration Criteria
        {
            var dealer = _dealerRepository.GetAll()
                         .Where(p => p.ApplicantId == id)
                         .Where(p => p.FinancialYearId == FinancialYear.Id)
                         .Where(p => p.IsApproved == true)
                         .FirstOrDefault();

            if (dealer != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #21
0
 public void UploadCandidates(DataTable table, FinancialYearDto FinancialYear, StationDto Station)
 {
     foreach (DataRow row in table.Rows)
     {
         var candidate = new Candidate
         {
             Name   = row["NAME"].ToString(),
             Adress = row["ADDRESS"].ToString(),
             Phone  = row["PHONE"].ToString(),
             Email  = row["EMAIL"].ToString(),
             AllocatedCubicMetres = Convert.ToDouble(row["ALLOCATED_CUBIC_METRES"].ToString()),
             Species         = row["SPECIES"].ToString(),
             FinancialYearId = FinancialYear.Id,
             StationId       = Station.Id
         };
         _candidateRepository.Insert(candidate);
     }
 }
Beispiel #22
0
        //Activate Financial Year
        public async Task ActivateFinancialYearAsync(FinancialYearDto input)
        {
            var year    = _financialYearRepository.FirstOrDefault(input.Id);
            var current = _financialYearRepository.FirstOrDefault(c => c.IsActive == true);

            if (current != null)
            {
                current.IsActive = false;
                await _financialYearRepository.UpdateAsync(current);

                year.IsActive = true;
            }
            else
            {
                year.IsActive = true;
            }


            await _financialYearRepository.UpdateAsync(year);
        }
Beispiel #23
0
        public List <DealerDto> GetRegisteredDealers(FinancialYearDto FinancialYear)
        {
            var dealers = from l in _dealerRepository.GetAll()
                          join b in _billRepository.GetAll() on l.ApplicantId equals b.ApplicantId
                          where l.FinancialYearId == FinancialYear.Id
                          where b.PaidAmount > 0 && b.PaidDate != null
                          orderby l.SerialNumber
                          select new DealerDto {
                Id                = l.Id,
                ApplicantId       = l.ApplicantId,
                Amount            = b.PaidAmount,
                BillControlNumber = l.BillControlNumber,
                FinancialYearId   = l.FinancialYearId,
                IssuedDate        = l.IssuedDate,
                StationId         = l.StationId,
                SerialNumber      = l.SerialNumber
            };

            return(new List <DealerDto>(dealers.MapTo <List <DealerDto> >()));
        }
        public async Task <ActionResult> Edit(int id, FinancialYearDto input)
        {
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    await _financialYearAppService.UpdateFinancialYear(input);

                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(input));
                }
            }
            catch
            {
                return(View(input));
            }
        }
Beispiel #25
0
        public List <LicenseView> GetLicenses(FinancialYearDto FinancialYear)
        {
            var licenses = (from l in _licenseRepository.GetAll()
                            join bill in _billRepository.GetAll() on l.BillId equals bill.Id
                            //join dealer in _dealerRepository.GetAll() on bill.ApplicantId equals dealer.Id
                            where bill.PaidAmount > 0
                            where bill.PaidDate != null
                            where l.FinancialYearId == FinancialYear.Id

                            orderby l.IssuedDate
                            select new LicenseView {
                Id = l.Id,
                SerialNumber = l.serialNumber,
                // Dealer = dealer.Name,
                Description = bill.Description,
                Amount = bill.PaidAmount,
                IssuedDate = l.IssuedDate
            }).ToList();

            return(new List <LicenseView>(licenses.MapTo <List <LicenseView> >()));
        }
Beispiel #26
0
        public List <double> GetTotalMonthPaymentsAmountByStation(StationDto Station, FinancialYearDto FinancialYear)
        {
            var bills = _billRepository.GetAll()
                        .Where(p => p.PaidAmount > 0)
                        .Where(p => p.FinancialYearId == FinancialYear.Id)
                        .Where(p => p.StationId == Station.Id)
                        .Where(x => x.IssuedDate.Month == DateTime.Today.Month && x.IssuedDate.Year == DateTime.Today.Year)
                        .Select(p => p.PaidAmount)
                        .ToList();

            return(bills);
        }