예제 #1
0
        /// <summary>
        /// Добавляет новый сайт
        /// </summary>
        /// <param name="site">информация о сайте</param>
        /// <returns>информация о сайте</returns>
        internal static Site Save(Site site)
        {
            using (var scope = new QPConnectionScope())
            {
                if (QPContext.DatabaseType == DatabaseType.SqlServer)
                {
                    ChangeInsertAccessTriggerState(false);
                    ChangeInsertDefaultTriggerState(false);
                    DefaultRepository.TurnIdentityInsertOn(EntityTypeCode.Site, site);
                }

                var fieldValues = site.QpPluginFieldValues;
                var result      = DefaultRepository.Save <Site, SiteDAL>(site);

                CommonSecurity.CreateSiteAccess(scope.DbConnection, result.Id);
                CreateDefaultStatuses(result);
                CreateDefaultNotificationTemplate(result);
                CreateDefaultGroup(result);
                UpdatePluginValues(fieldValues, result.Id);

                if (QPContext.DatabaseType == DatabaseType.SqlServer)
                {
                    DefaultRepository.TurnIdentityInsertOff(EntityTypeCode.Site);
                    ChangeInsertAccessTriggerState(true);
                    ChangeInsertDefaultTriggerState(true);
                }

                return(result);
            }
        }
예제 #2
0
        internal static Field Save(Field item)
        {
            DefaultRepository.TurnIdentityInsertOn(EntityTypeCode.Field, item);
            var newItem = DefaultRepository.Save <Field, FieldDAL>(item);

            DefaultRepository.TurnIdentityInsertOff(EntityTypeCode.Field);
            return(newItem);
        }
예제 #3
0
        /// <summary>
        /// Добавляет новый виртуальный контент
        /// </summary>
        internal static Content Save(Content content)
        {
            DefaultRepository.TurnIdentityInsertOn(EntityTypeCode.Content, content);
            var newContent = DefaultRepository.Save <Content, ContentDAL>(content);

            DefaultRepository.TurnIdentityInsertOff(EntityTypeCode.Content);
            return(newContent);
        }
예제 #4
0
        internal static StatusType SaveProperties(StatusType statusType)
        {
            DefaultRepository.TurnIdentityInsertOn(EntityTypeCode.StatusType);
            var result = DefaultRepository.Save <StatusType, StatusTypeDAL>(statusType);

            DefaultRepository.TurnIdentityInsertOff(EntityTypeCode.StatusType);
            return(result);
        }
예제 #5
0
        internal static Notification SaveProperties(Notification notification)
        {
            DefaultRepository.TurnIdentityInsertOn(EntityTypeCode.Notification, notification);
            var result = DefaultRepository.Save <Notification, NotificationsDAL>(notification);

            DefaultRepository.TurnIdentityInsertOff(EntityTypeCode.Notification);
            return(result);
        }
예제 #6
0
        internal static VisualEditorStyle SaveStyleProperties(VisualEditorStyle visualEditorStyle)
        {
            DefaultRepository.TurnIdentityInsertOn(EntityTypeCode.VisualEditorStyle, visualEditorStyle);
            var result = DefaultRepository.Save <VisualEditorStyle, VeStyleDAL>(visualEditorStyle);

            DefaultRepository.TurnIdentityInsertOff(EntityTypeCode.VisualEditorStyle);
            return(result);
        }
예제 #7
0
        /// <summary>
        /// Добавляет новый сайт
        /// </summary>
        /// <param name="site">информация о сайте</param>
        /// <returns>информация о сайте</returns>
        internal static Site Save(Site site)
        {
            DefaultRepository.TurnIdentityInsertOn(EntityTypeCode.Site, site);
            var result = DefaultRepository.Save <Site, SiteDAL>(site);

            DefaultRepository.TurnIdentityInsertOff(EntityTypeCode.Site);
            return(result);
        }
예제 #8
0
        internal static BllObject SaveObjectProperties(BllObject bllObject)
        {
            var result = DefaultRepository.Save <BllObject, ObjectDAL>(bllObject);

            if (bllObject.IsObjectContainerType)
            {
                bllObject.Container.ObjectId = result.Id;
                result.Container             = SaveContainer(bllObject.Container);
            }
            else if (bllObject.IsObjectFormType)
            {
                bllObject.ContentForm.ObjectId = result.Id;
                result.ContentForm             = SaveContentForm(bllObject.ContentForm);
            }

            if (bllObject.DefaultValues != null && bllObject.DefaultValues.Any())
            {
                SetDefaultValues(bllObject.DefaultValues, result.Id);
            }

            return(result);
        }
예제 #9
0
 public override Folder CreateInDb(Folder folder) => DefaultRepository.Save <SiteFolder, SiteFolderDAL>((SiteFolder)folder);
예제 #10
0
 public override Folder CreateInDb(Folder folder) => DefaultRepository.Save <ContentFolder, ContentFolderDAL>((ContentFolder)folder);
예제 #11
0
 internal static Page SavePageProperties(Page page) => DefaultRepository.Save <Page, PageDAL>(page);
예제 #12
0
 internal static PageTemplate SaveProperties(PageTemplate template) => DefaultRepository.Save <PageTemplate, PageTemplateDAL>(template);
예제 #13
0
 internal static ObjectFormat SaveObjectFormatProperties(ObjectFormat objectFormat) => DefaultRepository.Save <ObjectFormat, ObjectFormatDAL>(objectFormat);