Example #1
0
 public TableAction(string name, string url, TableActionType tableAction)
 {
     Name       = name;
     Url        = url;
     Type       = ActionLinkType.Link;
     ActionType = tableAction;
 }
Example #2
0
        public static TableAction ToLinkAction(string name, string url, ActionLinkType linkType,
                                               TableActionType tableActionType, Flaticon flaticon = Flaticon.Interface5)
        {
            var tableAction = new TableAction {
                Name       = name,
                Url        = url,
                IconType   = flaticon,
                Type       = linkType,
                ActionType = tableActionType
            };

            return(tableAction);
        }
Example #3
0
        public static TableAction ToLinkAction(string name, TableActionType tableActionType, Type formType,
                                               Flaticon flaticon = Flaticon.Interface5)
        {
            var tableAction = new TableAction {
                Name       = name,
                FormType   = formType.Name,
                IconType   = flaticon,
                Type       = ActionLinkType.Dialog,
                ActionType = tableActionType
            };

            return(tableAction);
        }
Example #4
0
        /// <summary>
        /// 私有方法,用来提供以用Model实体来增加、删除、修改表记录时的参数列表
        /// </summary>
        /// <typeparam name="T">要执行的实体类型</typeparam>
        /// <param name="t">Model实体</param>
        /// <returns> 参数列表</returns>
        private static IList <IDataParameter> GetActionParameter <T>(T t, TableActionType action) where T : new()
        {
            Type type = typeof(T);
            List <IDataParameter> parlist = new List <IDataParameter>();

            foreach (PropertyInfo info in type.GetProperties())
            {
                if (action == TableActionType.Insert)
                {
                    object[] columbute = info.GetCustomAttributes(typeof(DataSource.ColumnAttribute), false);
                    if (columbute.Length > 0)
                    {
                        if ((columbute[0] as DataSource.ColumnAttribute).IsIdentity)
                        {
                            continue;//如果是自增长就不处理这个属性
                        }
                    }
                }
                object param = info.GetValue(t, null);
                if (param == null)
                {
                    param = DBNull.Value;
                }
                switch (IDataSourceTypeFactory.DataSourceType)
                {
                case DataSourceType.SqlServer: parlist.Add(IDataParameterFactory.CreateParameterSingle(info.Name, param));
                    break;

                case DataSourceType.Oracl: parlist.Add(IDataParameterFactory.CreateParameterSingle(info.Name, param));
                    break;

                case DataSourceType.Access: parlist.Add(IDataParameterFactory.CreateParameterSingle(info.Name, param));
                    break;
                }
            }
            return(parlist);
        }
Example #5
0
 public MigrationTable()
 {
     Action = TableActionType.Migrate;
 }