public async Task UpdateFinancialYear(FinancialYearDto input) { var year = _financialYearRepository.FirstOrDefault(input.Id); year.Name = input.Name; await _financialYearRepository.UpdateAsync(year); }
// 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> >())); }
//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); }
//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); }
//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>()); }
//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>()); }
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); }
// 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>()); }
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); }
// 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); }
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); }
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> >())); }
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> >())); }
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); } }
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> >())); }
//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()); }
//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); } }
//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); } }
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); } }
//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); }
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)); } }
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> >())); }
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); }