You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.7 KiB
C#

1 year ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Mesnac.Action.Base;
using Mesnac.Controls.Base;
using System.Windows.Forms;
using Mesnac.Codd.Session;
namespace Mesnac.Action.Default.SynchroData
{
public class LastRow : DatabaseAction, IAction
{
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须调用
#region 限定只对相同DataSource的数据表进行操作
string mcDataSourceID = String.Empty;
if (runtime.Sender is Mesnac.Controls.Base.IBaseControl)
{
mcDataSourceID = (runtime.Sender as Mesnac.Controls.Base.IBaseControl).MCDataSourceID;
}
#endregion
foreach (IBaseControl cgrid in GetAllMCControls())
{
if (!String.IsNullOrEmpty(mcDataSourceID) && cgrid.MCDataSourceID != mcDataSourceID)
{
continue;
}
DataGridView grid = runtime.Sender as DataGridView;
if (grid == null)
{
if (cgrid is DataGridView)
{
grid = cgrid as DataGridView;
}
}
if (grid == null)
{
continue;
}
if (grid.Rows.Count > 0)
{
grid.Rows[grid.Rows.Count - 1].Selected = true;
}
if (runtime.Sender is DataGridView)
{
return;
}
}
}
}
}