|
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.Data.DLinq;
using System.Query;
using DashboardDataAccess;
namespace DashboardBusiness.Activities
{
public partial class AddWidgetOnPage : System.Workflow.ComponentModel.Activity
{
public AddWidgetOnPage()
{
InitializeComponent();
}
private static DependencyProperty PageIdProperty = DependencyProperty.Register("PageId", typeof(int), typeof(AddWidgetOnPage));
public int PageId
{
get { return (int)base.GetValue(PageIdProperty); }
set { base.SetValue(PageIdProperty, value); }
}
private static DependencyProperty WidgetIdProperty = DependencyProperty.Register("WidgetId", typeof(int), typeof(AddWidgetOnPage));
public int WidgetId
{
get { return (int)base.GetValue(WidgetIdProperty); }
set { base.SetValue(WidgetIdProperty, value); }
}
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
Widget w = DatabaseHelper.GetDashboardData().Widgets.Single(a => a.ID == WidgetId);
WidgetInstance wi = new WidgetInstance();
wi.Title = w.Name;
wi.PageId = PageId;
wi.CreatedDate = wi.LastUpdate = DateTime.Now;
wi.VersionNo = 1;
wi.State = string.Empty;
wi.WidgetId = w.ID;
wi.Expanded = true;
wi.State = w.DefaultState;
DatabaseHelper.Insert<WidgetInstance>(wi);
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.