protected override void CreateContractIfNotExistAdditional(int organizationId, Record record) { if (record.OrganizationType != OrgType.ResourceProvider) { return; } // 1. Создать связь между домом и организацией // 2. Создать договор между домом и организацией // 1 var publicServiceOrgRealtyObject = new PublicServiceOrgRealtyObject { PublicServiceOrg = new PublicServiceOrg { Id = organizationId }, RealityObject = new RealityObject { Id = record.RealtyObjectId } }; if (publicServiceOrgRo.ContainsKey(organizationId)) { var publicServiceOrgRobjects = publicServiceOrgRo[organizationId]; if (!publicServiceOrgRobjects.Contains(record.RealtyObjectId)) { PublicServiceOrgRealtyObjectRepository.Save(publicServiceOrgRealtyObject); publicServiceOrgRobjects.Add(record.RealtyObjectId); } } else { PublicServiceOrgRealtyObjectRepository.Save(publicServiceOrgRealtyObject); publicServiceOrgRo[organizationId] = new List<int> { record.RealtyObjectId }; } // 2 var realObjPublicServiceOrg = new RealObjPublicServiceOrg { RealityObject = new RealityObject { Id = record.RealtyObjectId }, PublicServiceOrg = new PublicServiceOrg { Id = organizationId }, ContractDate = record.DocumentDate, ContractNumber = record.DocumentNumber, DateStart = record.ContractStartDate }; if (publicServiceOrgRoContract.ContainsKey(organizationId)) { var publicServiceOrgRoContracts = publicServiceOrgRoContract[organizationId]; if (!publicServiceOrgRoContracts.Contains(record.RealtyObjectId)) { RealObjPublicServiceOrgRepository.Save(realObjPublicServiceOrg); publicServiceOrgRoContracts.Add(record.RealtyObjectId); } } else { RealObjPublicServiceOrgRepository.Save(realObjPublicServiceOrg); publicServiceOrgRoContract[organizationId] = new List<int> { record.RealtyObjectId }; } }
protected override void CreateContractIfNotExistAdditional(int organizationId, Record record) { if (record.OrganizationType != OrgType.ResourceProvider) { return; } // 1. Создать связь между домом и организацией // 2. Создать договор между домом и организацией // 1 var publicServiceOrgRealtyObject = new PublicServiceOrgRealtyObject { PublicServiceOrg = new PublicServiceOrg { Id = organizationId }, RealityObject = new RealityObject { Id = record.RealtyObjectId } }; if (publicServiceOrgRo.ContainsKey(organizationId)) { var publicServiceOrgRobjects = publicServiceOrgRo[organizationId]; if (!publicServiceOrgRobjects.Contains(record.RealtyObjectId)) { PublicServiceOrgRealtyObjectRepository.Save(publicServiceOrgRealtyObject); publicServiceOrgRobjects.Add(record.RealtyObjectId); } } else { PublicServiceOrgRealtyObjectRepository.Save(publicServiceOrgRealtyObject); publicServiceOrgRo[organizationId] = new List <int> { record.RealtyObjectId }; } // 2 var realObjPublicServiceOrg = new RealObjPublicServiceOrg { RealityObject = new RealityObject { Id = record.RealtyObjectId }, PublicServiceOrg = new PublicServiceOrg { Id = organizationId }, ContractDate = record.DocumentDate, ContractNumber = record.DocumentNumber, DateStart = record.ContractStartDate }; if (publicServiceOrgRoContract.ContainsKey(organizationId)) { var publicServiceOrgRoContracts = publicServiceOrgRoContract[organizationId]; if (!publicServiceOrgRoContracts.Contains(record.RealtyObjectId)) { RealObjPublicServiceOrgRepository.Save(realObjPublicServiceOrg); publicServiceOrgRoContracts.Add(record.RealtyObjectId); } } else { RealObjPublicServiceOrgRepository.Save(realObjPublicServiceOrg); publicServiceOrgRoContract[organizationId] = new List <int> { record.RealtyObjectId }; } }