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.
70 lines
3.1 KiB
C#
70 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using System.Data;
|
|
using ICSharpCode.Core;
|
|
using Mesnac.Action.Base;
|
|
using Mesnac.Codd.Session;
|
|
using Mesnac.Action.Default.Entity;
|
|
|
|
namespace Mesnac.Action.Default.Purview.BasUser
|
|
{
|
|
/// <summary>
|
|
/// 查询用户业务
|
|
/// </summary>
|
|
public class SelectAction : DatabaseAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime); //必须调用
|
|
ICSharpCode.Core.LoggingService<SelectAction>.Debug("用户信息-查询...");
|
|
|
|
FrmInsert frmInsert = new FrmInsert(ActionType.Query);
|
|
DialogResult result = frmInsert.ShowDialog();
|
|
if (result == DialogResult.OK)
|
|
{
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
dbHelper.ClearParameter();
|
|
StringBuilder sbSql = new StringBuilder("SELECT TA.*,TB.RoleName,TC.ClassName,TD.ItemName FROM BasUser TA LEFT JOIN BasRole TB ON TA.RoleGUID=TB.GUID LEFT JOIN PptClass TC ON TA.ClassID = TC.ClassID LEFT JOIN SysCode TD ON TA.DeleteFlag=TD.ItemCode AND TD.TypeID='YesNo' WHERE 1=1 ");
|
|
if (!String.IsNullOrEmpty(frmInsert.UserName))
|
|
{
|
|
sbSql.Append(" and TA.UserName like @UserName");
|
|
dbHelper.AddParameter("@UserName", "%" + frmInsert.UserName + "%");
|
|
}
|
|
if (!String.IsNullOrEmpty(frmInsert.RoleGUID))
|
|
{
|
|
sbSql.Append(" and TA.RoleGUID = @RoleGUID");
|
|
dbHelper.AddParameter("@RoleGUID", frmInsert.RoleGUID);
|
|
}
|
|
if (frmInsert.ClassID != 0)
|
|
{
|
|
sbSql.Append(" and TA.ClassID = @ClassID");
|
|
dbHelper.AddParameter("@ClassID", frmInsert.ClassID);
|
|
}
|
|
if (!String.IsNullOrEmpty(frmInsert.RealName))
|
|
{
|
|
sbSql.Append(" and TA.RealName like @RealName");
|
|
dbHelper.AddParameter("@RealName", "%" + frmInsert.RealName + "%");
|
|
}
|
|
sbSql.Append(" ORDER BY CAST(TA.SeqIndex AS INT)");
|
|
dbHelper.CommandText = sbSql.ToString();
|
|
dbHelper.CommandType = System.Data.CommandType.Text;
|
|
DataTable table = dbHelper.ToDataTable();
|
|
|
|
//刷新DataGridView数据
|
|
DbMCControl dgBasUser = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "BasUser").FirstOrDefault();
|
|
if (dgBasUser == null || !(dgBasUser.BaseControl is DataGridView))
|
|
{
|
|
ICSharpCode.Core.LoggingService<InsertAction>.Warn("{用户信息-查询} 缺少用户DataGridView控件...");
|
|
runtime.IsReturn = false;
|
|
return;
|
|
}
|
|
dgBasUser.BaseControl.BindDataSource = table;
|
|
}
|
|
}
|
|
}
|
|
}
|