Example #1
0
 public static SummaryCommuneContactDto ToSummaryCommuneContactDto(this GECommune entity)
 {
     return(entity == null
         ? null
         : new SummaryCommuneContactDto
     {
         StateProvince = entity.GEDistrict?.GEStateProvince.ToDictionaryItemDto(),
         Commune = entity.ToDictionaryItemDto(),
         District = entity.GEDistrict.ToDictionaryItemDto(),
         ReviewCount = entity.ARContactForestCommuneGroups.Count + entity.GEDistrict.ARContactForestCommuneGroups.Count(x => x.FK_GECommuneID == null) + entity.GEDistrict.GEStateProvince.ARContactForestCommuneGroups.Count(x => x.FK_GECommuneID == null && x.FK_GEDistrictID == null),
         NotConfirmStatusCount = entity.ARContactForestCommuneGroups.Count(x => x.ARContact?.ARContactStatus == ContactStatus.ChuaDuyet) + entity.GEDistrict.ARContactForestCommuneGroups.Count(x => x.ARContact?.ARContactStatus == ContactStatus.ChuaDuyet && x.FK_GECommuneID == null) + entity.GEDistrict.GEStateProvince.ARContactForestCommuneGroups.Count(x => x.ARContact?.ARContactStatus == ContactStatus.ChuaDuyet && x.FK_GECommuneID == null && x.FK_GEDistrictID == null),
         PendingStatusCount = entity.ARContactForestCommuneGroups.Count(x => x.ARContact?.ARContactStatus == ContactStatus.DangXacMinh) + entity.GEDistrict.ARContactForestCommuneGroups.Count(x => x.ARContact?.ARContactStatus == ContactStatus.DangXacMinh && x.FK_GECommuneID == null) + entity.GEDistrict.GEStateProvince.ARContactForestCommuneGroups.Count(x => x.ARContact?.ARContactStatus == ContactStatus.DangXacMinh && x.FK_GECommuneID == null && x.FK_GEDistrictID == null)
     });
 }