Example #1
0
        public static void BindTable(IDialogVisualizerService windowService, MDataTable dt, string title)
        {
            if (dt == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(title))
            {
                title = string.Format("TableName : {0}    Rows: {1}    Columns: {2}", dt.TableName, dt.Rows.Count, dt.Columns.Count);
            }
            Form         form = FormCreate.CreateForm(title);
            DataGridView dg   = FormCreate.CreateGrid(form);

            try
            {
                if (dt.Rows.Count > 200)
                {
                    dt = dt.Select(200, null);
                }
                //插入行号
                dt.Columns.Insert(0, new MCellStruct("[No.]", System.Data.SqlDbType.Int));
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dt.Rows[i][0].Value = i + 1;
                }
                dt.Bind(dg);
                AutoSizeColumn(dg);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }

            windowService.ShowDialog(form);
        }
Example #2
0
        override protected void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            string     json = objectProvider.GetObject() as string;
            MDataTable dt   = MDataTable.CreateFrom(JsonHelper.ToJson(json));

            FormCreate.BindTable(windowService, dt, null);
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            MDataTable dt = objectProvider.GetObject() as DataTable;

            //MDataTable dt = objectProvider.GetObject() as MDataRowCollection;
            FormCreate.BindTable(windowService, dt, null);
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            MDataTable dt    = objectProvider.GetObject() as DataTable;
            string     title = string.Format("TableName : {0}    Columns£º {1}", dt.TableName, dt.Columns.Count);

            FormCreate.BindTable(windowService, dt, title);
        }
Example #5
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            MDataRow row = objectProvider.GetObject() as MDataRow;

            if (row != null)
            {
                MDataTable dt    = row.ToTable();
                string     title = string.Format("TableName : {0}    Columns£º {1}", row.TableName, row.Columns.Count);
                FormCreate.BindTable(windowService, dt, title);
            }
        }
        override protected void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            MDataTable dt = objectProvider.GetObject() as MDataTable;

            if (dt != null)
            {
                try
                {
                    FormCreate.BindTable(windowService, dt, null);
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.Message);
                }
            }
        }
        override protected void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            MDataTable dt = MDataTable.CreateFrom(objectProvider.GetObject() as string);

            FormCreate.BindTable(windowService, dt, null);
        }