Example #1
0
        public FormJoin(List<string> sqlTable, string connectionString)
            : this()
        {
            this.sqlTable = sqlTable;
            int oldX = 0;
            int oldY = 0;
            foreach (var table in sqlTable)
            {
                var tableEntity = new Table();
                tableEntity.Name = table;
                tableEntity.setTitle(table);
                DBService service = new DBService(connectionString);
                List<QColumn> columns = service.GetColumns(table);
                tableEntity.setSource(columns);

                Point p = new Point();
                p.X = panel1.Location.X + oldX;
                p.Y = panel1.Location.Y + oldY;

                tableEntity.Location = p;
                oldX += tableEntity.Width + 5;

                if (oldX > panel1.Width)
                {
                    oldX = 0;
                    oldY += tableEntity.Height + 5;
                }
                tableEntity.MouseDown += new MouseEventHandler(Control_MouseDown);
                tableEntity.MouseMove += new MouseEventHandler(Control_MouseMove);
                tableEntity.MouseUp += new MouseEventHandler(Control_MouseUp);

                panel1.Controls.Add(tableEntity);
            }
            panel1.Invalidate();
        }
 /// <summary>
 /// An overloading constructor that accept a selected database and a connection string
 /// </summary>
 /// <param name="selectedDatabase">This is passed from the FormConectServer. We need this for our query statement that query the available tables in a database</param>
 /// <param name="connectionString">This is a entire connection string. We need this to make a connection to our server</param>
 public FormColumnSelection(string selectedDatabase, string connectionString)
 {
     InitializeComponent();
     //begin showing the splashing screen
     BackgroundWorker bw = new BackgroundWorker();
     bw.WorkerSupportsCancellation = true;
     bw.DoWork += new DoWorkEventHandler(bw_DoWork);
     bw.RunWorkerAsync();
     //load the real thing
     this.selectedDatabase = selectedDatabase;
     this.connectionString = connectionString;
     service = new DBService(connectionString);
     onLoadForm(); //end load real thing
     bw.CancelAsync(); //close the splash screen
 }