protected static FR_L5LI_GCLIFRP_0936 Execute(DbConnection Connection, DbTransaction Transaction, P_L5LI_GCLIFRP_0936 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5LI_GCLIFRP_0936(); returnValue.Result = new L5LI_GCLIFRP_0936(); ORM_RES_RealestateProperty orm_realestate = new ORM_RES_RealestateProperty(); orm_realestate.Load(Connection, Transaction, Parameter.RealestatePropertyID); ORM_CMN_LOC_Location orm_location = new ORM_CMN_LOC_Location(); orm_location.Load(Connection, Transaction, orm_realestate.RealestateProperty_Location_RefID); returnValue.Result.CMN_LOC_LocationID = orm_location.CMN_LOC_LocationID; ORM_CMN_Address orm_address = new ORM_CMN_Address(); orm_address.Load(Connection, Transaction, orm_location.Address_RefID); L5LI_GCLIFRP_0936_Address address = new L5LI_GCLIFRP_0936_Address(); address.CMN_AddressID = orm_address.CMN_AddressID; address.Street_Name = orm_address.Street_Name; address.Street_Number = orm_address.Street_Number; address.City_PostalCode = orm_address.City_PostalCode; address.City_Name = orm_address.City_Name; address.City_Region = orm_address.City_Region; address.City_AdministrativeDistrict = orm_address.City_AdministrativeDistrict; address.Province_Name = orm_address.Province_Name; returnValue.Result.Address = address; ORM_CMN_LOC_Region orm_region = new ORM_CMN_LOC_Region(); orm_region.Load(Connection, Transaction, orm_location.Region_RefID); L5LI_GCLIFRP_0936_Region region = new L5LI_GCLIFRP_0936_Region(); region.CMN_LOC_RegionID = orm_region.CMN_LOC_RegionID; region.Country_RefID = orm_region.Country_RefID; returnValue.Result.Region = region; ORM_RES_LOC_LocationInformation.Query locationInfoQuery = new ORM_RES_LOC_LocationInformation.Query(); locationInfoQuery.CMN_LOC_Location_RefID = orm_location.CMN_LOC_LocationID; locationInfoQuery.Tenant_RefID = securityTicket.TenantID; locationInfoQuery.IsDeleted = false; ORM_RES_LOC_LocationInformation locationInfoFromQuery = ORM_RES_LOC_LocationInformation.Query.Search(Connection, Transaction, locationInfoQuery).FirstOrDefault(); L5LI_GCLIFRP_0936_LocationInformation locationInfo = new L5LI_GCLIFRP_0936_LocationInformation(); locationInfo.RES_LOC_LocationInformationID = locationInfoFromQuery.RES_LOC_LocationInformationID; locationInfo.MapImage = locationInfoFromQuery.LocationInformation_MapImage_DocID; locationInfo.SateliteImage = locationInfoFromQuery.LocationInformation_SatelliteImage_DocID; locationInfo.AddressImage = locationInfoFromQuery.LocationInformation_AddressImage_DocID; returnValue.Result.LocationInformation = locationInfo; ORM_RES_LOC_RegionInformation.Query regionInfoQuery = new ORM_RES_LOC_RegionInformation.Query(); regionInfoQuery.CMN_LOC_Region_RefID = orm_region.CMN_LOC_RegionID; regionInfoQuery.Tenant_RefID = securityTicket.TenantID; regionInfoQuery.IsDeleted = false; List <ORM_RES_LOC_RegionInformation> regionInfos = ORM_RES_LOC_RegionInformation.Query.Search(Connection, Transaction, regionInfoQuery); L5LI_GCLIFRP_0936_RegionInformation regionInfo = new L5LI_GCLIFRP_0936_RegionInformation(); regionInfo.RegionInformation_RegionArea_in_sqkm = regionInfos[0].RegionInformation_RegionArea_in_sqkm; regionInfo.RegionInformation_TotalPopulation = regionInfos[0].RegionInformation_TotalPopulation; regionInfo.RegionInformation_Population_per_sqkm = regionInfos[0].RegionInformation_Population_per_sqkm; regionInfo.RegionInformation_RegionUnemploymentRatePercent = regionInfos[0].RegionInformation_RegionUnemploymentRatePercent; regionInfo.RegionInformation_NumberOfHouseholds_Current = regionInfos[0].RegionInformation_NumberOfHouseholds_Current; regionInfo.RegionInformation_NumberOfHouseholds_Forecast = regionInfos[0].RegionInformation_NumberOfHouseholds_Forecast; regionInfo.RegionInformation_PurchasingPowerAmount_Current_RefID = regionInfos[0].RegionInformation_PurchasingPowerAmount_Current_RefID; regionInfo.RegionInformation_PurchasingPowerAmount_Forecast_RefID = regionInfos[0].RegionInformation_PurchasingPowerAmount_Forecast_RefID; regionInfo.RegionInformation_ResidentialRent_MinPrice_RefID = regionInfos[0].RegionInformation_ResidentialRent_MinPrice_RefID; regionInfo.RegionInformation_ResidentialRent_AveragePrice_RefID = regionInfos[0].RegionInformation_ResidentialRent_AveragePrice_RefID; regionInfo.RegionInformation_ResidentialRent_MaxPrice_RefID = regionInfos[0].RegionInformation_ResidentialRent_MaxPrice_RefID; regionInfo.RegionInformation_NonResidentialRent_MinPrice_RefID = regionInfos[0].RegionInformation_NonResidentialRent_MinPrice_RefID; regionInfo.RegionInformation_NonResidentialRent_AveragePrice_RefID = regionInfos[0].RegionInformation_NonResidentialRent_AveragePrice_RefID; regionInfo.RegionInformation_NonResidentialRent_MaxPrice_RefID = regionInfos[0].RegionInformation_NonResidentialRent_MaxPrice_RefID; returnValue.Result.RegionInformation = regionInfo; P_L2PR_GPVFP_0932 priceParam = new P_L2PR_GPVFP_0932(); priceParam.PriceID = regionInfos[0].RegionInformation_NonResidentialRent_AveragePrice_RefID; returnValue.Result.RegionInformation_NonResidentialRent_AveragePrice_Amount = cls_Get_PriceValue_For_PriceID.Invoke(Connection, Transaction, priceParam, securityTicket).Result.PriceValue_Amount; priceParam.PriceID = regionInfos[0].RegionInformation_NonResidentialRent_MaxPrice_RefID; returnValue.Result.RegionInformation_NonResidentialRent_MaxPrice_Amount = cls_Get_PriceValue_For_PriceID.Invoke(Connection, Transaction, priceParam, securityTicket).Result.PriceValue_Amount; priceParam.PriceID = regionInfos[0].RegionInformation_NonResidentialRent_MinPrice_RefID; returnValue.Result.RegionInformation_NonResidentialRent_MinPrice_Amount = cls_Get_PriceValue_For_PriceID.Invoke(Connection, Transaction, priceParam, securityTicket).Result.PriceValue_Amount; priceParam.PriceID = regionInfos[0].RegionInformation_PurchasingPowerAmount_Current_RefID; returnValue.Result.RegionInformation_PurchasingPowerAmount_Current_Amount = cls_Get_PriceValue_For_PriceID.Invoke(Connection, Transaction, priceParam, securityTicket).Result.PriceValue_Amount; priceParam.PriceID = regionInfos[0].RegionInformation_PurchasingPowerAmount_Forecast_RefID; returnValue.Result.RegionInformation_PurchasingPowerAmount_Forecast_Amount = cls_Get_PriceValue_For_PriceID.Invoke(Connection, Transaction, priceParam, securityTicket).Result.PriceValue_Amount; priceParam.PriceID = regionInfos[0].RegionInformation_ResidentialRent_AveragePrice_RefID; returnValue.Result.RegionInformation_ResidentialRent_AveragePrice_Amount = cls_Get_PriceValue_For_PriceID.Invoke(Connection, Transaction, priceParam, securityTicket).Result.PriceValue_Amount; priceParam.PriceID = regionInfos[0].RegionInformation_ResidentialRent_MaxPrice_RefID; returnValue.Result.RegionInformation_ResidentialRent_MaxPrice_Amount = cls_Get_PriceValue_For_PriceID.Invoke(Connection, Transaction, priceParam, securityTicket).Result.PriceValue_Amount; priceParam.PriceID = regionInfos[0].RegionInformation_ResidentialRent_MinPrice_RefID; returnValue.Result.RegionInformation_ResidentialRent_MinPrice_Amount = cls_Get_PriceValue_For_PriceID.Invoke(Connection, Transaction, priceParam, securityTicket).Result.PriceValue_Amount; //result.Means_of_Transportation ORM_RES_LOC_LocationInformation_2_MeansOfTransportation.Query locationInfo_2_mot_Query = new ORM_RES_LOC_LocationInformation_2_MeansOfTransportation.Query(); locationInfo_2_mot_Query.RES_LOC_LocationInformation_RefID = locationInfoFromQuery.RES_LOC_LocationInformationID; locationInfo_2_mot_Query.Tenant_RefID = securityTicket.TenantID; locationInfo_2_mot_Query.IsDeleted = false; List <ORM_RES_LOC_LocationInformation_2_MeansOfTransportation> locationInfo_2_mots = ORM_RES_LOC_LocationInformation_2_MeansOfTransportation.Query.Search(Connection, Transaction, locationInfo_2_mot_Query); List <L5LI_GCLIFRP_0936_MeansOfTransportation> MeansOfTransportation_List = new List <L5LI_GCLIFRP_0936_MeansOfTransportation>(); L5LI_GCLIFRP_0936_MeansOfTransportation MeansOfTransportation; if (locationInfo_2_mots.Count > 0) { ORM_RES_LOC_MeansOfTransportation.Query motQuery; foreach (var locationInfi_2_mot in locationInfo_2_mots) { motQuery = new ORM_RES_LOC_MeansOfTransportation.Query(); motQuery.RES_LOC_MeansOfTransportationID = locationInfi_2_mot.RES_LOC_MeansOfTransportation_RefID; motQuery.Tenant_RefID = securityTicket.TenantID; motQuery.IsDeleted = false; List <ORM_RES_LOC_MeansOfTransportation> mots = ORM_RES_LOC_MeansOfTransportation.Query.Search(Connection, Transaction, motQuery); MeansOfTransportation = new L5LI_GCLIFRP_0936_MeansOfTransportation(); MeansOfTransportation.MeansOfTransportation_ID = mots[0].RES_LOC_MeansOfTransportationID; MeansOfTransportation.MeansOfTransportation_Name = mots[0].Transportation_Name; MeansOfTransportation_List.Add(MeansOfTransportation); } } returnValue.Result.MeansOfTransportation = MeansOfTransportation_List.ToArray(); //result.Emmissions ORM_RES_LOC_LocationInformation_2_Emmission.Query emmissions_Query = new ORM_RES_LOC_LocationInformation_2_Emmission.Query(); emmissions_Query.RES_LOC_LocationInformation_RefID = locationInfoFromQuery.RES_LOC_LocationInformationID; emmissions_Query.Tenant_RefID = securityTicket.TenantID; emmissions_Query.IsDeleted = false; List <ORM_RES_LOC_LocationInformation_2_Emmission> emmissions = ORM_RES_LOC_LocationInformation_2_Emmission.Query.Search(Connection, Transaction, emmissions_Query); List <L5LI_GCLIFRP_0936_Emmissions> Emmissions_List = new List <L5LI_GCLIFRP_0936_Emmissions>(); L5LI_GCLIFRP_0936_Emmissions Emmission; if (emmissions.Count > 0) { ORM_RES_LOC_Emmission.Query emmissionQuery; foreach (var emmission in emmissions) { emmissionQuery = new ORM_RES_LOC_Emmission.Query(); emmissionQuery.RES_LOC_EmmissionID = emmission.RES_LOC_Emmission_RefID; emmissionQuery.Tenant_RefID = securityTicket.TenantID; emmissionQuery.IsDeleted = false; List <ORM_RES_LOC_Emmission> orm_emmissions = ORM_RES_LOC_Emmission.Query.Search(Connection, Transaction, emmissionQuery); Emmission = new L5LI_GCLIFRP_0936_Emmissions(); Emmission.Emmissions_ID = orm_emmissions[0].RES_LOC_EmmissionID; Emmission.Emmissions_Name = orm_emmissions[0].Emmission_Name; Emmissions_List.Add(Emmission); } } returnValue.Result.Emmissions = Emmissions_List.ToArray(); //result.SurroundingInfrastructures ORM_RES_LOC_LocationInformation_2_SurroundingInfrastructure.Query SurroundingInfrastructures_Query = new ORM_RES_LOC_LocationInformation_2_SurroundingInfrastructure.Query(); SurroundingInfrastructures_Query.RES_LOC_LocationInformation_RefID = locationInfoFromQuery.RES_LOC_LocationInformationID; SurroundingInfrastructures_Query.Tenant_RefID = securityTicket.TenantID; SurroundingInfrastructures_Query.IsDeleted = false; List <ORM_RES_LOC_LocationInformation_2_SurroundingInfrastructure> SurroundingInfrastructures = ORM_RES_LOC_LocationInformation_2_SurroundingInfrastructure.Query.Search(Connection, Transaction, SurroundingInfrastructures_Query); List <L5LI_GCLIFRP_0936_SurroundingInfrastructures> SurroundingInfrastructures_List = new List <L5LI_GCLIFRP_0936_SurroundingInfrastructures>(); L5LI_GCLIFRP_0936_SurroundingInfrastructures SurroundingInfrastructure; if (SurroundingInfrastructures.Count > 0) { ORM_RES_LOC_SurroundingInfrastructure.Query SurroundingInfrastructure_Query; foreach (var infrastructure in SurroundingInfrastructures) { SurroundingInfrastructure_Query = new ORM_RES_LOC_SurroundingInfrastructure.Query(); SurroundingInfrastructure_Query.RES_LOC_SurroundingInfrastructureID = infrastructure.RES_LOC_SurroundingInfrastructure_RefID; SurroundingInfrastructure_Query.Tenant_RefID = securityTicket.TenantID; SurroundingInfrastructure_Query.IsDeleted = false; List <ORM_RES_LOC_SurroundingInfrastructure> orm_SurroundingInfrastructure = ORM_RES_LOC_SurroundingInfrastructure.Query.Search(Connection, Transaction, SurroundingInfrastructure_Query); SurroundingInfrastructure = new L5LI_GCLIFRP_0936_SurroundingInfrastructures(); SurroundingInfrastructure.SurroundingInfrastructures_ID = orm_SurroundingInfrastructure[0].RES_LOC_SurroundingInfrastructureID; SurroundingInfrastructure.SurroundingInfrastructures_Name = orm_SurroundingInfrastructure[0].SurroundingInfrastructure_Name; SurroundingInfrastructures_List.Add(SurroundingInfrastructure); } } returnValue.Result.SurroundingInfrastructures = SurroundingInfrastructures_List.ToArray(); //result.Neighborhood ORM_RES_LOC_LocationInformation_2_NeighborhoodQuality.Query neighborhoodQuality_Query = new ORM_RES_LOC_LocationInformation_2_NeighborhoodQuality.Query(); neighborhoodQuality_Query.RES_LOC_LocationInformation_RefID = locationInfoFromQuery.RES_LOC_LocationInformationID; neighborhoodQuality_Query.Tenant_RefID = securityTicket.TenantID; neighborhoodQuality_Query.IsDeleted = false; List <ORM_RES_LOC_LocationInformation_2_NeighborhoodQuality> neighborhoodQualities = ORM_RES_LOC_LocationInformation_2_NeighborhoodQuality.Query.Search(Connection, Transaction, neighborhoodQuality_Query); List <L5LI_GCLIFRP_0936_NeighborhoodQualities> NeighborhoodQualities_List = new List <L5LI_GCLIFRP_0936_NeighborhoodQualities>(); L5LI_GCLIFRP_0936_NeighborhoodQualities NeighborhoodQuality; if (neighborhoodQualities.Count > 0) { ORM_RES_LOC_NeighborhoodQuality.Query NeighborhoodQuality_Query; foreach (var quality in neighborhoodQualities) { NeighborhoodQuality_Query = new ORM_RES_LOC_NeighborhoodQuality.Query(); NeighborhoodQuality_Query.RES_LOC_NeighborhoodQualityID = quality.RES_LOC_NeighborhoodQuality_RefID; NeighborhoodQuality_Query.Tenant_RefID = securityTicket.TenantID; NeighborhoodQuality_Query.IsDeleted = false; List <ORM_RES_LOC_NeighborhoodQuality> orm_neighborhoodQualities = ORM_RES_LOC_NeighborhoodQuality.Query.Search(Connection, Transaction, NeighborhoodQuality_Query); NeighborhoodQuality = new L5LI_GCLIFRP_0936_NeighborhoodQualities(); NeighborhoodQuality.NeighborhoodQualities_ID = orm_neighborhoodQualities[0].RES_LOC_NeighborhoodQualityID; NeighborhoodQuality.NeighborhoodQualities_Name = orm_neighborhoodQualities[0].NeighborhoodQuality_Name; NeighborhoodQualities_List.Add(NeighborhoodQuality); } } returnValue.Result.NeighborhoodQualities = NeighborhoodQualities_List.ToArray(); //result.ParkingSituation ORM_RES_LOC_LocationInfo_2_ParkingSituation.Query parkingSituation_Query = new ORM_RES_LOC_LocationInfo_2_ParkingSituation.Query(); parkingSituation_Query.RES_LOC_LocationInfo_RefID = locationInfoFromQuery.RES_LOC_LocationInformationID; parkingSituation_Query.Tenant_RefID = securityTicket.TenantID; parkingSituation_Query.IsDeleted = false; List <ORM_RES_LOC_LocationInfo_2_ParkingSituation> parkingSituations = ORM_RES_LOC_LocationInfo_2_ParkingSituation.Query.Search(Connection, Transaction, parkingSituation_Query); List <L5LI_GCLIFRP_0936_ParkingSituations> ParkingSituations_List = new List <L5LI_GCLIFRP_0936_ParkingSituations>(); L5LI_GCLIFRP_0936_ParkingSituations ParkingSituation; if (parkingSituations.Count > 0) { ORM_RES_LOC_ParkingSituation.Query ParkingSituation_Query; foreach (var situtaion in parkingSituations) { ParkingSituation_Query = new ORM_RES_LOC_ParkingSituation.Query(); ParkingSituation_Query.RES_LOC_ParkingSituationID = situtaion.RES_LOC_ParkingSituation_RefID; ParkingSituation_Query.Tenant_RefID = securityTicket.TenantID; ParkingSituation_Query.IsDeleted = false; List <ORM_RES_LOC_ParkingSituation> orm_parkingSituations = ORM_RES_LOC_ParkingSituation.Query.Search(Connection, Transaction, ParkingSituation_Query); ParkingSituation = new L5LI_GCLIFRP_0936_ParkingSituations(); ParkingSituation.ParkingSituations_ID = orm_parkingSituations[0].RES_LOC_ParkingSituationID; ParkingSituation.ParkingSituations_Name = orm_parkingSituations[0].ParkingSituation_Name; ParkingSituations_List.Add(ParkingSituation); } } returnValue.Result.ParkingSituations = ParkingSituations_List.ToArray(); //result.ResidentialVacancies ORM_RES_LOC_LocationInfo_2_ResidentialVacancy.Query residentialVacancy_Query = new ORM_RES_LOC_LocationInfo_2_ResidentialVacancy.Query(); residentialVacancy_Query.RES_LOC_LocationInfo_RefID = locationInfoFromQuery.RES_LOC_LocationInformationID; residentialVacancy_Query.Tenant_RefID = securityTicket.TenantID; residentialVacancy_Query.IsDeleted = false; List <ORM_RES_LOC_LocationInfo_2_ResidentialVacancy> residentalVacancies = ORM_RES_LOC_LocationInfo_2_ResidentialVacancy.Query.Search(Connection, Transaction, residentialVacancy_Query); List <L5LI_GCLIFRP_0936_ResidentialVacancies> ResidentialVacancies_List = new List <L5LI_GCLIFRP_0936_ResidentialVacancies>(); L5LI_GCLIFRP_0936_ResidentialVacancies ResidentialVacancy; if (residentalVacancies.Count > 0) { ORM_RES_LOC_ResidentialVacancy.Query ResidentialVacancy_Query; foreach (var vacancy in residentalVacancies) { ResidentialVacancy_Query = new ORM_RES_LOC_ResidentialVacancy.Query(); ResidentialVacancy_Query.RES_LOC_ResidentialVacancyID = vacancy.RES_LOC_ResidentialVacancy_RefID; ResidentialVacancy_Query.Tenant_RefID = securityTicket.TenantID; ResidentialVacancy_Query.IsDeleted = false; List <ORM_RES_LOC_ResidentialVacancy> orm_residentalVacancies = ORM_RES_LOC_ResidentialVacancy.Query.Search(Connection, Transaction, ResidentialVacancy_Query); ResidentialVacancy = new L5LI_GCLIFRP_0936_ResidentialVacancies(); ResidentialVacancy.ResidentialVacancies_ID = orm_residentalVacancies[0].RES_LOC_ResidentialVacancyID; ResidentialVacancy.ResidentialVacancies_Name = orm_residentalVacancies[0].ResidentialVacancy_Name; ResidentialVacancies_List.Add(ResidentialVacancy); } } returnValue.Result.ResidentialVacancies = ResidentialVacancies_List.ToArray(); //return.CommercialVacancies ORM_RES_LOC_LocationInfo_2_CommercialVacancy.Query commercialVacancies_Query = new ORM_RES_LOC_LocationInfo_2_CommercialVacancy.Query(); commercialVacancies_Query.RES_LOC_LocationInfo_RefID = locationInfoFromQuery.RES_LOC_LocationInformationID; commercialVacancies_Query.Tenant_RefID = securityTicket.TenantID; commercialVacancies_Query.IsDeleted = false; List <ORM_RES_LOC_LocationInfo_2_CommercialVacancy> commaericalVacancies = ORM_RES_LOC_LocationInfo_2_CommercialVacancy.Query.Search(Connection, Transaction, commercialVacancies_Query); List <L5LI_GCLIFRP_0936_CommercialVacancies> CommercialVacancies_List = new List <L5LI_GCLIFRP_0936_CommercialVacancies>(); L5LI_GCLIFRP_0936_CommercialVacancies CommercialVacancy; if (commaericalVacancies.Count > 0) { ORM_RES_LOC_CommercialVacancy.Query CommercialVacancies_Query; foreach (var vacancy in commaericalVacancies) { CommercialVacancies_Query = new ORM_RES_LOC_CommercialVacancy.Query(); CommercialVacancies_Query.RES_LOC_CommercialVacancyID = vacancy.RES_LOC_CommercialVacancy_RefID; CommercialVacancies_Query.Tenant_RefID = securityTicket.TenantID; CommercialVacancies_Query.IsDeleted = false; List <ORM_RES_LOC_CommercialVacancy> orm_commercialVacancies = ORM_RES_LOC_CommercialVacancy.Query.Search(Connection, Transaction, CommercialVacancies_Query); CommercialVacancy = new L5LI_GCLIFRP_0936_CommercialVacancies(); CommercialVacancy.CommercialVacancies_ID = orm_commercialVacancies[0].RES_LOC_CommercialVacancyID; CommercialVacancy.CommercialVacancies_Name = orm_commercialVacancies[0].CommercialVacancy_Name; CommercialVacancies_List.Add(CommercialVacancy); } } returnValue.Result.CommercialVacancies = CommercialVacancies_List.ToArray(); //Put your code here return(returnValue); #endregion UserCode }
protected static FR_L5DD_GRGFRP_1403_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5DD_GRGFRP_1403 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_L5DD_GRGFRP_1403_Array(); var retVal = new List <L5DD_GRGFRP_1403>(); L5DD_GRGFRP_1403 revisionGroupItem; //Put your code here #region Realestate ORM_RES_RealestateProperty realestateProperty = new ORM_RES_RealestateProperty(); if (Parameter.RealestatePropertyID != Guid.Empty) { var realestatePropertyResult = realestateProperty.Load(Connection, Transaction, Parameter.RealestatePropertyID); if (realestatePropertyResult.Status != FR_Status.Success || realestateProperty.RES_RealestatePropertyID == Guid.Empty) { return(null); } } #endregion #region Address ORM_CMN_Address address = new ORM_CMN_Address(); ORM_CMN_LOC_Location location = new ORM_CMN_LOC_Location(); var locationResult = location.Load(Connection, Transaction, realestateProperty.RealestateProperty_Location_RefID); if (locationResult.Status == FR_Status.Success && location.CMN_LOC_LocationID != Guid.Empty) { var addressResult = address.Load(Connection, Transaction, location.Address_RefID); if (locationResult.Status != FR_Status.Success || location.CMN_LOC_LocationID == Guid.Empty) { address = null; } } #endregion #region Revision groups for realestrate ORM_RES_DUD_RevisionGroup.Query revisionGroupQuery = new ORM_RES_DUD_RevisionGroup.Query(); revisionGroupQuery.Tenant_RefID = securityTicket.TenantID; revisionGroupQuery.IsDeleted = false; revisionGroupQuery.RealestateProperty_RefID = realestateProperty.RES_RealestatePropertyID; List <ORM_RES_DUD_RevisionGroup> revisionGroupList = ORM_RES_DUD_RevisionGroup.Query.Search(Connection, Transaction, revisionGroupQuery); #endregion #region Buildings for realestate ORM_RES_BLD_Building_RevisionHeader.Query revisionHeaderQuery = new ORM_RES_BLD_Building_RevisionHeader.Query(); revisionHeaderQuery.Tenant_RefID = securityTicket.TenantID; revisionHeaderQuery.IsDeleted = false; revisionHeaderQuery.RealestateProperty_RefID = realestateProperty.RES_RealestatePropertyID; ORM_RES_BLD_Building_RevisionHeader revisionHeader = ORM_RES_BLD_Building_RevisionHeader.Query.Search(Connection, Transaction, revisionHeaderQuery).FirstOrDefault(); List <ORM_RES_BLD_Building> buildings = new List <ORM_RES_BLD_Building>(); List <ORM_RES_DUD_Revision> revisions = new List <ORM_RES_DUD_Revision>(); List <ORM_RES_BLD_Building_2_BuildingType> buildingTypes = new List <ORM_RES_BLD_Building_2_BuildingType>(); List <ORM_RES_BLD_Building_2_GarbageContainerType> buildingGarbageContainerType = new List <ORM_RES_BLD_Building_2_GarbageContainerType>(); if (revisionHeader != null) { ORM_RES_BLD_Building.Query buildingQuery = new ORM_RES_BLD_Building.Query(); buildingQuery.Tenant_RefID = securityTicket.TenantID; buildingQuery.IsDeleted = false; buildingQuery.BuildingRevisionHeader_RefID = revisionHeader.RES_BLD_Building_RevisionHeaderID; buildings = ORM_RES_BLD_Building.Query.Search(Connection, Transaction, buildingQuery); if (buildings == null) { buildings = new List <ORM_RES_BLD_Building>(); } #region revisions and building types for every building foreach (var buildingItem in buildings) { ORM_RES_DUD_Revision.Query revisionQuery = new ORM_RES_DUD_Revision.Query(); revisionQuery.Tenant_RefID = securityTicket.TenantID; revisionQuery.IsDeleted = false; revisionQuery.RES_BLD_Building_RefID = buildingItem.RES_BLD_BuildingID; revisions.AddRange(ORM_RES_DUD_Revision.Query.Search(Connection, Transaction, revisionQuery)); ORM_RES_BLD_Building_2_BuildingType.Query buildingTypeQuery = new ORM_RES_BLD_Building_2_BuildingType.Query(); buildingTypeQuery.Tenant_RefID = securityTicket.TenantID; buildingTypeQuery.IsDeleted = false; buildingTypeQuery.RES_BLD_Building_RefID = buildingItem.RES_BLD_BuildingID; buildingTypes.AddRange(ORM_RES_BLD_Building_2_BuildingType.Query.Search(Connection, Transaction, buildingTypeQuery)); ORM_RES_BLD_Building_2_GarbageContainerType.Query buildingGarbageContainerTypeQuery = new ORM_RES_BLD_Building_2_GarbageContainerType.Query(); buildingGarbageContainerTypeQuery.Tenant_RefID = securityTicket.TenantID; buildingGarbageContainerTypeQuery.IsDeleted = false; buildingGarbageContainerTypeQuery.RES_BLD_Building_RefID = buildingItem.RES_BLD_BuildingID; buildingGarbageContainerType.AddRange(ORM_RES_BLD_Building_2_GarbageContainerType.Query.Search(Connection, Transaction, buildingGarbageContainerTypeQuery)); } #endregion } #endregion #region Revision groups List <L5DD_GRGFRP_1403_Buildings> buildingsResult; L5DD_GRGFRP_1403_Buildings buildingResult; foreach (var revisionGroup in revisionGroupList) { revisionGroupItem = new L5DD_GRGFRP_1403(); revisionGroupItem.RES_DUD_Revision_GroupID = revisionGroup.RES_DUD_Revision_GroupID; revisionGroupItem.RevisionGroup_Name = revisionGroup.RevisionGroup_Name; revisionGroupItem.RevisionGroup_SubmittedBy_Account_RefID = revisionGroup.RevisionGroup_SubmittedBy_Account_RefID; revisionGroupItem.Creation_Timestamp = revisionGroup.Creation_Timestamp; revisionGroupItem.Tenant_RefID = revisionGroup.Tenant_RefID; revisionGroupItem.IsDeleted = revisionGroup.IsDeleted; revisionGroupItem.RealestateProperty_RefID = revisionGroup.RealestateProperty_RefID; revisionGroupItem.RevisionGroup_Comment = revisionGroup.RevisionGroup_Comment; #region Person info ORM_CMN_PER_PersonInfo personInfo = new ORM_CMN_PER_PersonInfo(); ORM_CMN_PER_PersonInfo_2_Account.Query personInfoAccountQuery = new ORM_CMN_PER_PersonInfo_2_Account.Query(); personInfoAccountQuery.Tenant_RefID = securityTicket.TenantID; personInfoAccountQuery.IsDeleted = false; personInfoAccountQuery.USR_Account_RefID = revisionGroup.RevisionGroup_SubmittedBy_Account_RefID; ORM_CMN_PER_PersonInfo_2_Account account = ORM_CMN_PER_PersonInfo_2_Account.Query.Search(Connection, Transaction, personInfoAccountQuery).FirstOrDefault(); if (account != null) { var personInfoResult = personInfo.Load(Connection, Transaction, account.CMN_PER_PersonInfo_RefID); if (personInfoResult.Status == FR_Status.Success && personInfo.CMN_PER_PersonInfoID != Guid.Empty) { revisionGroupItem.FirstName = personInfo.FirstName; revisionGroupItem.LastName = personInfo.LastName; } } #endregion #region set address info if (address != null) { revisionGroupItem.Country_Name = address.Country_Name; revisionGroupItem.City_Region = address.City_Region; revisionGroupItem.City_PostalCode = address.City_PostalCode; revisionGroupItem.City_Name = address.City_Name; revisionGroupItem.Street_Name = address.Street_Name; revisionGroupItem.Street_Number = address.Street_Number; } #endregion #region set building info buildingsResult = new List <L5DD_GRGFRP_1403_Buildings>(); // get revisions for revision group var revisionsForRetVal = revisions.Where(i => i.RevisionGroup_RefID == revisionGroup.RES_DUD_Revision_GroupID).ToList(); ORM_RES_DUD_Revision revisionForBuildingID; // get buildings for list of revision List <ORM_RES_BLD_Building> buildingForRetVal = new List <ORM_RES_BLD_Building>(); buildingForRetVal.AddRange(buildings.Where(i => revisionsForRetVal.Any(j => j.RES_BLD_Building_RefID == i.RES_BLD_BuildingID)).ToList()); foreach (var buildingForRetValItem in buildingForRetVal) { revisionForBuildingID = revisionsForRetVal.FirstOrDefault(i => i.RES_BLD_Building_RefID == buildingForRetValItem.RES_BLD_BuildingID); buildingResult = new L5DD_GRGFRP_1403_Buildings(); buildingResult.Building_Name = buildingForRetValItem.Building_Name; buildingResult.RES_BLD_BuildingID = buildingForRetValItem.RES_BLD_BuildingID; buildingResult.RES_DUD_RevisionID = revisionForBuildingID.RES_DUD_RevisionID; buildingResult.QuestionnaireVersion_RefID = revisionForBuildingID.QuestionnaireVersion_RefID; buildingResult.RES_BLD_Building_Type_RefID = buildingTypes.FirstOrDefault(i => i.RES_BLD_Building_RefID == buildingForRetValItem.RES_BLD_BuildingID).RES_BLD_Building_Type_RefID; buildingResult.RES_BLD_GarbageContainerType_RefID = buildingGarbageContainerType.FirstOrDefault(i => i.RES_BLD_Building_RefID == buildingForRetValItem.RES_BLD_BuildingID).RES_BLD_GarbageContainerType_RefID; buildingsResult.Add(buildingResult); } #endregion revisionGroupItem.Buildings = buildingsResult.ToArray(); retVal.Add(revisionGroupItem); } #endregion returnValue.Result = retVal.ToArray(); return(returnValue); #endregion UserCode }
protected static FR_L6DD_RGD_1503 Execute(DbConnection Connection, DbTransaction Transaction, P_L6DD_RGD_1503 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L6DD_RGD_1503(); //Put your code here returnValue.Result = new L6DD_RGD_1503(); var ormRevisionGroups = ORM_RES_DUD_RevisionGroup.Query.Search(Connection, Transaction, new ORM_RES_DUD_RevisionGroup.Query() { RES_DUD_Revision_GroupID = Parameter.RevisionGroupID, Tenant_RefID = securityTicket.TenantID, IsDeleted = false }); if (ormRevisionGroups.Count == 0) { return(null); } var revisionGroup = ormRevisionGroups[0]; var docHeaderIDs = new List <Guid>(); var priceIDs = new List <Guid>(); returnValue.Result.Currency = "EUR"; //HARDCODED returnValue.Result.Name = revisionGroup.RevisionGroup_Name; returnValue.Result.Comment = revisionGroup.RevisionGroup_Comment; returnValue.Result.SubmittedByAccount = revisionGroup.RevisionGroup_SubmittedBy_Account_RefID; returnValue.Result.CreationTimestamp = revisionGroup.Creation_Timestamp; returnValue.Result.RevisionGroupID = revisionGroup.RES_DUD_Revision_GroupID; ORM_RES_RealestateProperty ormRealestateProperty = new ORM_RES_RealestateProperty(); ormRealestateProperty.Load(Connection, Transaction, revisionGroup.RealestateProperty_RefID); ORM_CMN_LOC_Location ormLocation = new ORM_CMN_LOC_Location(); ormLocation.Load(Connection, Transaction, ormRealestateProperty.RealestateProperty_Location_RefID); ORM_CMN_Address ormAddress = new ORM_CMN_Address(); ormAddress.Load(Connection, Transaction, ormLocation.Address_RefID); returnValue.Result.Street_Name = ormAddress.Street_Name; returnValue.Result.Street_Number = ormAddress.Street_Number; returnValue.Result.Country_Name = ormAddress.Country_Name; returnValue.Result.City_Name = ormAddress.City_Name; returnValue.Result.City_PostalCode = ormAddress.City_PostalCode; returnValue.Result.City_Region = ormAddress.City_Region; var accountInformation = cls_Get_Account_PersonalInformation_for_AccountID.Invoke(Connection, Transaction, new P_L2AI_GAPIfAI_1627() { AccountRefID = revisionGroup.RevisionGroup_SubmittedBy_Account_RefID }, securityTicket).Result; returnValue.Result.SubmittedByAccount_LastName = accountInformation.LastName; returnValue.Result.SubmittedByAccount_FirstName = accountInformation.FirstName; var revisions = ORM_RES_DUD_Revision.Query.Search(Connection, Transaction, new ORM_RES_DUD_Revision.Query() { RevisionGroup_RefID = revisionGroup.RES_DUD_Revision_GroupID, IsDeleted = false, Tenant_RefID = securityTicket.TenantID }); if (revisions == null) { return(null); } var populatedRevisions = new List <Revisions>(); #region retrieve revision full details foreach (var revision in revisions) { Revisions populatedRevision = new Revisions(); populatedRevision.RevisionID = revision.RES_DUD_RevisionID; populatedRevision.QuestionnaireVersionID = revision.QuestionnaireVersion_RefID; populatedRevision.Comment = revision.Revision_Comment; populatedRevision.Title = revision.Revision_Title; populatedRevision.CreationTimestamp = revision.Creation_Timestamp; //For each revision in revision group gather and assemble info #region submision information populatedRevision.ApartmentSubmissionInfo = cls_Get_ApartmentSubmisionInfo_For_RevisionID.Invoke(Connection, Transaction, new P_L5DD_GASIfRID_1007() { RevisionID = revision.RES_DUD_RevisionID }, securityTicket).Result; if (populatedRevision.ApartmentSubmissionInfo != null) { var assessments = populatedRevision.ApartmentSubmissionInfo.SelectMany(a => a.ApartmentPropertyAsessments); if (assessments != null) { var reqActions = assessments.SelectMany(ass => ass.ApartmentReqActions); List <Guid> pricePerUnitRefIDs = reqActions.Where(r => r.Action_PricePerUnit_RefID != Guid.Empty).Select(r => r.Action_PricePerUnit_RefID).ToList(); List <Guid> effectivePriceRefIDs = reqActions.Where(r => r.EffectivePrice_RefID != Guid.Empty).Select(r => r.EffectivePrice_RefID).ToList(); priceIDs.AddRange(pricePerUnitRefIDs); priceIDs.AddRange(effectivePriceRefIDs); } } populatedRevision.AtticSubmissionInfo = cls_Get_AtticSubmisionInfo_For_RevisionID.Invoke(Connection, Transaction, new P_L5DD_GATTSIFRID_1411() { RevisionID = revision.RES_DUD_RevisionID }, securityTicket).Result; if (populatedRevision.AtticSubmissionInfo != null) { var assessments = populatedRevision.AtticSubmissionInfo.SelectMany(a => a.AtticPropertyAsessments); if (assessments != null) { var reqActions = assessments.SelectMany(ass => ass.AtticReqActions); List <Guid> pricePerUnitRefIDs = reqActions.Where(r => r.Action_PricePerUnit_RefID != Guid.Empty).Select(r => r.Action_PricePerUnit_RefID).ToList(); List <Guid> effectivePriceRefIDs = reqActions.Where(r => r.EffectivePrice_RefID != Guid.Empty).Select(r => r.EffectivePrice_RefID).ToList(); priceIDs.AddRange(pricePerUnitRefIDs); priceIDs.AddRange(effectivePriceRefIDs); } } populatedRevision.BasementSubmissionInfo = cls_Get_BasementSubmisionInfo_For_RevisionID.Invoke(Connection, Transaction, new P_L5DD_GBSIfRID_1431() { RevisionID = revision.RES_DUD_RevisionID }, securityTicket).Result; if (populatedRevision.BasementSubmissionInfo != null) { var assessments = populatedRevision.BasementSubmissionInfo.SelectMany(a => a.BasementPropertyAsessments); if (assessments != null) { var reqActions = assessments.SelectMany(ass => ass.BasementReqActions); List <Guid> pricePerUnitRefIDs = reqActions.Where(r => r.Action_PricePerUnit_RefID != Guid.Empty).Select(r => r.Action_PricePerUnit_RefID).ToList(); List <Guid> effectivePriceRefIDs = reqActions.Where(r => r.EffectivePrice_RefID != Guid.Empty).Select(r => r.EffectivePrice_RefID).ToList(); priceIDs.AddRange(pricePerUnitRefIDs); priceIDs.AddRange(effectivePriceRefIDs); } } populatedRevision.FacadeSubmissionInfo = cls_Get_FacadeSubmisionInfo_For_RevisionID.Invoke(Connection, Transaction, new P_L5DD_GFSIfRID_1438() { RevisionID = revision.RES_DUD_RevisionID }, securityTicket).Result; if (populatedRevision.FacadeSubmissionInfo != null) { var assessments = populatedRevision.FacadeSubmissionInfo.SelectMany(a => a.FacadePropertyAsessments); if (assessments != null) { var reqActions = assessments.SelectMany(ass => ass.FacadeReqActions); List <Guid> pricePerUnitRefIDs = reqActions.Where(r => r.Action_PricePerUnit_RefID != Guid.Empty).Select(r => r.Action_PricePerUnit_RefID).ToList(); List <Guid> effectivePriceRefIDs = reqActions.Where(r => r.EffectivePrice_RefID != Guid.Empty).Select(r => r.EffectivePrice_RefID).ToList(); priceIDs.AddRange(pricePerUnitRefIDs); priceIDs.AddRange(effectivePriceRefIDs); } } populatedRevision.HVACRSubmissionInfo = cls_Get_HVACRSubmisionInfo_For_RevisionID.Invoke(Connection, Transaction, new P_L5DD_GHSIfRID_1448() { RevisionID = revision.RES_DUD_RevisionID }, securityTicket).Result; if (populatedRevision.HVACRSubmissionInfo != null) { var assessments = populatedRevision.HVACRSubmissionInfo.SelectMany(a => a.HVACRPropertyAsessments); if (assessments != null) { var reqActions = assessments.SelectMany(ass => ass.HVACRReqActions); List <Guid> pricePerUnitRefIDs = reqActions.Where(r => r.Action_PricePerUnit_RefID != Guid.Empty).Select(r => r.Action_PricePerUnit_RefID).ToList(); List <Guid> effectivePriceRefIDs = reqActions.Where(r => r.EffectivePrice_RefID != Guid.Empty).Select(r => r.EffectivePrice_RefID).ToList(); priceIDs.AddRange(pricePerUnitRefIDs); priceIDs.AddRange(effectivePriceRefIDs); } } populatedRevision.OutdoorFascilitySubmissionInfo = cls_Get_OutdoorFascilitySubmisionInfo_For_RevisionID.Invoke(Connection, Transaction, new P_L5DD_GOFSIfRID_1454() { RevisionID = revision.RES_DUD_RevisionID }, securityTicket).Result; if (populatedRevision.OutdoorFascilitySubmissionInfo != null) { var assessments = populatedRevision.OutdoorFascilitySubmissionInfo.SelectMany(a => a.OutdoorFacilityAsessments); if (assessments != null) { var reqActions = assessments.SelectMany(ass => ass.OutdoorFacilityReqActions); List <Guid> pricePerUnitRefIDs = reqActions.Where(r => r.Action_PricePerUnit_RefID != Guid.Empty).Select(r => r.Action_PricePerUnit_RefID).ToList(); List <Guid> effectivePriceRefIDs = reqActions.Where(r => r.EffectivePrice_RefID != Guid.Empty).Select(r => r.EffectivePrice_RefID).ToList(); priceIDs.AddRange(pricePerUnitRefIDs); priceIDs.AddRange(effectivePriceRefIDs); } } populatedRevision.RoofSubmissionInfo = cls_Get_RoofSubmisionInfo_For_RevisionID.Invoke(Connection, Transaction, new P_L5DD_GRSIfRID_1213() { RevisionID = revision.RES_DUD_RevisionID }, securityTicket).Result; if (populatedRevision.RoofSubmissionInfo != null) { var assessments = populatedRevision.RoofSubmissionInfo.SelectMany(a => a.RoofPropertyAsessments); if (assessments != null) { var reqActions = assessments.SelectMany(ass => ass.RoofReqActions); List <Guid> pricePerUnitRefIDs = reqActions.Where(r => r.Action_PricePerUnit_RefID != Guid.Empty).Select(r => r.Action_PricePerUnit_RefID).ToList(); List <Guid> effectivePriceRefIDs = reqActions.Where(r => r.EffectivePrice_RefID != Guid.Empty).Select(r => r.EffectivePrice_RefID).ToList(); priceIDs.AddRange(pricePerUnitRefIDs); priceIDs.AddRange(effectivePriceRefIDs); } } populatedRevision.StaircaseSubmissionInfo = cls_Get_StaircaseSubmisionInfo_For_RevisionID.Invoke(Connection, Transaction, new P_L5DD_GASIfRID_1507() { RevisionID = revision.RES_DUD_RevisionID }, securityTicket).Result; if (populatedRevision.StaircaseSubmissionInfo != null) { var assessments = populatedRevision.StaircaseSubmissionInfo.SelectMany(a => a.StaircasePropertyAsessments); if (assessments != null) { var reqActions = assessments.SelectMany(ass => ass.StaircaseReqActions); List <Guid> pricePerUnitRefIDs = reqActions.Where(r => r.Action_PricePerUnit_RefID != Guid.Empty).Select(r => r.Action_PricePerUnit_RefID).ToList(); List <Guid> effectivePriceRefIDs = reqActions.Where(r => r.EffectivePrice_RefID != Guid.Empty).Select(r => r.EffectivePrice_RefID).ToList(); priceIDs.AddRange(pricePerUnitRefIDs); priceIDs.AddRange(effectivePriceRefIDs); } } #endregion #region building information populatedRevision.Building = cls_Get_BuildingInfo_for_Building_ID.Invoke(Connection, Transaction, new P_L5BL_GBIfBI_1159() { BuildingID = revision.RES_BLD_Building_RefID }, securityTicket).Result; populatedRevisions.Add(populatedRevision); #endregion } #endregion returnValue.Result.Revisions = populatedRevisions.ToArray(); #region Retrieve Images (documents) //retrieve image and price ID's foreach (var revision in returnValue.Result.Revisions) { docHeaderIDs.AddRange(revision.ApartmentSubmissionInfo.Select(x => x.Apartment_DocumentHeader_RefID)); docHeaderIDs.AddRange(revision.ApartmentSubmissionInfo.SelectMany(x => x.ApartmentPropertyAsessments.Select(s => s.DocumentHeader_RefID))); docHeaderIDs.AddRange(revision.AtticSubmissionInfo.Select(x => x.Attic_DocumentHeader_RefID)); docHeaderIDs.AddRange(revision.AtticSubmissionInfo.SelectMany(x => x.AtticPropertyAsessments.Select(s => s.DocumentHeader_RefID))); docHeaderIDs.AddRange(revision.BasementSubmissionInfo.Select(x => x.Basement_DocumentHeader_RefID)); docHeaderIDs.AddRange(revision.BasementSubmissionInfo.SelectMany(x => x.BasementPropertyAsessments.Select(s => s.DocumentHeader_RefID))); docHeaderIDs.AddRange(revision.FacadeSubmissionInfo.Select(x => x.Facade_DocumentHeader_RefID)); docHeaderIDs.AddRange(revision.FacadeSubmissionInfo.SelectMany(x => x.FacadePropertyAsessments.Select(s => s.DocumentHeader_RefID))); docHeaderIDs.AddRange(revision.HVACRSubmissionInfo.Select(x => x.HVACR_DocumentHeader_RefID)); docHeaderIDs.AddRange(revision.HVACRSubmissionInfo.SelectMany(x => x.HVACRPropertyAsessments.Select(s => s.DocumentHeader_RefID))); docHeaderIDs.AddRange(revision.OutdoorFascilitySubmissionInfo.Select(x => x.OutdoorF_DocumentHeader_RefID)); docHeaderIDs.AddRange(revision.OutdoorFascilitySubmissionInfo.SelectMany(x => x.OutdoorFacilityAsessments.Select(s => s.DocumentHeader_RefID))); docHeaderIDs.AddRange(revision.RoofSubmissionInfo.Select(x => x.Roof_DocumentHeader_RefID)); docHeaderIDs.AddRange(revision.RoofSubmissionInfo.SelectMany(x => x.RoofPropertyAsessments.Select(s => s.DocumentHeader_RefID))); docHeaderIDs.AddRange(revision.StaircaseSubmissionInfo.Select(x => x.Staircase_DocumentHeader_RefID)); docHeaderIDs.AddRange(revision.StaircaseSubmissionInfo.SelectMany(x => x.StaircasePropertyAsessments.Select(s => s.DocumentHeader_RefID))); docHeaderIDs.Add(revision.Building.Building_DocumentationStructure_RefID); priceIDs.AddRange(revision.ApartmentSubmissionInfo.SelectMany(x => x.ApartmentPropertyAsessments.SelectMany(s => s.ApartmentReqActions.Select(z => z.Action_PricePerUnit_RefID)))); priceIDs.AddRange(revision.AtticSubmissionInfo.SelectMany(x => x.AtticPropertyAsessments.SelectMany(s => s.AtticReqActions.Select(z => z.Action_PricePerUnit_RefID)))); priceIDs.AddRange(revision.BasementSubmissionInfo.SelectMany(x => x.BasementPropertyAsessments.SelectMany(s => s.BasementReqActions.Select(z => z.Action_PricePerUnit_RefID)))); priceIDs.AddRange(revision.FacadeSubmissionInfo.SelectMany(x => x.FacadePropertyAsessments.SelectMany(s => s.FacadeReqActions.Select(z => z.Action_PricePerUnit_RefID)))); priceIDs.AddRange(revision.HVACRSubmissionInfo.SelectMany(x => x.HVACRPropertyAsessments.SelectMany(s => s.HVACRReqActions.Select(z => z.Action_PricePerUnit_RefID)))); priceIDs.AddRange(revision.OutdoorFascilitySubmissionInfo.SelectMany(x => x.OutdoorFacilityAsessments.SelectMany(s => s.OutdoorFacilityReqActions.Select(z => z.Action_PricePerUnit_RefID)))); priceIDs.AddRange(revision.RoofSubmissionInfo.SelectMany(x => x.RoofPropertyAsessments.SelectMany(s => s.RoofReqActions.Select(z => z.Action_PricePerUnit_RefID)))); priceIDs.AddRange(revision.StaircaseSubmissionInfo.SelectMany(x => x.StaircasePropertyAsessments.SelectMany(s => s.StaircaseReqActions.Select(z => z.Action_PricePerUnit_RefID)))); priceIDs.AddRange(revision.ApartmentSubmissionInfo.SelectMany(x => x.ApartmentPropertyAsessments.SelectMany(s => s.ApartmentReqActions.Select(z => z.EffectivePrice_RefID)))); priceIDs.AddRange(revision.AtticSubmissionInfo.SelectMany(x => x.AtticPropertyAsessments.SelectMany(s => s.AtticReqActions.Select(z => z.EffectivePrice_RefID)))); priceIDs.AddRange(revision.BasementSubmissionInfo.SelectMany(x => x.BasementPropertyAsessments.SelectMany(s => s.BasementReqActions.Select(z => z.EffectivePrice_RefID)))); priceIDs.AddRange(revision.FacadeSubmissionInfo.SelectMany(x => x.FacadePropertyAsessments.SelectMany(s => s.FacadeReqActions.Select(z => z.EffectivePrice_RefID)))); priceIDs.AddRange(revision.HVACRSubmissionInfo.SelectMany(x => x.HVACRPropertyAsessments.SelectMany(s => s.HVACRReqActions.Select(z => z.EffectivePrice_RefID)))); priceIDs.AddRange(revision.OutdoorFascilitySubmissionInfo.SelectMany(x => x.OutdoorFacilityAsessments.SelectMany(s => s.OutdoorFacilityReqActions.Select(z => z.EffectivePrice_RefID)))); priceIDs.AddRange(revision.RoofSubmissionInfo.SelectMany(x => x.RoofPropertyAsessments.SelectMany(s => s.RoofReqActions.Select(z => z.EffectivePrice_RefID)))); priceIDs.AddRange(revision.StaircaseSubmissionInfo.SelectMany(x => x.StaircasePropertyAsessments.SelectMany(s => s.StaircaseReqActions.Select(z => z.EffectivePrice_RefID)))); //docHeaderIDs.Concat(revison.BuildingInfo.BuildingDocuments.Select(x => x.Building_DocumentationStructure_RefID)); } var docHeaders = new List <L3DO_GDfDH_1133>(); foreach (var docHeaderID in docHeaderIDs) { if (docHeaderID == Guid.Empty) { continue; } var documentRevisions = cls_Get_Documents_for_DHeaderID.Invoke(Connection, Transaction, new P_L3DO_GDfDH_1133() { DHeaderID = docHeaderID }, securityTicket).Result; if (documentRevisions == null || documentRevisions.Count() == 0) { continue; } docHeaders.AddRange(documentRevisions); } returnValue.Result.Images = docHeaders.ToArray(); #endregion #region Retrieve Prices var dbPrices = new List <L2PR_GPIfP_1135>(); foreach (var priceID in priceIDs) { if (priceID == Guid.Empty) { continue; } var priceValue = cls_Get_PriceInformation_For_PriceID.Invoke(Connection, Transaction, new P_L2PR_GPIfP_1135() { PriceID = priceID }, securityTicket).Result; if (priceValue == null) { continue; } dbPrices.Add(priceValue); //Find EU //if (string.Equals(priceValue.ISO4127, "EUR", StringComparison.OrdinalIgnoreCase)) // { // dbPrices.Add(priceValue); // break; // } // else // { // dbPrices.Add(priceValue); // break; // } } returnValue.Result.Prices = dbPrices.ToArray(); #endregion return(returnValue); #endregion UserCode }
protected static FR_L6DD_GRGIfRPI_1752_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L6DD_GRGIfRPI_1752 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L6DD_GRGIfRPI_1752_Array(); //Put your code here var revisionGroupList = new List <L6DD_GRGIfRPI_1752>(); var ormRevisionGroups = ORM_RES_DUD_RevisionGroup.Query.Search(Connection, Transaction, new ORM_RES_DUD_RevisionGroup.Query() { IsDeleted = false, RealestateProperty_RefID = Parameter.RealestatePropertyID, Tenant_RefID = securityTicket.TenantID }); foreach (var revGroup in ormRevisionGroups) { var revisionGroup = new L6DD_GRGIfRPI_1752(); revisionGroup.Comment = revGroup.RevisionGroup_Comment; revisionGroup.CreationTimestamp = revGroup.Creation_Timestamp; revisionGroup.Name = revGroup.RevisionGroup_Name; revisionGroup.SubmittedByAccount = revisionGroup.SubmittedByAccount; revisionGroup.RealestatePropertyID = Parameter.RealestatePropertyID; revisionGroup.RevisionGroupID = revGroup.RES_DUD_Revision_GroupID; //Find address information ORM_RES_RealestateProperty ormRealestateProperty = new ORM_RES_RealestateProperty(); ormRealestateProperty.Load(Connection, Transaction, revGroup.RealestateProperty_RefID); ORM_CMN_LOC_Location ormLocation = new ORM_CMN_LOC_Location(); ormLocation.Load(Connection, Transaction, ormRealestateProperty.RealestateProperty_Location_RefID); ORM_CMN_Address ormAddress = new ORM_CMN_Address(); ormAddress.Load(Connection, Transaction, ormLocation.Address_RefID); revisionGroup.Street_Name = ormAddress.Street_Name; revisionGroup.Street_Number = ormAddress.Street_Number; revisionGroup.Country_Name = ormAddress.Country_Name; revisionGroup.City_Name = ormAddress.City_Name; revisionGroup.City_PostalCode = ormAddress.City_PostalCode; revisionGroup.City_Region = ormAddress.City_Region; var accountInformation = cls_Get_Account_PersonalInformation_for_AccountID.Invoke(Connection, Transaction, new P_L2AI_GAPIfAI_1627() { AccountRefID = revGroup.RevisionGroup_SubmittedBy_Account_RefID }, securityTicket).Result; revisionGroup.SubmittedByAccount_LastName = accountInformation.LastName; revisionGroup.SubmittedByAccount_FirstName = accountInformation.FirstName; var revisionList = new List <L6DD_GRGIfRPI_1752_Revision>(); var omrRevisions = ORM_RES_DUD_Revision.Query.Search(Connection, Transaction, new ORM_RES_DUD_Revision.Query() { IsDeleted = false, RevisionGroup_RefID = revGroup.RES_DUD_Revision_GroupID, Tenant_RefID = securityTicket.TenantID }); foreach (var rev in omrRevisions) { var ormBuildings = ORM_RES_BLD_Building.Query.Search(Connection, Transaction, new ORM_RES_BLD_Building.Query() { IsDeleted = false, RES_BLD_BuildingID = rev.RES_BLD_Building_RefID, Tenant_RefID = securityTicket.TenantID }); var revision = new L6DD_GRGIfRPI_1752_Revision(); revision.BuildingID = rev.RES_BLD_Building_RefID; revision.RevisionID = rev.RES_DUD_RevisionID; revision.RevisionTitle = rev.Revision_Title; revision.BuildingName = ormBuildings[0].Building_Name; revisionList.Add(revision); } revisionGroup.Revisions = revisionList.ToArray(); revisionGroupList.Add(revisionGroup); } returnValue.Result = revisionGroupList.ToArray(); return(returnValue); #endregion UserCode }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5LI_SLI_1538 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); Guid PurchasingPowerAmount_Current; Guid PurchasingPowerAmount_Forecast; Guid ResidentialRent_MinPrice; Guid ResidentialRent_AveragePrice; Guid ResidentialRent_MaxPrice; Guid NonResidentialRent_MinPrice; Guid NonResidentialRent_AveragePrice; Guid NonResidentialRent_MaxPrice; ORM_CMN_Address address = new ORM_CMN_Address(); if (Parameter.AddressID != Guid.Empty) { var result = address.Load(Connection, Transaction, Parameter.AddressID); if (result.Status != FR_Status.Success || address.CMN_AddressID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } address.City_Region = Parameter.City_Region; address.Street_Name = Parameter.Street_Name; address.Street_Number = Parameter.Street_Number; address.City_AdministrativeDistrict = Parameter.City_AdministrativeDistrict; address.City_Name = Parameter.City_Name; address.City_PostalCode = Parameter.City_PostalCode; address.Province_Name = Parameter.Province_Name; address.Tenant_RefID = securityTicket.TenantID; address.Save(Connection, Transaction); //for purchasingPowerAmountCurrent ORM_CMN_Price price = new ORM_CMN_Price(); if (Parameter.RegionInformation_PurchasingPowerAmount_Current_RefID != Guid.Empty) { var result = price.Load(Connection, Transaction, Parameter.RegionInformation_PurchasingPowerAmount_Current_RefID); if (result.Status != FR_Status.Success || price.CMN_PriceID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } price.Tenant_RefID = securityTicket.TenantID; price.Save(Connection, Transaction); PurchasingPowerAmount_Current = price.CMN_PriceID; ORM_CMN_Price_Value.Query priceValueQuery = new ORM_CMN_Price_Value.Query(); priceValueQuery.Tenant_RefID = securityTicket.TenantID; priceValueQuery.Price_RefID = price.CMN_PriceID; priceValueQuery.IsDeleted = false; List <ORM_CMN_Price_Value> prices = ORM_CMN_Price_Value.Query.Search(Connection, Transaction, priceValueQuery); ORM_CMN_Price_Value priceValue = new ORM_CMN_Price_Value(); if (prices.Count != 0) { priceValue.Load(Connection, Transaction, prices[0].CMN_Price_ValueID); } priceValue.Tenant_RefID = securityTicket.TenantID; priceValue.Price_RefID = price.CMN_PriceID; priceValue.PriceValue_Amount = Parameter.RegionInformation_PurchasingPowerAmount_Current_RefIDValue; priceValue.Save(Connection, Transaction); //for RegionInformation_PurchasingPowerAmount_Forecast_RefID price = new ORM_CMN_Price(); if (Parameter.RegionInformation_PurchasingPowerAmount_Forecast_RefID != Guid.Empty) { var result = price.Load(Connection, Transaction, Parameter.RegionInformation_PurchasingPowerAmount_Forecast_RefID); if (result.Status != FR_Status.Success || price.CMN_PriceID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } price.Tenant_RefID = securityTicket.TenantID; price.Save(Connection, Transaction); PurchasingPowerAmount_Forecast = price.CMN_PriceID; priceValueQuery = new ORM_CMN_Price_Value.Query(); priceValueQuery.Tenant_RefID = securityTicket.TenantID; priceValueQuery.Price_RefID = price.CMN_PriceID; priceValueQuery.IsDeleted = false; prices = ORM_CMN_Price_Value.Query.Search(Connection, Transaction, priceValueQuery); priceValue = new ORM_CMN_Price_Value(); if (prices.Count != 0) { priceValue.Load(Connection, Transaction, prices[0].CMN_Price_ValueID); } priceValue.Tenant_RefID = securityTicket.TenantID; priceValue.Price_RefID = price.CMN_PriceID; priceValue.PriceValue_Amount = Parameter.RegionInformation_PurchasingPowerAmount_Forecast_RefIDValue; priceValue.Save(Connection, Transaction); //for RegionInformation_ResidentialRent_MinPrice_RefID price = new ORM_CMN_Price(); if (Parameter.RegionInformation_ResidentialRent_MinPrice_RefID != Guid.Empty) { var result = price.Load(Connection, Transaction, Parameter.RegionInformation_ResidentialRent_MinPrice_RefID); if (result.Status != FR_Status.Success || price.CMN_PriceID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } price.Tenant_RefID = securityTicket.TenantID; price.Save(Connection, Transaction); ResidentialRent_MinPrice = price.CMN_PriceID; priceValueQuery = new ORM_CMN_Price_Value.Query(); priceValueQuery.Tenant_RefID = securityTicket.TenantID; priceValueQuery.Price_RefID = price.CMN_PriceID; priceValueQuery.IsDeleted = false; prices = ORM_CMN_Price_Value.Query.Search(Connection, Transaction, priceValueQuery); priceValue = new ORM_CMN_Price_Value(); if (prices.Count != 0) { priceValue.Load(Connection, Transaction, prices[0].CMN_Price_ValueID); } priceValue.Tenant_RefID = securityTicket.TenantID; priceValue.Price_RefID = price.CMN_PriceID; priceValue.PriceValue_Amount = Parameter.RegionInformation_ResidentialRent_MinPrice_RefIDValue; priceValue.Save(Connection, Transaction); //for RegionInformation_ResidentialRent_AveragePrice_RefID price = new ORM_CMN_Price(); if (Parameter.RegionInformation_ResidentialRent_AveragePrice_RefID != Guid.Empty) { var result = price.Load(Connection, Transaction, Parameter.RegionInformation_ResidentialRent_AveragePrice_RefID); if (result.Status != FR_Status.Success || price.CMN_PriceID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } price.Tenant_RefID = securityTicket.TenantID; price.Save(Connection, Transaction); ResidentialRent_AveragePrice = price.CMN_PriceID; priceValueQuery = new ORM_CMN_Price_Value.Query(); priceValueQuery.Tenant_RefID = securityTicket.TenantID; priceValueQuery.Price_RefID = price.CMN_PriceID; priceValueQuery.IsDeleted = false; prices = ORM_CMN_Price_Value.Query.Search(Connection, Transaction, priceValueQuery); priceValue = new ORM_CMN_Price_Value(); if (prices.Count != 0) { priceValue.Load(Connection, Transaction, prices[0].CMN_Price_ValueID); } priceValue.Tenant_RefID = securityTicket.TenantID; priceValue.Price_RefID = price.CMN_PriceID; priceValue.PriceValue_Amount = Parameter.RegionInformation_ResidentialRent_AveragePrice_RefIDValue; priceValue.Save(Connection, Transaction); //for RegionInformation_ResidentialRent_MaxPrice_RefID price = new ORM_CMN_Price(); if (Parameter.RegionInformation_ResidentialRent_MaxPrice_RefID != Guid.Empty) { var result = price.Load(Connection, Transaction, Parameter.RegionInformation_ResidentialRent_MaxPrice_RefID); if (result.Status != FR_Status.Success || price.CMN_PriceID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } price.Tenant_RefID = securityTicket.TenantID; price.Save(Connection, Transaction); ResidentialRent_MaxPrice = price.CMN_PriceID; priceValueQuery = new ORM_CMN_Price_Value.Query(); priceValueQuery.Tenant_RefID = securityTicket.TenantID; priceValueQuery.Price_RefID = price.CMN_PriceID; priceValueQuery.IsDeleted = false; prices = ORM_CMN_Price_Value.Query.Search(Connection, Transaction, priceValueQuery); priceValue = new ORM_CMN_Price_Value(); if (prices.Count != 0) { priceValue.Load(Connection, Transaction, prices[0].CMN_Price_ValueID); } priceValue.Tenant_RefID = securityTicket.TenantID; priceValue.Price_RefID = price.CMN_PriceID; priceValue.PriceValue_Amount = Parameter.RegionInformation_ResidentialRent_MaxPrice_RefIDValue; priceValue.Save(Connection, Transaction); //for RegionInformation_NonResidentialRent_MinPrice_RefID price = new ORM_CMN_Price(); if (Parameter.RegionInformation_NonResidentialRent_MinPrice_RefID != Guid.Empty) { var result = price.Load(Connection, Transaction, Parameter.RegionInformation_NonResidentialRent_MinPrice_RefID); if (result.Status != FR_Status.Success || price.CMN_PriceID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } price.Tenant_RefID = securityTicket.TenantID; price.Save(Connection, Transaction); NonResidentialRent_MinPrice = price.CMN_PriceID; priceValueQuery = new ORM_CMN_Price_Value.Query(); priceValueQuery.Tenant_RefID = securityTicket.TenantID; priceValueQuery.Price_RefID = price.CMN_PriceID; priceValueQuery.IsDeleted = false; prices = ORM_CMN_Price_Value.Query.Search(Connection, Transaction, priceValueQuery); priceValue = new ORM_CMN_Price_Value(); if (prices.Count != 0) { priceValue.Load(Connection, Transaction, prices[0].CMN_Price_ValueID); } priceValue.Tenant_RefID = securityTicket.TenantID; priceValue.Price_RefID = price.CMN_PriceID; priceValue.PriceValue_Amount = Parameter.RegionInformation_NonResidentialRent_MinPrice_RefIDValue; priceValue.Save(Connection, Transaction); //for RegionInformation_NonResidentialRent_AveragePrice_RefID price = new ORM_CMN_Price(); if (Parameter.RegionInformation_NonResidentialRent_AveragePrice_RefID != Guid.Empty) { var result = price.Load(Connection, Transaction, Parameter.RegionInformation_NonResidentialRent_AveragePrice_RefID); if (result.Status != FR_Status.Success || price.CMN_PriceID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } price.Tenant_RefID = securityTicket.TenantID; price.Save(Connection, Transaction); NonResidentialRent_AveragePrice = price.CMN_PriceID; priceValueQuery = new ORM_CMN_Price_Value.Query(); priceValueQuery.Tenant_RefID = securityTicket.TenantID; priceValueQuery.Price_RefID = price.CMN_PriceID; priceValueQuery.IsDeleted = false; prices = ORM_CMN_Price_Value.Query.Search(Connection, Transaction, priceValueQuery); priceValue = new ORM_CMN_Price_Value(); if (prices.Count != 0) { priceValue.Load(Connection, Transaction, prices[0].CMN_Price_ValueID); } priceValue.Tenant_RefID = securityTicket.TenantID; priceValue.Price_RefID = price.CMN_PriceID; priceValue.PriceValue_Amount = Parameter.RegionInformation_NonResidentialRent_AveragePrice_RefIDValue; priceValue.Save(Connection, Transaction); //for RegionInformation_NonResidentialRent_MaxPrice_RefID price = new ORM_CMN_Price(); if (Parameter.RegionInformation_NonResidentialRent_MaxPrice_RefID != Guid.Empty) { var result = price.Load(Connection, Transaction, Parameter.RegionInformation_NonResidentialRent_MaxPrice_RefID); if (result.Status != FR_Status.Success || price.CMN_PriceID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } price.Tenant_RefID = securityTicket.TenantID; price.Save(Connection, Transaction); NonResidentialRent_MaxPrice = price.CMN_PriceID; priceValueQuery = new ORM_CMN_Price_Value.Query(); priceValueQuery.Tenant_RefID = securityTicket.TenantID; priceValueQuery.Price_RefID = price.CMN_PriceID; priceValueQuery.IsDeleted = false; prices = ORM_CMN_Price_Value.Query.Search(Connection, Transaction, priceValueQuery); priceValue = new ORM_CMN_Price_Value(); if (prices.Count != 0) { priceValue.Load(Connection, Transaction, prices[0].CMN_Price_ValueID); } priceValue.Tenant_RefID = securityTicket.TenantID; priceValue.Price_RefID = price.CMN_PriceID; priceValue.PriceValue_Amount = Parameter.RegionInformation_NonResidentialRent_MaxPrice_RefIDValue; priceValue.Save(Connection, Transaction); //for regionInfo and region ORM_CMN_LOC_Region region = new ORM_CMN_LOC_Region(); if (Parameter.RegionID != Guid.Empty) { var result = region.Load(Connection, Transaction, Parameter.RegionID); if (result.Status != FR_Status.Success || region.CMN_LOC_RegionID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } ORM_RES_LOC_RegionInformation.Query regionInfo = new ORM_RES_LOC_RegionInformation.Query(); regionInfo.CMN_LOC_Region_RefID = region.CMN_LOC_RegionID; regionInfo.Tenant_RefID = securityTicket.TenantID; regionInfo.IsDeleted = false; List <ORM_RES_LOC_RegionInformation> infos = ORM_RES_LOC_RegionInformation.Query.Search(Connection, Transaction, regionInfo); ORM_RES_LOC_RegionInformation info; if (infos.Count > 0) { info = infos[0]; info.RegionInformation_RegionArea_in_sqkm = Parameter.RegionInformation_RegionArea_in_sqkm; info.RegionInformation_TotalPopulation = Parameter.RegionInformation_TotalPopulation; info.RegionInformation_Population_per_sqkm = Parameter.RegionInformation_Population_per_sqkm; info.RegionInformation_RegionUnemploymentRatePercent = Parameter.RegionInformation_RegionUnemploymentRatePercent; info.RegionInformation_NumberOfHouseholds_Current = Parameter.RegionInformation_NumberOfHouseholds_Current; info.RegionInformation_NumberOfHouseholds_Forecast = Parameter.RegionInformation_NumberOfHouseholds_Forecast; info.Tenant_RefID = securityTicket.TenantID; info.Save(Connection, Transaction); } else { info = new ORM_RES_LOC_RegionInformation(); info.CMN_LOC_Region_RefID = region.CMN_LOC_RegionID; info.RegionInformation_RegionArea_in_sqkm = Parameter.RegionInformation_RegionArea_in_sqkm; info.RegionInformation_TotalPopulation = Parameter.RegionInformation_TotalPopulation; info.RegionInformation_Population_per_sqkm = Parameter.RegionInformation_Population_per_sqkm; info.RegionInformation_RegionUnemploymentRatePercent = Parameter.RegionInformation_RegionUnemploymentRatePercent; info.RegionInformation_NumberOfHouseholds_Current = Parameter.RegionInformation_NumberOfHouseholds_Current; info.RegionInformation_NumberOfHouseholds_Forecast = Parameter.RegionInformation_NumberOfHouseholds_Forecast; info.RegionInformation_PurchasingPowerAmount_Current_RefID = PurchasingPowerAmount_Current; info.RegionInformation_PurchasingPowerAmount_Forecast_RefID = PurchasingPowerAmount_Forecast; info.RegionInformation_ResidentialRent_MinPrice_RefID = ResidentialRent_MinPrice; info.RegionInformation_ResidentialRent_AveragePrice_RefID = ResidentialRent_AveragePrice; info.RegionInformation_ResidentialRent_MaxPrice_RefID = ResidentialRent_MaxPrice; info.RegionInformation_NonResidentialRent_MinPrice_RefID = NonResidentialRent_MinPrice; info.RegionInformation_NonResidentialRent_AveragePrice_RefID = NonResidentialRent_AveragePrice; info.RegionInformation_NonResidentialRent_MaxPrice_RefID = NonResidentialRent_MaxPrice; info.Tenant_RefID = securityTicket.TenantID; info.Save(Connection, Transaction); } //save region region.Country_RefID = Parameter.Country_RefID; region.Tenant_RefID = securityTicket.TenantID; region.Save(Connection, Transaction); //for location ORM_CMN_LOC_Location location = new ORM_CMN_LOC_Location(); if (Parameter.CMN_LOC_LocationID != Guid.Empty) { var result = location.Load(Connection, Transaction, Parameter.CMN_LOC_LocationID); if (result.Status != FR_Status.Success || location.CMN_LOC_LocationID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } location.Region_RefID = region.CMN_LOC_RegionID; location.Address_RefID = address.CMN_AddressID; location.Tenant_RefID = securityTicket.TenantID; location.Save(Connection, Transaction); //add location ref id in realesteProperty ORM_RES_RealestateProperty.Query realestatePropertyQuery = new ORM_RES_RealestateProperty.Query(); realestatePropertyQuery.RES_RealestatePropertyID = Parameter.RealestatePropertyID; List <ORM_RES_RealestateProperty> realestates = ORM_RES_RealestateProperty.Query.Search(Connection, Transaction, realestatePropertyQuery); ORM_RES_RealestateProperty realestate = realestates[0]; realestate.RealestateProperty_Location_RefID = location.CMN_LOC_LocationID; realestate.Save(Connection, Transaction); //for locationInformation ORM_RES_LOC_LocationInformation locationInformation = new ORM_RES_LOC_LocationInformation(); if (Parameter.LocationInformationID != Guid.Empty) { var result = locationInformation.Load(Connection, Transaction, Parameter.LocationInformationID); if (result.Status != FR_Status.Success || locationInformation.RES_LOC_LocationInformationID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } locationInformation.CMN_LOC_Location_RefID = location.CMN_LOC_LocationID; locationInformation.LocationInformation_MapImage_DocID = Parameter.MapImage; locationInformation.LocationInformation_SatelliteImage_DocID = Parameter.SateliteImage; locationInformation.LocationInformation_AddressImage_DocID = Parameter.AddressImage; locationInformation.Tenant_RefID = securityTicket.TenantID; locationInformation.Save(Connection, Transaction); //for meansOfTrasnportation, emmissions, infrastructures... ORM_RES_LOC_LocationInformation_2_MeansOfTransportation transportation; ORM_RES_LOC_LocationInformation_2_SurroundingInfrastructure infrastructure; ORM_RES_LOC_LocationInformation_2_Emmission emmission; ORM_RES_LOC_LocationInformation_2_NeighborhoodQuality qualitie; ORM_RES_LOC_LocationInfo_2_ParkingSituation parkingSituation; ORM_RES_LOC_LocationInfo_2_ResidentialVacancy residentialVacancy; ORM_RES_LOC_LocationInfo_2_CommercialVacancy commercialVacancy; ORM_RES_LOC_LocationInformation_2_MeansOfTransportation.Query transportationQuery = new ORM_RES_LOC_LocationInformation_2_MeansOfTransportation.Query(); transportationQuery.RES_LOC_LocationInformation_RefID = locationInformation.RES_LOC_LocationInformationID; transportationQuery.Tenant_RefID = securityTicket.TenantID; transportationQuery.IsDeleted = false; ORM_RES_LOC_LocationInformation_2_MeansOfTransportation.Query.SoftDelete(Connection, Transaction, transportationQuery); if (Parameter.RES_LOC_MeansOfTransportation_RefID != null) { foreach (Guid guid in Parameter.RES_LOC_MeansOfTransportation_RefID) { transportation = new ORM_RES_LOC_LocationInformation_2_MeansOfTransportation(); transportation.RES_LOC_LocationInformation_RefID = locationInformation.RES_LOC_LocationInformationID; transportation.RES_LOC_MeansOfTransportation_RefID = guid; transportation.Tenant_RefID = securityTicket.TenantID; transportation.Save(Connection, Transaction); } } ORM_RES_LOC_LocationInformation_2_SurroundingInfrastructure.Query infrastructureQuery = new ORM_RES_LOC_LocationInformation_2_SurroundingInfrastructure.Query(); infrastructureQuery.RES_LOC_LocationInformation_RefID = locationInformation.RES_LOC_LocationInformationID; infrastructureQuery.Tenant_RefID = securityTicket.TenantID; infrastructureQuery.IsDeleted = false; ORM_RES_LOC_LocationInformation_2_SurroundingInfrastructure.Query.SoftDelete(Connection, Transaction, infrastructureQuery); if (Parameter.RES_LOC_SurroundingInfrastructure_RefID != null) { foreach (Guid guid in Parameter.RES_LOC_SurroundingInfrastructure_RefID) { infrastructure = new ORM_RES_LOC_LocationInformation_2_SurroundingInfrastructure(); infrastructure.RES_LOC_LocationInformation_RefID = locationInformation.RES_LOC_LocationInformationID; infrastructure.RES_LOC_SurroundingInfrastructure_RefID = guid; infrastructure.Tenant_RefID = securityTicket.TenantID; infrastructure.Save(Connection, Transaction); } } ORM_RES_LOC_LocationInformation_2_Emmission.Query emmissionQuery = new ORM_RES_LOC_LocationInformation_2_Emmission.Query(); emmissionQuery.RES_LOC_LocationInformation_RefID = locationInformation.RES_LOC_LocationInformationID; emmissionQuery.Tenant_RefID = securityTicket.TenantID; emmissionQuery.IsDeleted = false; ORM_RES_LOC_LocationInformation_2_Emmission.Query.SoftDelete(Connection, Transaction, emmissionQuery); if (Parameter.RES_LOC_Emmission_RefID != null) { foreach (Guid guid in Parameter.RES_LOC_Emmission_RefID) { emmission = new ORM_RES_LOC_LocationInformation_2_Emmission(); emmission.RES_LOC_LocationInformation_RefID = locationInformation.RES_LOC_LocationInformationID; emmission.RES_LOC_Emmission_RefID = guid; emmission.Tenant_RefID = securityTicket.TenantID; emmission.Save(Connection, Transaction); } } ORM_RES_LOC_LocationInformation_2_NeighborhoodQuality.Query neighborhoodQuery = new ORM_RES_LOC_LocationInformation_2_NeighborhoodQuality.Query(); neighborhoodQuery.RES_LOC_LocationInformation_RefID = locationInformation.RES_LOC_LocationInformationID; neighborhoodQuery.Tenant_RefID = securityTicket.TenantID; neighborhoodQuery.IsDeleted = false; ORM_RES_LOC_LocationInformation_2_NeighborhoodQuality.Query.SoftDelete(Connection, Transaction, neighborhoodQuery); if (Parameter.RES_LOC_NeighborhoodQuality_RefID != null) { foreach (Guid guid in Parameter.RES_LOC_NeighborhoodQuality_RefID) { qualitie = new ORM_RES_LOC_LocationInformation_2_NeighborhoodQuality(); qualitie.RES_LOC_LocationInformation_RefID = locationInformation.RES_LOC_LocationInformationID; qualitie.RES_LOC_NeighborhoodQuality_RefID = guid; qualitie.Tenant_RefID = securityTicket.TenantID; qualitie.Save(Connection, Transaction); } } ORM_RES_LOC_LocationInfo_2_ParkingSituation.Query parkingQuery = new ORM_RES_LOC_LocationInfo_2_ParkingSituation.Query(); parkingQuery.RES_LOC_LocationInfo_RefID = locationInformation.RES_LOC_LocationInformationID; parkingQuery.Tenant_RefID = securityTicket.TenantID; parkingQuery.IsDeleted = false; ORM_RES_LOC_LocationInfo_2_ParkingSituation.Query.SoftDelete(Connection, Transaction, parkingQuery); if (Parameter.RES_LOC_ParkingSituation_RefID != null) { foreach (Guid guid in Parameter.RES_LOC_ParkingSituation_RefID) { parkingSituation = new ORM_RES_LOC_LocationInfo_2_ParkingSituation(); parkingSituation.RES_LOC_LocationInfo_RefID = locationInformation.RES_LOC_LocationInformationID; parkingSituation.RES_LOC_ParkingSituation_RefID = guid; parkingSituation.Tenant_RefID = securityTicket.TenantID; parkingSituation.Save(Connection, Transaction); } } ORM_RES_LOC_LocationInfo_2_ResidentialVacancy.Query residentalQuery = new ORM_RES_LOC_LocationInfo_2_ResidentialVacancy.Query(); residentalQuery.RES_LOC_LocationInfo_RefID = locationInformation.RES_LOC_LocationInformationID; residentalQuery.Tenant_RefID = securityTicket.TenantID; residentalQuery.IsDeleted = false; ORM_RES_LOC_LocationInfo_2_ResidentialVacancy.Query.SoftDelete(Connection, Transaction, residentalQuery); if (Parameter.RES_LOC_ResidentialVacancies_RefID != null) { foreach (Guid guid in Parameter.RES_LOC_ResidentialVacancies_RefID) { residentialVacancy = new ORM_RES_LOC_LocationInfo_2_ResidentialVacancy(); residentialVacancy.RES_LOC_LocationInfo_RefID = locationInformation.RES_LOC_LocationInformationID; residentialVacancy.RES_LOC_ResidentialVacancy_RefID = guid; residentialVacancy.Tenant_RefID = securityTicket.TenantID; residentialVacancy.Save(Connection, Transaction); } } ORM_RES_LOC_LocationInfo_2_CommercialVacancy.Query commercialQuery = new ORM_RES_LOC_LocationInfo_2_CommercialVacancy.Query(); commercialQuery.RES_LOC_LocationInfo_RefID = locationInformation.RES_LOC_LocationInformationID; commercialQuery.Tenant_RefID = securityTicket.TenantID; commercialQuery.IsDeleted = false; ORM_RES_LOC_LocationInfo_2_CommercialVacancy.Query.SoftDelete(Connection, Transaction, commercialQuery); if (Parameter.RES_LOC_CommercialVacancies_RefID != null) { foreach (Guid guid in Parameter.RES_LOC_CommercialVacancies_RefID) { commercialVacancy = new ORM_RES_LOC_LocationInfo_2_CommercialVacancy(); commercialVacancy.RES_LOC_LocationInfo_RefID = locationInformation.RES_LOC_LocationInformationID; commercialVacancy.RES_LOC_CommercialVacancy_RefID = guid; commercialVacancy.Tenant_RefID = securityTicket.TenantID; commercialVacancy.Save(Connection, Transaction); } } returnValue.Result = location.CMN_LOC_LocationID; return(returnValue); #endregion UserCode }