using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web;
namespace WalkingTec.Mvvm.Core
{
#region 列表动作类型
///
/// 列表动作类型
///
public enum GridActionParameterTypesEnum
{
///
/// 不需要传递Id
///
NoId,
///
/// 只传递一个Id
///
SingleId,
///
/// 传递多个Id
///
MultiIds,
///
/// 只传递一个Id,但 Id 可能为null
///
SingleIdWithNull,
///
/// 传递多个 Id 或 null
///
MultiIdWithNull,
AddRow,
RemoveRow
}
#endregion
#region 标准列表动作
///
/// 标准列表动作
///
public enum GridActionStandardTypesEnum
{
Create,
Edit,
Delete,
SimpleDelete,
Details,
BatchEdit,
BatchDelete,
SimpleBatchDelete,
Import,
ExportExcel,
AddRow,
RemoveRow,
ActionsGroup
}
#endregion
#region 导出枚举
public enum ExportEnum
{
[Display(Name = "Excel")]
Excel = 0,
[Display(Name = "PDF")]
PDF = 1
}
#endregion
///
/// 列表动作类,负责处理列表动作条中的动作按钮
///
public class GridAction
{
#region Action属性
///
/// 按钮Id,一般不需要设定,系统会自动生成唯一Id。如果设定请确保 Id 的唯一性
///
public string ButtonId { get; set; }
///
/// 按钮名称
///
public string Name { get; set; }
///
/// 弹出窗口的标题
///
public string DialogTitle { get; set; }
///
/// 如果不为null,则只运行这个变量设定的script,其他的属性都不起作用
///
public string OnClickFunc { get; set; }
///
/// 是否在每行都显示
///
public bool ShowInRow { get; set; }
///
/// 是否在工具栏上隐藏按钮
///
public bool HideOnToolBar { get; set; }
///
/// bind to a column name to deside whether or not to show this action
///
public string BindVisiableColName { get; set; }
///
/// additional css class of button
///
public string ButtonClass { get; set;}
///
/// if the dialog need to be maximax
///
public bool Max { get; set; }
///
/// If this action is to download a file
///
public bool IsDownload { get; set; }
#region 请求链接相关
///
/// 动作的Area
///
public string Area { get; set; }
public bool IsExport { get; set; }
///
/// 动作的Controller
///
public string ControllerName { get; set; }
///
/// 动作的Action
///
public string ActionName { get; set; }
public string Url
{
get
{
var rv = "";
if(string.IsNullOrEmpty(ControllerName) == false){
rv = $"/{HttpUtility.UrlEncode(ControllerName)}/{HttpUtility.UrlEncode(ActionName)}";
if (!string.IsNullOrEmpty(Area))
{
rv = $"/{HttpUtility.UrlEncode(Area)}{rv}";
}
if (!string.IsNullOrEmpty(QueryString))
{
rv = $"{rv}?{QueryString}";
}
else
{
rv = $"{rv}?1=1"; ;
}
}
return rv;
}
}
#endregion
///
/// 是否跳转到新页面
///
public bool IsRedirect { get; set; }
///
/// 弹出问询框
///
public string PromptMessage { get; set; }
///
/// 动作类型
///
public GridActionParameterTypesEnum ParameterType { get; set; }
public bool ForcePost { get; set; }
#endregion
#region 暂时无用
///
/// 是否可以resizable
///
public bool Resizable { get; set; }
///
/// 动作图标css
///
public string IconCls { get; set; }
///
/// 动作的QueryString
///
public string QueryString { get; set; }
///
/// 弹出窗口的宽度
///
public int? DialogWidth { get; set; }
///
/// 弹出窗口的高度
///
public int? DialogHeight { get; set; }
///
/// 是否需要弹出窗口
///
public bool ShowDialog { get; set; }
///
/// 如果设定了SubActions,则代表需要用SplitButton的形式展示,主GridAction将不起作用
///
public List SubActions { get; set; }
public string[] whereStr { get; set; }
#endregion
}
}