Example #1
0
		private RepositoryResponse<bool> SaveParentPages(int id, MixCmsContext _context, IDbContextTransaction _transaction)
		{
			stackVariable0 = new RepositoryResponse<bool>();
			stackVariable0.set_IsSucceed(true);
			V_0 = stackVariable0;
			V_1 = this.get_Pages().GetEnumerator();
			try
			{
				while (V_1.MoveNext())
				{
					V_2 = V_1.get_Current();
					V_2.set_PostId(id);
					V_2.set_Description(this.get_Title());
					V_2.set_Image(this.get_ThumbnailUrl());
					V_2.set_Status(2);
					if (!V_2.get_IsActived())
					{
						V_4 = V_2.RemoveModel(false, _context, _transaction);
						V_0.set_IsSucceed(V_4.get_IsSucceed());
						if (V_0.get_IsSucceed())
						{
							dummyVar1 = ViewModelBase<MixCmsContext, MixPage, Mix.Cms.Lib.ViewModels.MixPages.ReadListItemViewModel>.Repository.RemoveCache(V_2.get_Page().get_Model(), _context, _transaction);
						}
						else
						{
							V_0.set_Exception(V_4.get_Exception());
							this.get_Errors().AddRange(V_4.get_Errors());
						}
					}
					else
					{
						V_3 = V_2.SaveModel(false, _context, _transaction);
						V_0.set_IsSucceed(V_3.get_IsSucceed());
						if (V_0.get_IsSucceed())
						{
							dummyVar0 = ViewModelBase<MixCmsContext, MixPage, Mix.Cms.Lib.ViewModels.MixPages.ReadListItemViewModel>.Repository.RemoveCache(V_2.get_Page().get_Model(), _context, _transaction);
						}
						else
						{
							V_0.set_Exception(V_3.get_Exception());
							this.get_Errors().AddRange(V_3.get_Errors());
						}
					}
				}
			}
			finally
			{
				((IDisposable)V_1).Dispose();
			}
			return V_0;
		}
Example #2
0
		private RepositoryResponse<bool> SaveRelatedPost(int id, MixCmsContext _context, IDbContextTransaction _transaction)
		{
			stackVariable0 = new RepositoryResponse<bool>();
			stackVariable0.set_IsSucceed(true);
			V_0 = stackVariable0;
			V_1 = this.get_PostNavs().GetEnumerator();
			try
			{
				while (V_1.MoveNext())
				{
					V_2 = V_1.get_Current();
					V_2.set_SourceId(id);
					V_2.set_Status(2);
					V_2.set_Specificulture(this.get_Specificulture());
					if (!V_2.get_IsActived())
					{
						V_4 = V_2.RemoveModel(false, _context, _transaction);
						V_0.set_IsSucceed(V_4.get_IsSucceed());
						if (V_0.get_IsSucceed())
						{
							dummyVar1 = ViewModelBase<MixCmsContext, MixPost, Mix.Cms.Lib.ViewModels.MixPosts.ReadViewModel>.Repository.RemoveCache(V_2.get_RelatedPost().get_Model(), null, null);
						}
						else
						{
							V_0.set_Exception(V_4.get_Exception());
							this.get_Errors().AddRange(V_4.get_Errors());
						}
					}
					else
					{
						V_3 = V_2.SaveModel(false, _context, _transaction);
						V_0.set_IsSucceed(V_3.get_IsSucceed());
						if (V_0.get_IsSucceed())
						{
							dummyVar0 = ViewModelBase<MixCmsContext, MixPost, Mix.Cms.Lib.ViewModels.MixPosts.ReadViewModel>.Repository.RemoveCache(V_2.get_RelatedPost().get_Model(), null, null);
						}
						else
						{
							V_0.set_Exception(V_3.get_Exception());
							this.get_Errors().AddRange(V_3.get_Errors());
						}
					}
				}
			}
			finally
			{
				((IDisposable)V_1).Dispose();
			}
			return V_0;
		}
Example #3
0
		private RepositoryResponse<bool> SaveMedias(int id, MixCmsContext _context, IDbContextTransaction _transaction)
		{
			stackVariable0 = new RepositoryResponse<bool>();
			stackVariable0.set_IsSucceed(true);
			V_0 = stackVariable0;
			V_1 = this.get_MediaNavs().GetEnumerator();
			try
			{
				while (V_1.MoveNext())
				{
					V_2 = V_1.get_Current();
					V_2.set_PostId(id);
					V_2.set_Specificulture(this.get_Specificulture());
					if (!V_2.get_IsActived())
					{
						ViewModelHelper.HandleResult<MixPostMedia>(V_2.RemoveModel(false, _context, _transaction), ref V_0);
					}
					else
					{
						ViewModelHelper.HandleResult<Mix.Cms.Lib.ViewModels.MixPostMedias.ReadViewModel>(V_2.SaveModel(false, _context, _transaction), ref V_0);
					}
				}
			}
			finally
			{
				((IDisposable)V_1).Dispose();
			}
			return V_0;
		}
Example #4
0
		private RepositoryResponse<bool> SaveAttribute(int parentId, MixCmsContext context, IDbContextTransaction transaction)
		{
			stackVariable0 = new RepositoryResponse<bool>();
			stackVariable0.set_IsSucceed(true);
			V_0 = stackVariable0;
			this.get_AttributeData().set_ParentId(parentId.ToString());
			this.get_AttributeData().set_ParentType(2);
			ViewModelHelper.HandleResult<Mix.Cms.Lib.ViewModels.MixRelatedAttributeDatas.UpdateViewModel>(this.get_AttributeData().SaveModel(true, context, transaction), ref V_0);
			V_1 = this.get_SysCategories().GetEnumerator();
			try
			{
				while (V_1.MoveNext())
				{
					V_2 = V_1.get_Current();
					if (!V_0.get_IsSucceed())
					{
						continue;
					}
					V_2.set_ParentId(parentId.ToString());
					V_2.set_ParentType(2);
					V_2.set_Specificulture(this.get_Specificulture());
					ViewModelHelper.HandleResult<Mix.Cms.Lib.ViewModels.MixRelatedAttributeDatas.FormViewModel>(V_2.SaveModel(false, context, transaction), ref V_0);
				}
			}
			finally
			{
				((IDisposable)V_1).Dispose();
			}
			V_1 = this.get_SysTags().GetEnumerator();
			try
			{
				while (V_1.MoveNext())
				{
					V_3 = V_1.get_Current();
					if (!V_0.get_IsSucceed())
					{
						continue;
					}
					V_3.set_ParentId(parentId.ToString());
					V_3.set_ParentType(2);
					V_3.set_Specificulture(this.get_Specificulture());
					ViewModelHelper.HandleResult<Mix.Cms.Lib.ViewModels.MixRelatedAttributeDatas.FormViewModel>(V_3.SaveModel(false, context, transaction), ref V_0);
				}
			}
			finally
			{
				((IDisposable)V_1).Dispose();
			}
			return V_0;
		}
Example #5
0
		public override RepositoryResponse<bool> SaveSubModels(MixAttributeSet parent, MixCmsContext _context, IDbContextTransaction _transaction)
		{
			stackVariable0 = new RepositoryResponse<bool>();
			stackVariable0.set_IsSucceed(true);
			V_0 = stackVariable0;
			if (V_0.get_IsSucceed())
			{
				V_1 = this.get_Fields().GetEnumerator();
				try
				{
					while (V_1.MoveNext())
					{
						V_2 = V_1.get_Current();
						if (!V_0.get_IsSucceed())
						{
							break;
						}
						V_2.set_AttributeSetName(parent.get_Name());
						V_2.set_AttributeSetId(parent.get_Id());
						ViewModelHelper.HandleResult<Mix.Cms.Lib.ViewModels.MixAttributeFields.UpdateViewModel>(V_2.SaveModel(false, _context, _transaction), ref V_0);
					}
				}
				finally
				{
					((IDisposable)V_1).Dispose();
				}
			}
			return V_0;
		}
Example #6
0
		public override RepositoryResponse<bool> SaveSubModels(MixPage parent, MixCmsContext _context = null, IDbContextTransaction _transaction = null)
		{
			stackVariable0 = new RepositoryResponse<bool>();
			stackVariable0.set_IsSucceed(true);
			V_0 = stackVariable0;
			ViewModelHelper.HandleResult<Mix.Cms.Lib.ViewModels.MixTemplates.UpdateViewModel>(this.get_View().SaveModel(true, _context, _transaction), ref V_0);
			if (V_0.get_IsSucceed() && this.get_Master() != null)
			{
				ViewModelHelper.HandleResult<Mix.Cms.Lib.ViewModels.MixTemplates.UpdateViewModel>(this.get_Master().SaveModel(true, _context, _transaction), ref V_0);
			}
			if (V_0.get_IsSucceed() && this.get_UrlAliases() != null)
			{
				V_1 = this.get_UrlAliases().GetEnumerator();
				try
				{
					while (V_1.MoveNext())
					{
						V_2 = V_1.get_Current();
						if (!V_0.get_IsSucceed())
						{
							break;
						}
						V_2.set_SourceId(parent.get_Id().ToString());
						V_2.set_Type(0);
						V_2.set_Specificulture(this.get_Specificulture());
						ViewModelHelper.HandleResult<Mix.Cms.Lib.ViewModels.MixUrlAliases.UpdateViewModel>(V_2.SaveModel(false, _context, _transaction), ref V_0);
					}
				}
				finally
				{
					((IDisposable)V_1).Dispose();
				}
			}
			if (V_0.get_IsSucceed())
			{
				V_4 = this.get_ModuleNavs().GetEnumerator();
				try
				{
					while (V_4.MoveNext())
					{
						V_5 = V_4.get_Current();
						V_5.set_PageId(parent.get_Id());
						if (!V_5.get_IsActived())
						{
							ViewModelHelper.HandleResult<MixPageModule>(V_5.RemoveModel(false, _context, _transaction), ref V_0);
						}
						else
						{
							ViewModelHelper.HandleResult<Mix.Cms.Lib.ViewModels.MixPageModules.ReadMvcViewModel>(V_5.SaveModel(false, _context, _transaction), ref V_0);
						}
					}
				}
				finally
				{
					((IDisposable)V_4).Dispose();
				}
			}
			return V_0;
		}