/*
Kooboo is a content management system based on ASP.NET MVC framework. Copyright 2009 Yardi Technology Limited.
This program is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program.
If not, see http://www.kooboo.com/gpl3/.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Everest.Library.Data;
using Everest.Library.Data.Rule;
using Everest.Library.Data.Entity;
namespace Everest.CmsServices.Models{
partial class Cms_SearchSetting : IRuleEntity
{
public Cms_SearchSetting()
{
this.UUID = Guid.NewGuid();
}
#region Properties
public Guid FolderUUIDFromReference
{
get
{
return this.Cms_FolderReference.EntityKey.GetKeyValue<Guid>("UUID");
}
}
#endregion
#region IRuleEntity Members
public IEnumerable<RuleViolation> GetRuleViolations()
{
var dataContext = EverestCmsEntities.GetDataContext();
List<RuleViolation> violations = new List<RuleViolation>();
this.aspnet_ApplicationsReference.Load(this.aspnet_Applications, this.EntityState);
if (dataContext.Cms_SearchSetting.Where(s => s.Cms_Folder.UUID == this.Cms_Folder.UUID
&& s.aspnet_Applications.ApplicationName == this.aspnet_Applications.ApplicationName && s.UUID != this.UUID).Exists())
{
violations.Add(new RuleViolation("Folder", this.Cms_Folder.FolderName, Resources.SearchSettingAlreadyExists));
}
return violations;
}
#endregion
}
}
|