Ejemplo n.º 1
0
        protected override int CreateOrGetOrganizationIdAdditional(int contragentId, Record record)
        {
            if (record.OrganizationType != OrgType.ResourceProvider)
            {
                return(0);
            }

            if (this.publicServiceOrgByContragentIdDict.ContainsKey(contragentId))
            {
                return(this.publicServiceOrgByContragentIdDict[contragentId]);
            }

            // create
            var publicServiceOrg = new PublicServiceOrg
            {
                Contragent = new Contragent {
                    Id = contragentId
                },
                OrgStateRole = OrgStateRole.Active,
                ActivityGroundsTermination = GroundsTermination.NotSet
            };

            PublicServiceOrgRepository.Save(publicServiceOrg);


            this.publicServiceOrgByContragentIdDict[contragentId] = publicServiceOrg.Id;

            return(publicServiceOrg.Id);
        }
Ejemplo n.º 2
0
        protected override int CreateOrGetOrganizationIdAdditional(int contragentId, Record record)
        {
            if (record.OrganizationType != OrgType.ResourceProvider)
            {
                return 0;
            }

            if (this.publicServiceOrgByContragentIdDict.ContainsKey(contragentId))
            {
                return this.publicServiceOrgByContragentIdDict[contragentId];
            }

            // create
            var publicServiceOrg = new PublicServiceOrg
            {
                Contragent = new Contragent { Id = contragentId },
                OrgStateRole = OrgStateRole.Active,
                ActivityGroundsTermination = GroundsTermination.NotSet
            };

            PublicServiceOrgRepository.Save(publicServiceOrg);

            this.publicServiceOrgByContragentIdDict[contragentId] = publicServiceOrg.Id;

            return publicServiceOrg.Id;
        }