public KpiDTO GetRedLightViolationKPI() { var res = new KpiDTO { TargetName = "TARGET_PERVIOLATIONTYPE_RED", CurrentValue = GetViolationCountPerYearPerType(DateTime.Now.Year, "RED"), PreviousValue = GetViolationCountPerYearPerType(DateTime.Now.Year - 1, "RED"), LabelValueArabic = "أعداد مخالفات الاشارة الحمراء", LabelValueEnglish = "Red Light Violation", Percentage = GetTargetPercentage("TARGET_PERVIOLATIONTYPE_RED") }; return(res); }
private KpiDTO GetTruckViolationKPI() { var res = new KpiDTO { TargetName = "TARGET_PERVEHICLETYPE_TRUCK", CurrentValue = GetViolationCountPerYearPerVehicleType(DateTime.Now.Year, "Truck"), PreviousValue = GetViolationCountPerYearPerVehicleType(DateTime.Now.Year - 1, "Truck"), LabelValueArabic = "مخالفات الشاحنات", LabelValueEnglish = "Truck Violation", Percentage = GetTargetPercentage("TARGET_PERVEHICLETYPE_TRUCK") }; return(res); }
//public Process_BussinessApplication AddBussinessApplication(KpiDTO kpiDto, Kpi_KpiEvaluation kpiEntity) //{ // //get kpi evaluation // var kpiEvaluation = new Kpi_KpiEvaluation // { // Id = kpiDto.Id, // StatusId = processTransitionDTO.TargetProcessID, // StatusName = _processStatusGRepo.SelectWhere(x => x.Id == processTransitionDTO.TargetProcessID).Select(x => x.Title).FirstOrDefault(), // }; //} public Process_BussinessApplication AddBussinessApplication(KpiDTO kpiDto, Kpi_KpiEvaluation kpiEntity) { // get process transition Process_ProcessTransition processTransitionDTO = _processTransitionGRepo.Get(x => x.SourceProcessID == kpiDto.StatusId && x.ActionID == kpiDto.ActionId); if (processTransitionDTO == null) { return(null); } kpiEntity.StatusId = processTransitionDTO.TargetProcessID; kpiEntity.StatusName = _processStatusGRepo.SelectWhere(x => x.Id == processTransitionDTO.TargetProcessID).Select(x => x.Title).FirstOrDefault(); var properties = new List <Expression <Func <Kpi_KpiEvaluation, object> > > { (x => x.StatusId), (x => x.StatusName), }; this._kpiEvaluationGRepo.UpdateByProperties(kpiEntity, properties); this._uow.SaveChanges(); Process_BussinessApplication business_BussinessApplication = new Process_BussinessApplication { AfterStatus = processTransitionDTO.TargetProcessID, BeforeStatus = processTransitionDTO.SourceProcessID, BusinessTransitionID = kpiEntity.Id, HandleByUserTitleName = "", HandledByOrganization = kpiDto.OrganizationId, HandledByUser = kpiDto.UpdatedByUser, ObjectTypeCode = "Kpi_KpiEvaluation", HandledByUserTitle = 0, HandledDate = DateTime.Now, RegencyTitle = processTransitionDTO.ActionName, ActionID = kpiDto.ActionId + "", Note = kpiEntity.CriterionTypeName, ObjectID = kpiEntity.Id, OrganizationName = kpiDto.Organization }; business_BussinessApplication = _bussinessApplicationGRepo.Add(business_BussinessApplication); this._uow.SaveChanges(); return(business_BussinessApplication); }