예제 #1
0
        private void exportGiaoDan()
        {
            Memory.ClearError();

            provider = new DataProvider(Path.Combine(Memory.AppPath, Memory.DbName), Memory.DbUser, Memory.DbPassword);

            tblGiaoDan = provider.GetData("SELECT g.*, gh.TenGiaoHo FROM GiaoDan g LEFT JOIN GiaoHo gh ON g.MaGiaoHo=gh.MaGiaoHo ORDER BY g.MaGiaoHo ASC, g.MaGiaoDan ASC");
            for (int i = 0; i < tblGiaoDan.Columns.Count; i++)
            {
                DataColumn col = tblGiaoDan.Columns[i];
                if (col.DataType == typeof(bool))
                {
                    tblGiaoDan.Columns.Add(string.Concat("_", col.ColumnName));
                }
            }
            foreach (DataRow row in tblGiaoDan.Rows)
            {
                foreach (DataColumn col in tblGiaoDan.Columns)
                {
                    if (col.DataType == typeof(bool))
                    {
                        row[string.Concat("_", col.ColumnName)] = (bool)row[col] ? "X" : "";
                    }
                }
            }
            GxGrid grid = new GxGrid();

            grid.DataSource = tblGiaoDan;
            formatGrid(grid, tblGiaoDan);
            grid.Print();
        }
예제 #2
0
        private void formatGrid(GxGrid grid, DataTable tbl)
        {
            grid.VisualStyle         = Janus.Windows.GridEX.VisualStyle.Office2003;
            grid.RootTable           = new Janus.Windows.GridEX.GridEXTable();
            grid.RootTable.RowHeight = 20;
            grid.ColumnAutoResize    = false;

            #region Define column

            Dictionary <string, string> dicColumnText;
            Dictionary <string, int>    dicColumnWidth;
            GetColumnInfo(out dicColumnText, out dicColumnWidth);
            #endregion

            foreach (KeyValuePair <string, string> col in dicColumnText)
            {
                Janus.Windows.GridEX.GridEXColumn column = grid.AddColumn(col.Key, Janus.Windows.GridEX.ColumnType.Text, dicColumnWidth[col.Key], Janus.Windows.GridEX.ColumnBoundMode.Bound, col.Value, Janus.Windows.GridEX.FilterEditType.Combo);
            }
        }