|
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections.Generic;
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 ReorderWidgetInstanceOnColumnActivity : System.Workflow.ComponentModel.Activity
{
public ReorderWidgetInstanceOnColumnActivity()
{
InitializeComponent();
}
private static DependencyProperty PageIdProperty = DependencyProperty.Register("PageId", typeof(int), typeof(ReorderWidgetInstanceOnColumnActivity));
public int PageId
{
get { return (int)base.GetValue(PageIdProperty); }
set { base.SetValue(PageIdProperty, value); }
}
private static DependencyProperty ColumnNoProperty = DependencyProperty.Register("ColumnNo", typeof(int), typeof(ReorderWidgetInstanceOnColumnActivity));
public int ColumnNo
{
get { return (int)base.GetValue(ColumnNoProperty); }
set { base.SetValue(ColumnNoProperty, value); }
}
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
var db = DatabaseHelper.GetDashboardData();
var query = from wi in db.WidgetInstances
where wi.PageId == PageId && wi.ColumnNo == ColumnNo
orderby wi.OrderNo
select wi;
List<WidgetInstance> list = query.ToList();
int orderNo = 0;
foreach( WidgetInstance wi in list )
{
wi.OrderNo = orderNo ++;
}
db.SubmitChanges();
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.