/*
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.CmsServices.Exceptions;
using Everest.Library.ExtensionMethod;
using Everest.Library.Data.Rule;
namespace Everest.CmsServices.Models{
public class WorkflowSequenceQueried
{
public string RoleName { get; set; }
public int IntContentStatus { get; set; }
public string StepName { get; set; }
public bool ContentStatus
{
get
{
return ((ContentStatus)this.IntContentStatus) == Everest.CmsServices.Models.ContentStatus.Published;
}
}
}
public partial class Cms_WorkflowSequence
{
public Cms_WorkflowSequence()
{
this.UUID = Guid.NewGuid();
}
public static Cms_WorkflowSequence CreateCms_WorkflowSequence(IEverestCmsDataContext dataContext, Dictionary<string, string> dic)
{
Cms_WorkflowSequence workflowSequence = new Cms_WorkflowSequence();
workflowSequence.RoleName = dic["RoleName"];
if (StringExtensions.IsNullOrEmptyTrim(workflowSequence.RoleName))
{
throw new RuleViolationException(new RuleViolation[] { new RuleViolation("WorkflowName", "RoleName", string.Format(Resources.FieldIsRequired, "RoleName")) });
}
workflowSequence.StepName = dic["StepName"];
if (StringExtensions.IsNullOrEmptyTrim(workflowSequence.StepName))
{
throw new RuleViolationException(new RuleViolation[] { new RuleViolation("WorkflowName", "Status", string.Format(Resources.FieldIsRequired, "Status")) });
}
workflowSequence.ContentStatus = (int)Everest.CmsServices.Models.ContentStatus.Draft;
if (!StringExtensions.IsNullOrEmptyTrim(dic["ContentStatus"]))
{
if (bool.Parse(dic["ContentStatus"]))
{
workflowSequence.ContentStatus = (int)Everest.CmsServices.Models.ContentStatus.Published;
}
}
return workflowSequence;
}
}
}
|