Ejemplo n.º 1
0
        /// <summary>
        /// 创建标准动作
        /// </summary>
        /// <typeparam name="T">继承自TopBasePoco的类</typeparam>
        /// <typeparam name="V">继承自ISearcher的类</typeparam>
        /// <param name="self">self</param>
        /// <param name="controllerName">动作的Controller</param>
        /// <param name="actionName">actionName</param>
        /// <param name="name">动作名,默认为‘新建’</param>
        /// <param name="dialogTitle">弹出窗口的标题</param>
        /// <param name="paraType">paraType</param>
        /// <param name="areaName">域名</param>
        /// <param name="dialogWidth">弹出窗口的宽度</param>
        /// <param name="dialogHeight">弹出窗口的高度</param>
        /// <param name="buttonId">Button的id  默认自动生成</param>
        /// <param name="whereStr">whereStr</param>
        /// <returns>列表动作</returns>
        /// <remarks>
        /// 根据标准动作类型,创建默认属性的标准动作
        /// </remarks>
        public static GridAction MakeAction <T, V>(this IBasePagedListVM <T, V> self
                                                   , string controllerName
                                                   , string actionName
                                                   , string name
                                                   , string dialogTitle
                                                   , GridActionParameterTypesEnum paraType
                                                   , string areaName  = null
                                                   , int?dialogWidth  = null
                                                   , int?dialogHeight = null
                                                   , string buttonId  = null
                                                   , params Expression <Func <T, object> >[] whereStr)
            where T : TopBasePoco
            where V : ISearcher
        {
            var iconcls = string.Empty;

            var list = new List <string>();

            foreach (var item in whereStr)
            {
                list.Add(PropertyHelper.GetPropertyName(item));
            }

            return(new GridAction
            {
                ButtonId = buttonId,
                Name = name,
                DialogTitle = dialogTitle,
                Area = areaName,
                ControllerName = controllerName,
                ActionName = actionName,
                ParameterType = paraType,

                IconCls = iconcls,
                DialogWidth = dialogWidth ?? 800,
                DialogHeight = dialogHeight,
                ShowDialog = true,
                whereStr = list.ToArray()
            });
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 动作类型
 /// </summary>
 /// <param name="self"></param>
 /// <param name="parameterType"></param>
 /// <returns></returns>
 public static GridAction SetParameterType(this GridAction self, GridActionParameterTypesEnum parameterType)
 {
     self.ParameterType = parameterType;
     return(self);
 }