|
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using System.Query;
using System.Data.DLinq;
using DashboardDataAccess;
namespace DashboardBusiness.Activities
{
public partial class CreateNewPageActivity : Activity
{
public CreateNewPageActivity()
{
InitializeComponent();
}
private static DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(String), typeof(CreateNewPageActivity));
public string Title
{
get { return (string)base.GetValue(TitleProperty); }
set { base.SetValue(TitleProperty, value); }
}
private static DependencyProperty UserIdProperty = DependencyProperty.Register("UserId", typeof(Guid), typeof(CreateNewPageActivity));
public Guid UserId
{
get { return (Guid)base.GetValue(UserIdProperty); }
set { base.SetValue(UserIdProperty, value); }
}
private static DependencyProperty NewPageIdProperty = DependencyProperty.Register("NewPageId", typeof(int), typeof(CreateNewPageActivity));
public int NewPageId
{
get { return (int)base.GetValue(NewPageIdProperty); }
set { base.SetValue(NewPageIdProperty, value); }
}
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
DashboardData db = DatabaseHelper.GetDashboardData();
var newPage = new Page();
newPage.UserId = UserId;
newPage.Title = Title;
newPage.CreatedDate = DateTime.Now;
newPage.LastUpdate = DateTime.Now;
db.Pages.Add(newPage);
db.SubmitChanges(ConflictMode.FailOnFirstConflict);
NewPageId = newPage.ID;
//NewPageId = 0;
return ActivityExecutionStatus.Closed;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.