Example #1
0
        public static Concept CreateNew(int depth = 0)
        {
            rt.srz.model.srz.Concept entity = new rt.srz.model.srz.Concept();


            entity.Code        = "123";
            entity.Name        = "Test Test ";
            entity.Description = "Test Test ";
            entity.ShortName   = "Test Test ";
            entity.RelatedCode = "Test Test ";
            entity.RelatedOid  = "Test Test ";
            entity.RelatedType = "Test Test ";
            entity.DateFrom    = System.DateTime.Now;
            entity.DateTo      = System.DateTime.Now;
            entity.Relevance   = 53;

            using (rt.srz.business.manager.IOidManager oidManager = ObjectFactory.GetInstance <IOidManager>())
            {
                entity.Oid = null;
            }

            return(entity);
        }
        public static Organisation CreateNew(int depth = 0)
        {
            rt.srz.model.srz.Organisation entity = new rt.srz.model.srz.Organisation();

            // You may need to maually enter this key if there is a constraint violation.
            entity.Id = System.Guid.NewGuid();

            entity.IsActive            = true;
            entity.IsOnLine            = true;
            entity.Code                = "123";
            entity.FullName            = "Test Test ";
            entity.ShortName           = "Test Test ";
            entity.Inn                 = "Test Tes";
            entity.Ogrn                = "Test Test Test T";
            entity.Postcode            = "Te";
            entity.LastName            = "Test Test ";
            entity.FirstName           = "Test Test ";
            entity.MiddleName          = "Test Test ";
            entity.Phone               = "Test Test ";
            entity.Fax                 = "Test Test ";
            entity.EMail               = "Test Test ";
            entity.Website             = "Test Test ";
            entity.LicenseData         = "Test Test ";
            entity.LicenseNumber       = "Test";
            entity.DateLicensing       = System.DateTime.Now;
            entity.DateExpiryLicense   = System.DateTime.Now;
            entity.IsSubordination     = true;
            entity.DateIncludeRegister = System.DateTime.Now;
            entity.DateExcludeRegister = System.DateTime.Now;
            entity.HasActivePolicy     = true;
            entity.DateNotification    = System.DateTime.Now;
            entity.CountInsured        = 45;
            entity.DateLastEdit        = System.DateTime.Now;
            entity.Okato               = "Tes";
            entity.TimeRunFrom         = System.DateTime.Now;
            entity.TimeRunTo           = System.DateTime.Now;
            entity.Address             = "Test Test ";

            using (rt.srz.business.manager.IOidManager oidManager = ObjectFactory.GetInstance <IOidManager>())
            {
                var all       = oidManager.GetAll(1);
                Oid entityRef = null;
                if (all.Count > 0)
                {
                    entityRef = all[0];
                }

                if (entityRef == null && depth < 3)
                {
                    depth++;
                    entityRef = OidTests.CreateNew(depth);
                    ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession().Save(entityRef);
                }

                entity.Oid = entityRef;
            }

            using (rt.srz.business.manager.IOrganisationManager organisationMember1Manager = ObjectFactory.GetInstance <IOrganisationManager>())
            {
                entity.Parent = null;
            }

            using (rt.srz.business.manager.IOrganisationManager organisationMember2Manager = ObjectFactory.GetInstance <IOrganisationManager>())
            {
                entity.ChangedRow = null;
            }

            using (rt.srz.business.manager.IConceptManager concept1Manager = ObjectFactory.GetInstance <IConceptManager>())
            {
                entity.CauseRegistration = null;
            }

            using (rt.srz.business.manager.IConceptManager concept2Manager = ObjectFactory.GetInstance <IConceptManager>())
            {
                entity.CauseExclusion = null;
            }

            return(entity);
        }