Пример #1
0
        public static AObject CreateNew(int depth = 0)
        {
            rt.fias.model.fias.AObject entity = new rt.fias.model.fias.AObject();

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

            entity.Aoguid     = System.Guid.NewGuid();
            entity.Formalname = "Test Test ";
            entity.Regioncode = "T";
            entity.Autocode   = "T";
            entity.Areacode   = "Te";
            entity.Citycode   = "Te";
            entity.Ctarcode   = "T";
            entity.Placecode  = "T";
            entity.Streetcode = "Tes";
            entity.Extrcode   = "Test Test ";
            entity.Sextcode   = "T";
            entity.Offname    = "Test Test ";
            entity.Postalcode = "Test";
            entity.Ifnsfl     = "Tes";
            entity.Terrifnsfl = "Tes";
            entity.Ifnsul     = "Tes";
            entity.Terrifnsul = "T";
            entity.Okato      = "Test Test";
            entity.Oktmo      = "Test Te";
            entity.Updatedate = System.DateTime.Now;
            entity.Shortname  = "T";
            entity.Aolevel    = 28;
            entity.Parentguid = System.Guid.NewGuid();
            entity.Code       = "123";
            entity.Plaincode  = "Test Test T";
            entity.Startdate  = System.DateTime.Now;
            entity.Enddate    = System.DateTime.Now;
            entity.Normdoc    = System.Guid.NewGuid();
            entity.Livestatus = "T";

            using (rt.fias.business.manager.IActualStatusManager actualStatusManager = ObjectFactory.GetInstance <IActualStatusManager>())
            {
                var          all       = actualStatusManager.GetAll(1);
                ActualStatus entityRef = null;
                if (all.Count > 0)
                {
                    entityRef = all[0];
                }

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

                entity.ACTSTATUS = entityRef;
            }

            using (rt.fias.business.manager.ICenterStatusManager centerStatusManager = ObjectFactory.GetInstance <ICenterStatusManager>())
            {
                var          all       = centerStatusManager.GetAll(1);
                CenterStatus entityRef = null;
                if (all.Count > 0)
                {
                    entityRef = all[0];
                }

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

                entity.CENTSTATUS = entityRef;
            }

            using (rt.fias.business.manager.ICurrentStatusManager currentStatusManager = ObjectFactory.GetInstance <ICurrentStatusManager>())
            {
                var           all       = currentStatusManager.GetAll(1);
                CurrentStatus entityRef = null;
                if (all.Count > 0)
                {
                    entityRef = all[0];
                }

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

                entity.CURRSTATUS = entityRef;
            }

            using (rt.fias.business.manager.IAObjectManager aObjectMember1Manager = ObjectFactory.GetInstance <IAObjectManager>())
            {
                entity.NEXT = null;
            }

            using (rt.fias.business.manager.IAObjectManager aObjectMember2Manager = ObjectFactory.GetInstance <IAObjectManager>())
            {
                entity.PREV = null;
            }

            using (rt.fias.business.manager.IOperationStatusManager operationStatusManager = ObjectFactory.GetInstance <IOperationStatusManager>())
            {
                var             all       = operationStatusManager.GetAll(1);
                OperationStatus entityRef = null;
                if (all.Count > 0)
                {
                    entityRef = all[0];
                }

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

                entity.OPERSTATUS = entityRef;
            }

            return(entity);
        }