예제 #1
0
 public static void OnUpdateFMainDataGridView(AddUpdateDelete aud, TableFileInfo tableFileInfo, bool isErr = false, bool clearRows = false)
 {
     if (UpdateDataGridViewEvent != null)
     {
         UpdateDataGridViewEvent(aud, tableFileInfo, isErr, clearRows);
     }
 }
예제 #2
0
        private void cbo_dbList_SelectedIndexChanged(object sender, EventArgs e)
        {
            bool checkValue = ((datagridviewCheckboxHeaderCell)this.dv_tableList.Columns[0].HeaderCell).Checked;

            if (string.IsNullOrEmpty(cbo_dbList.Text))
            {
                MessageBox.Show("请选择数据库!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                string    sql  = "select table_name from " + this.cbo_dbList.Text.Trim() + ".information_schema.tables order by table_name asc";
                string    msg  = null;
                ArrayList list = this._dbHelper.GetDataByConAndSql(_strCon, sql, out msg);
                if ("登录成功" == msg)
                {
                    this.dv_tableList.Rows.Clear();
                    foreach (string s in list)
                    {
                        TableFileInfo model = new TableFileInfo();
                        model.CheckValue = checkValue;
                        model.TableName  = s;
                        model.FilePath   = this.tb_dirPath.Text + "\\" + s + ".cs";
                        model.FileStatus = "未生成";
                        EventListener.OnUpdateFMainDataGridView(AddUpdateDelete.Add, model);
                    }
                }
            }
        }
예제 #3
0
    public static void Export(string xlsPath)
    {
        var extension = Path.GetExtension(xlsPath);

        if (extension != ".xls")
        {
            return;
        }

        var fileName = Path.GetFileName(xlsPath);
        var types    = TableFileInfo.GetTableTypes(fileName);

        if (types == null)
        {
            throw new InvalidOperationException("文件" + fileName + "没有相应的数据类型,无法导出tbl");
        }

        foreach (var type in types)
        {
            MethodInfo method  = typeof(TblExporter).GetMethod("ExportImpl", BindingFlags.NonPublic | BindingFlags.Static, null, new Type[] { typeof(string) }, null);
            MethodInfo generic = method.MakeGenericMethod(type);
            generic.Invoke(null, new object[] { xlsPath });
        }
    }