Пример #1
0
        /// <summary>
        /// Sets the sample customization settings.
        /// </summary>
        private void SampleCustomization()
        {
            #region SfDataGrid settings
            sfDataGrid1.ThemeName                = "Office2016Colorful";
            sfDataGrid1.ShowRowHeader            = true;
            sfDataGrid1.AllowFiltering           = true;
            this.sfDataGrid1.AllowGrouping       = true;
            this.sfDataGrid1.ShowGroupDropArea   = true;
            this.sfDataGrid1.AutoGenerateColumns = false;
            this.sfDataGrid1.AutoSizeColumnsMode = AutoSizeColumnsMode.Fill;

            OrderInfoRepository orderInfo = new OrderInfoRepository();
            this.sfDataGrid1.DataSource = orderInfo.GetOrdersDetails(30);
            this.sfDataGrid1.Columns.Add(new GridTextColumn()
            {
                MappingName = "OrderID", HeaderText = "Order ID"
            });
            this.sfDataGrid1.Columns.Add(new GridTextColumn()
            {
                MappingName = "CustomerID", HeaderText = "Customer ID"
            });
            this.sfDataGrid1.Columns.Add(new GridTextColumn()
            {
                MappingName = "ShipCity", HeaderText = "Ship City"
            });
            this.sfDataGrid1.Columns.Add(new GridTextColumn()
            {
                MappingName = "ShipCity", HeaderText = "Ship Country"
            });
            this.sfDataGrid1.Columns.Add(new GridDateTimeColumn()
            {
                MappingName = "ShippingDate", HeaderText = "Shipping Date"
            });
            this.sfDataGrid1.Columns.Add(new GridNumericColumn()
            {
                MappingName = "Freight", HeaderText = "Freight", FormatMode = FormatMode.Currency
            });
            this.sfDataGrid1.Columns.Add(new GridCheckBoxColumn()
            {
                MappingName = "IsClosed", HeaderText = "Is Closed"
            });
            sfDataGrid1.AllowResizingColumns = true;
            #endregion

            #region themComboBox settings
            List <ThemeTypes> theme = new List <ThemeTypes>();
            theme.Add(new ThemeTypes()
            {
                ThemeName = "Office2016Black", Value = 1
            });
            theme.Add(new ThemeTypes()
            {
                ThemeName = "Office2016White", Value = 2
            });
            theme.Add(new ThemeTypes()
            {
                ThemeName = "Office2016DarkGray", Value = 3
            });
            theme.Add(new ThemeTypes()
            {
                ThemeName = "Office2016Colorful", Value = 4
            });
            comboBox1.DataSource            = theme;
            comboBox1.DisplayMember         = "ThemeName";
            comboBox1.ValueMember           = "ThemeName";
            comboBox1.SelectedValueChanged += comboBox1_SelectedValueChanged;
            comboBox1.SelectedValue         = "Office2016Colorful";
            #endregion

            this.checkBox1.Style      = Syncfusion.Windows.Forms.Tools.CheckBoxAdvStyle.Office2016Colorful;
            checkBox1.CheckedChanged += checkBox1_CheckedChanged;

            #region TableSummaryRow

            GridTableSummaryRow tableSummaryRow1 = new GridTableSummaryRow();
            tableSummaryRow1.Name             = "TableSummary";
            tableSummaryRow1.ShowSummaryInRow = true;
            tableSummaryRow1.Title            = " Total Count: {OrderID}";
            tableSummaryRow1.Position         = VerticalPosition.Bottom;

            GridSummaryColumn summaryColumn1 = new GridSummaryColumn();
            summaryColumn1.Name        = "OrderID";
            summaryColumn1.SummaryType = SummaryType.DoubleAggregate;
            summaryColumn1.Format      = "{Count}";
            summaryColumn1.MappingName = "OrderID";
            tableSummaryRow1.SummaryColumns.Add(summaryColumn1);
            this.sfDataGrid1.TableSummaryRows.Add(tableSummaryRow1);

            #endregion

            #region GroupSummaryRow

            // Creates the GridSummaryRow.
            GridSummaryRow groupSummaryRow1 = new GridSummaryRow();
            groupSummaryRow1.Name             = "GroupSummary";
            groupSummaryRow1.ShowSummaryInRow = false;
            groupSummaryRow1.Title            = "Total  $: { OrderID }";

            // Creates the GridSummaryColumn.
            GridSummaryColumn summaryColumn3 = new GridSummaryColumn();
            summaryColumn3.Name        = "OrderID";
            summaryColumn3.SummaryType = SummaryType.DoubleAggregate;
            summaryColumn3.Format      = "Total : {Sum:c}";
            summaryColumn3.MappingName = "OrderID";

            // Adds the GridSummaryColumn in SummaryColumns collection.
            groupSummaryRow1.SummaryColumns.Add(summaryColumn3);

            // Adds the summary row in the GroupSummaryRows collection.
            this.sfDataGrid1.GroupSummaryRows.Add(groupSummaryRow1);


            #endregion

            #region Relation Creation
            GridViewDefinition viewDefinition = new GridViewDefinition();
            viewDefinition.RelationalColumn = "OrderDetails";
            firstLevelSourceDataGrid        = new SfDataGrid();
            firstLevelSourceDataGrid.Columns.Add(new GridTextColumn()
            {
                MappingName = "OrderID", HeaderText = "Order ID"
            });
            firstLevelSourceDataGrid.Columns.Add(new GridDateTimeColumn()
            {
                MappingName = "OrderDate", HeaderText = "Order Date"
            });
            firstLevelSourceDataGrid.Columns.Add(new GridTextColumn()
            {
                MappingName = "CustomerID", HeaderText = "Customer ID"
            });
            firstLevelSourceDataGrid.Columns.Add(new GridTextColumn()
            {
                MappingName = "CustomerCity", HeaderText = "Customer City"
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "ProductID", HeaderText = "Product ID", FormatMode = FormatMode.Numeric
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "UnitPrice", HeaderText = "Unit Price", FormatMode = FormatMode.Currency
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "Quantity", HeaderText = "Quantity", FormatMode = FormatMode.Numeric
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "Discount", HeaderText = "Discount", FormatMode = FormatMode.Percent
            });
            StackedHeaderRow stackedHeaderRow = new StackedHeaderRow();
            stackedHeaderRow.StackedColumns.Add(new StackedColumn()
            {
                ChildColumns = "OrderID,OrderDate", HeaderText = "Order Details"
            });
            stackedHeaderRow.StackedColumns.Add(new StackedColumn()
            {
                ChildColumns = "CustomerID,CustomerCity", HeaderText = "Customer Details"
            });
            stackedHeaderRow.StackedColumns.Add(new StackedColumn()
            {
                ChildColumns = "ProductID,UnitPrice,Quantity,Discount", HeaderText = "Product Details"
            });
            firstLevelSourceDataGrid.AllowResizingColumns = true;
            firstLevelSourceDataGrid.AutoSizeColumnsMode  = AutoSizeColumnsMode.Fill;
            viewDefinition.DataGrid = firstLevelSourceDataGrid;
            this.sfDataGrid1.DetailsViewDefinitions.Add(viewDefinition);
            #endregion

            this.sfDataGrid1.HideEmptyGridViewDefinition = true;
        }
Пример #2
0
        private void InitializeDataGrid(SfDataGrid masterDataGrid, SfDataGrid detailDataGrid, SfDataGrid groupDataGrid)
        {
            Appearances.DataGrid(masterDataGrid);
            Appearances.DataGrid(detailDataGrid);
            Appearances.DataGrid(groupDataGrid);

            var numberFormat = new NumberFormatInfo();

            numberFormat.NumberDecimalDigits = 0;
            numberFormat.NumberGroupSizes    = new int[] { 3 };

            var numberFormat2 = new NumberFormatInfo();

            numberFormat2.NumberDecimalDigits = 2;
            numberFormat2.NumberGroupSizes    = new int[] { 3 };

            var numberFormat3 = new NumberFormatInfo();

            numberFormat3.NumberDecimalDigits = 3;
            numberFormat3.NumberGroupSizes    = new int[] { 3 };

            masterDataGrid.Columns.Add(new GridCheckBoxColumn()
            {
                HeaderText = "선택", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col01)
            });
            masterDataGrid.Columns.Add(new GridTextColumn()
            {
                HeaderText = "분할기준", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col02)
            });
            masterDataGrid.Columns.Add(new GridTextColumn()
            {
                HeaderText = "분할개수", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col03)
            });
            masterDataGrid.AutoGenerateColumns = false;
            masterDataGrid.SelectionChanged   += OnMasterDataGridSelectionChanged;

            groupDataGrid.Columns.Add(new GridTextColumn()
            {
                HeaderText = "그룹명", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col01)
            });
            groupDataGrid.AutoGenerateColumns = false;

            var detailsView = new GridViewDefinition();

            detailsView.RelationalColumn = "_";
            detailsView.DataGrid         = groupDataGrid;
            masterDataGrid.DetailsViewDefinitions.Add(detailsView);

            detailDataGrid.Columns.Add(new GridTextColumn()
            {
                HeaderText = "No.", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col01)
            });
            detailDataGrid.Columns.Add(new GridTextColumn()
            {
                HeaderText = "자료내용", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col02)
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "객체개수", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col03), NumberFormatInfo = numberFormat
            });
            detailDataGrid.AutoGenerateColumns = false;
        }
Пример #3
0
        /// <summary>
        /// Sets the sample customization settings.
        /// </summary>
        private void SampleCustomization()
        {
            this.sfDataGrid1.AllowEditing         = true;
            this.sfDataGrid1.AllowGrouping        = true;
            this.sfDataGrid1.ShowGroupDropArea    = true;
            this.sfDataGrid1.AutoGenerateColumns  = false;
            this.sfDataGrid1.AllowResizingColumns = true;
            this.sfDataGrid1.SelectionMode        = GridSelectionMode.Multiple;
            NumberFormatInfo nfi = new NumberFormatInfo();

            nfi.NumberDecimalDigits = 0;
            nfi.NumberGroupSizes    = new int[] { };
            OrderInfoRepository orderInfo = new OrderInfoRepository();

            this.sfDataGrid1.DataSource = orderInfo.GetOrdersDetails(30);
            this.sfDataGrid1.Columns.Add(new GridNumericColumn()
            {
                MappingName = "OrderID", HeaderText = "Order ID", NumberFormatInfo = nfi
            });
            this.sfDataGrid1.Columns.Add(new GridTextColumn()
            {
                MappingName = "CustomerID", HeaderText = "Customer ID"
            });
            this.sfDataGrid1.Columns.Add(new GridDateTimeColumn()
            {
                MappingName = "ShippingDate", HeaderText = "Shipping Date"
            });
            this.sfDataGrid1.Columns.Add(new GridNumericColumn()
            {
                MappingName = "EmployeeID", HeaderText = "Employee ID", NumberFormatInfo = nfi
            });


            this.sfDataGrid1.Columns.Add(new GridTextColumn()
            {
                MappingName = "ShipCity", HeaderText = "Ship City"
            });
            this.sfDataGrid1.Columns.Add(new GridTextColumn()
            {
                MappingName = "ShipCountry", HeaderText = "Ship Country"
            });
            this.sfDataGrid1.Columns.Add(new GridNumericColumn()
            {
                MappingName = "Freight", HeaderText = "Freight", FormatMode = FormatMode.Currency
            });
            this.sfDataGrid1.Columns.Add(new GridCheckBoxColumn()
            {
                MappingName = "IsClosed", HeaderText = "Is Closed", CheckBoxSize = new Size(14, 14)
            });

            #region Relation Creation
            GridViewDefinition viewDefinition = new GridViewDefinition();
            viewDefinition.RelationalColumn = "OrderDetails";
            SfDataGrid firstLevelSourceDataGrid = new SfDataGrid();
            firstLevelSourceDataGrid.AutoGenerateColumns = false;
            firstLevelSourceDataGrid.RowHeight           = 21;
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "OrderID", HeaderText = "Order ID", NumberFormatInfo = nfi
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "ProductID", HeaderText = "Product ID", NumberFormatInfo = nfi
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "UnitPrice", HeaderText = "Unit Price", NumberFormatInfo = nfi, FormatMode = FormatMode.Currency
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "Quantity", HeaderText = "Quantity", NumberFormatInfo = nfi
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "Discount", HeaderText = "Discount", NumberFormatInfo = nfi
            });
            firstLevelSourceDataGrid.Columns.Add(new GridTextColumn()
            {
                MappingName = "CustomerID", HeaderText = "Customer ID"
            });
            firstLevelSourceDataGrid.Columns.Add(new GridDateTimeColumn()
            {
                MappingName = "OrderDate", HeaderText = "Order Date"
            });
            viewDefinition.DataGrid = firstLevelSourceDataGrid;
            this.sfDataGrid1.DetailsViewDefinitions.Add(viewDefinition);
            #endregion

            this.sfDataGrid1.HideEmptyGridViewDefinition = true;

            this.exportWholeGrid.Checked = true;
        }
Пример #4
0
        private void InitializeDataGrid(SfDataGrid masterDataGrid, SfDataGrid detailDataGrid)
        {
            Appearances.DataGrid(masterDataGrid);
            Appearances.DataGrid(detailDataGrid);

            var numberFormat = new NumberFormatInfo();

            numberFormat.NumberDecimalDigits = 0;
            numberFormat.NumberGroupSizes    = new int[] { 3 };

            var numberFormat2 = new NumberFormatInfo();

            numberFormat2.NumberDecimalDigits = 2;
            numberFormat2.NumberGroupSizes    = new int[] { 3 };

            masterDataGrid.Columns.Add(new GridTextColumn()
            {
                HeaderText = "진단구역명", MappingName = nameof(PipeGroup.Zone)
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "최소유속(m/sec)", MappingName = nameof(PipeGroup.MinVelocity), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "최대유속(m/sec)", MappingName = nameof(PipeGroup.MaxVelocity), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "평균유속(m/sec)", MappingName = nameof(PipeGroup.AvgVelocity), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "편차", MappingName = nameof(PipeGroup.StDevVelocity), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.AutoGenerateColumns = false;

            _pipeTypeComboBoxColumn = new GridComboBoxColumn()
            {
                HeaderText = "관종", MappingName = nameof(Pipe.PP_TYPE)
            };
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "관로ID", MappingName = nameof(Pipe.ID), NumberFormatInfo = numberFormat
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "관리번호", MappingName = nameof(Pipe.MGR_ID), NumberFormatInfo = numberFormat
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "최소유속(m/sec)", MappingName = nameof(Pipe.VELOCITY_MIN), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "최대유속(m/sec)", MappingName = nameof(Pipe.VELOCITY_MAX), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "평균유속(m/sec)", MappingName = nameof(Pipe.VELOCITY_AVG), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.Columns.Add(_pipeTypeComboBoxColumn);
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "관경(mm)", MappingName = nameof(Pipe.PP_CIR), NumberFormatInfo = numberFormat
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "관로길이(m)", MappingName = nameof(Pipe.PP_LEN), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "매설년수", MappingName = nameof(Pipe.NYEAR), NumberFormatInfo = numberFormat
            });
            detailDataGrid.AutoGenerateColumns = false;

            var detailsView = new GridViewDefinition();

            detailsView.RelationalColumn = nameof(PipeGroup.Pipes);
            detailsView.DataGrid         = detailDataGrid;

            masterDataGrid.DetailsViewDefinitions.Add(detailsView);
            //dataGrid.SelectionChanged   += OnPatternMasterDataGridSelectionChanged;
        }
Пример #5
0
        private void InitializeDataGrid(SfDataGrid masterDataGrid, SfDataGrid detailDataGrid)
        {
            Appearances.DataGrid(masterDataGrid);
            Appearances.DataGrid(detailDataGrid);

            var numberFormat = new NumberFormatInfo();

            numberFormat.NumberDecimalDigits = 0;
            numberFormat.NumberGroupSizes    = new int[] { 3 };

            var numberFormat2 = new NumberFormatInfo();

            numberFormat2.NumberDecimalDigits = 2;
            numberFormat2.NumberGroupSizes    = new int[] { 3 };

            var numberFormat3 = new NumberFormatInfo();

            numberFormat3.NumberDecimalDigits = 3;
            numberFormat3.NumberGroupSizes    = new int[] { 3 };

            //\r\n
            masterDataGrid.Columns.Add(new GridTextColumn()
            {
                HeaderText = "날짜 ", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col01)
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "유입유량(m³/월)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col02), NumberFormatInfo = numberFormat
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "사용량(m³/월)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col03), NumberFormatInfo = numberFormat
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "평균수압(m)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col04), NumberFormatInfo = numberFormat2, MaximumWidth = 150
            });
            masterDataGrid.AutoGenerateColumns = false;

            detailDataGrid.Columns.Add(new GridTextColumn()
            {
                HeaderText = "진단구역명", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col01)
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "상수관로연장(m)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col02), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "급수전수(전)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col03), NumberFormatInfo = numberFormat
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "평균수압(m)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col04), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "유입유량(m³/월)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col05), NumberFormatInfo = numberFormat
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "사용량(m³/월)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col06), NumberFormatInfo = numberFormat
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "급수전밀도", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col07), NumberFormatInfo = numberFormat3
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "유수율(%)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col08), NumberFormatInfo = numberFormat3
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "무수율(≒누수율)(%)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col09), NumberFormatInfo = numberFormat3
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "급수전당무수수량(≒누수량)(m³/일/전)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col10), NumberFormatInfo = numberFormat3
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "관로연장당무수수량(m³/일/km)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col11), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.AutoGenerateColumns = false;

            var detailsView = new GridViewDefinition();

            detailsView.RelationalColumn = nameof(DataGridModel.Details);
            detailsView.DataGrid         = detailDataGrid;

            masterDataGrid.DetailsViewDefinitions.Add(detailsView);
            //dataGrid.SelectionChanged   += OnPatternMasterDataGridSelectionChanged;
        }
Пример #6
0
        /// <summary>
        /// Sets the sample customization settings.
        /// </summary>
        private void SampleCustomization()
        {
            this.sfDataGrid1.AllowGrouping       = true;
            this.sfDataGrid1.ShowGroupDropArea   = true;
            this.sfDataGrid1.AutoGenerateColumns = false;
            this.sfDataGrid1.AutoSizeColumnsMode = AutoSizeColumnsMode.Fill;

            NumberFormatInfo nfi = new NumberFormatInfo();

            nfi.NumberDecimalDigits = 0;
            nfi.NumberGroupSizes    = new int[] { };

            OrderInfoRepository orderInfo = new OrderInfoRepository();

            this.sfDataGrid1.DataSource = orderInfo.GetOrdersDetails(30);
            this.sfDataGrid1.Columns.Add(new GridNumericColumn()
            {
                MappingName = "OrderID", HeaderText = "Order ID", NumberFormatInfo = nfi
            });
            this.sfDataGrid1.Columns.Add(new GridTextColumn()
            {
                MappingName = "CustomerID", HeaderText = "Customer ID"
            });
            this.sfDataGrid1.Columns.Add(new GridTextColumn()
            {
                MappingName = "ShipCity", HeaderText = "Ship City"
            });
            this.sfDataGrid1.Columns.Add(new GridTextColumn()
            {
                MappingName = "ShipCity", HeaderText = "Ship Country"
            });
            this.sfDataGrid1.Columns.Add(new GridDateTimeColumn()
            {
                MappingName = "ShippingDate", HeaderText = "Shipping Date"
            });
            this.sfDataGrid1.Columns.Add(new GridNumericColumn()
            {
                MappingName = "Freight", HeaderText = "Freight", FormatMode = FormatMode.Currency
            });
            this.sfDataGrid1.Columns.Add(new GridCheckBoxColumn()
            {
                MappingName = "IsClosed", HeaderText = "Is Closed"
            });

            #region Relation Creation
            GridViewDefinition viewDefinition = new GridViewDefinition();
            viewDefinition.RelationalColumn = "OrderDetails";
            SfDataGrid firstLevelSourceDataGrid = new SfDataGrid();
            firstLevelSourceDataGrid.RowHeight = 21;
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "OrderID", HeaderText = "Order ID", NumberFormatInfo = nfi
            });
            firstLevelSourceDataGrid.Columns.Add(new GridDateTimeColumn()
            {
                MappingName = "OrderDate", HeaderText = "Order Date"
            });
            firstLevelSourceDataGrid.Columns.Add(new GridTextColumn()
            {
                MappingName = "CustomerID", HeaderText = "Customer ID"
            });
            firstLevelSourceDataGrid.Columns.Add(new GridTextColumn()
            {
                MappingName = "CustomerCity", HeaderText = "Customer City"
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "ProductID", HeaderText = "Product ID", FormatMode = FormatMode.Numeric, NumberFormatInfo = nfi
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "UnitPrice", HeaderText = "Unit Price", FormatMode = FormatMode.Currency
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "Quantity", HeaderText = "Quantity", FormatMode = FormatMode.Numeric
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "Discount", HeaderText = "Discount", FormatMode = FormatMode.Percent
            });
            StackedHeaderRow stackedHeaderRow = new StackedHeaderRow();
            stackedHeaderRow.StackedColumns.Add(new StackedColumn()
            {
                ChildColumns = "OrderID,OrderDate", HeaderText = "Order Details"
            });
            stackedHeaderRow.StackedColumns.Add(new StackedColumn()
            {
                ChildColumns = "CustomerID,CustomerCity", HeaderText = "Customer Details"
            });
            stackedHeaderRow.StackedColumns.Add(new StackedColumn()
            {
                ChildColumns = "ProductID,UnitPrice,Quantity,Discount", HeaderText = "Product Details"
            });
            firstLevelSourceDataGrid.StackedHeaderRows.Add(stackedHeaderRow);
            firstLevelSourceDataGrid.AutoSizeColumnsMode = AutoSizeColumnsMode.Fill;
            viewDefinition.DataGrid = firstLevelSourceDataGrid;
            this.sfDataGrid1.DetailsViewDefinitions.Add(viewDefinition);
            #endregion

            this.sfDataGrid1.HideEmptyGridViewDefinition = true;
        }
Пример #7
0
        private void InitializeDataGrid(SfDataGrid masterDataGrid, SfDataGrid detailDataGrid)
        {
            Appearances.DataGrid(masterDataGrid);
            Appearances.DataGrid(detailDataGrid);

            var numberFormat = new NumberFormatInfo();

            numberFormat.NumberDecimalDigits = 0;
            numberFormat.NumberGroupSizes    = new int[] { 3 };

            var numberFormat2 = new NumberFormatInfo();

            numberFormat2.NumberDecimalDigits = 2;
            numberFormat2.NumberGroupSizes    = new int[] { 3 };

            masterDataGrid.AutoGenerateColumns = false;
            masterDataGrid.Columns.Add(new GridTextColumn()
            {
                HeaderText = "진단구역", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(PipeGroup.Zone)
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "평균표고(m)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(PipeGroup.InputAvgPressure), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "평균수압(m)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(PipeGroup.AvgPressure), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "유입유량(m³/일)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(PipeGroup.InFlow), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "사용량(m³/일)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(PipeGroup.Usage), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "무수수량(m³/일)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(PipeGroup.AnhydrouAmount), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "배수관", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(PipeGroup.Col6), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "급수시설", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(PipeGroup.Col7), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "옥내", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(PipeGroup.Col8), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "배경누수량(m³/일)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(PipeGroup.Col9), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "파열누수량(m³/일)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(PipeGroup.RuptureLeakage), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "누수량(m³/일)", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(PipeGroup.Leakage), NumberFormatInfo = numberFormat2
            });

            var stackedHeaderRow = new StackedHeaderRow();

            stackedHeaderRow.StackedColumns.Add(new StackedColumn()
            {
                HeaderText   = "배경누수량(m³/일)",
                ChildColumns = $"{nameof(PipeGroup.Col6)},{nameof(PipeGroup.Col7)},{nameof(PipeGroup.Col8)}",
            });
            masterDataGrid.StackedHeaderRows.Add(stackedHeaderRow);

            detailDataGrid.AutoGenerateColumns = false;
            _pipeTypeComboBoxColumn            = new GridComboBoxColumn()
            {
                HeaderText = "관재질", MappingName = nameof(Pipe.PP_TYPE)
            };
            detailDataGrid.Columns.Add(new GridTextColumn()
            {
                HeaderText = "관로ID", MappingName = nameof(Pipe.ID)
            });
            detailDataGrid.Columns.Add(new GridTextColumn()
            {
                HeaderText = "관리번호", MappingName = nameof(Pipe.MGR_ID)
            });
            detailDataGrid.Columns.Add(_pipeTypeComboBoxColumn);
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "관경", MappingName = nameof(Pipe.PP_CIR), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "관로길이", MappingName = nameof(Pipe.PP_LEN), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "매설년수", MappingName = nameof(Pipe.NYEAR), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "급수관연장", MappingName = nameof(Pipe.Col1), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "급수전수", MappingName = nameof(Pipe.Col2), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "배경누수량", MappingName = nameof(Pipe.LEAK_BASE), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "파열누수량", MappingName = nameof(Pipe.LEAK_BREAK), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "누수량", MappingName = nameof(Pipe.LEAK_SUM), NumberFormatInfo = numberFormat2
            });


            var detailsView = new GridViewDefinition();

            detailsView.RelationalColumn = nameof(PipeGroup.Pipes);
            detailsView.DataGrid         = detailDataGrid;

            masterDataGrid.DetailsViewDefinitions.Add(detailsView);
            //dataGrid.SelectionChanged   += OnPatternMasterDataGridSelectionChanged;
        }
Пример #8
0
        /// <summary>
        /// Sets the sample customization settings.
        /// </summary>
        private void SampleCustomization()
        {
            this.sfDataGrid1.AllowEditing        = true;
            this.sfDataGrid1.AllowGrouping       = true;
            this.sfDataGrid1.AutoGenerateColumns = false;

            NumberFormatInfo nfi = new NumberFormatInfo();

            nfi.NumberDecimalDigits = 0;
            nfi.NumberGroupSizes    = new int[] { };

            OrderInfoRepository orderInfo = new OrderInfoRepository();

            this.sfDataGrid1.DataSource = orderInfo.GetOrdersDetails(30);
            this.sfDataGrid1.Columns.Add(new GridNumericColumn()
            {
                MappingName = "OrderID", HeaderText = "رقم التعريف الخاص بالطلب", NumberFormatInfo = nfi
            });
            this.sfDataGrid1.Columns.Add(new GridTextColumn()
            {
                MappingName = "ShipCity", HeaderText = "مدينة السفن"
            });
            this.sfDataGrid1.Columns.Add(new GridTextColumn()
            {
                MappingName = "ShipCountry", HeaderText = "السفينة البلد"
            });
            this.sfDataGrid1.Columns.Add(new GridDateTimeColumn()
            {
                MappingName = "ShippingDate", HeaderText = "السفينة البلد"
            });
            this.sfDataGrid1.Columns.Add(new GridNumericColumn()
            {
                MappingName = "Freight", HeaderText = "شحن", FormatMode = FormatMode.Currency
            });
            this.sfDataGrid1.Columns.Add(new GridCheckBoxColumn()
            {
                MappingName = "IsClosed", HeaderText = "مغلق", CheckBoxSize = new Size((int)DpiAware.LogicalToDeviceUnits(14.0f), (int)DpiAware.LogicalToDeviceUnits(14.0f))
            });

            #region Relation Creation
            GridViewDefinition viewDefinition = new GridViewDefinition();
            viewDefinition.RelationalColumn = "OrderDetails";
            SfDataGrid firstLevelSourceDataGrid = new SfDataGrid();
            firstLevelSourceDataGrid.AutoGenerateColumns = false;
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "OrderID", HeaderText = "رقم التعريف الخاص بالطلب", NumberFormatInfo = nfi
            });
            firstLevelSourceDataGrid.Columns.Add(new GridTextColumn()
            {
                MappingName = "Product", HeaderText = "المنتج"
            });
            firstLevelSourceDataGrid.Columns.Add(new GridTextColumn()
            {
                MappingName = "CustomerCity", HeaderText = "مدينة العملاء"
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "ProductID", HeaderText = "معرف المنتج", FormatMode = FormatMode.Numeric, NumberFormatInfo = nfi
            });
            //firstLevelSourceDataGrid.Columns.Add(new GridHyperlinkColumn() { MappingName = "HyperLink", HeaderText = "الارتباط التشعبي" });
            firstLevelSourceDataGrid.Columns.Add(new GridDateTimeColumn()
            {
                MappingName = "OrderDate", HeaderText = "تاريخ الطلب"
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "UnitPrice", HeaderText = "سعر الوحدة", FormatMode = FormatMode.Currency
            });
            CellStyleInfo cellStyle = new CellStyleInfo();
            cellStyle.HorizontalAlignment = HorizontalAlignment.Right;
            firstLevelSourceDataGrid.Columns.Add(new GridUnboundColumn()
            {
                MappingName = "QuantitiesPrice", HeaderText = "المجموع الكلي", Expression = "UnitPrice * Quantity", CellStyle = cellStyle
            });
            firstLevelSourceDataGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "Discount", HeaderText = "خصم", FormatMode = FormatMode.Percent
            });
            firstLevelSourceDataGrid.Columns.Add(new GridImageColumn()
            {
                MappingName = "ImageLink", HeaderText = "بلد", ImageLayout = ImageLayout.Center
            });
            (firstLevelSourceDataGrid.Columns["ImageLink"] as GridImageColumn).CellStyle.VerticalAlignment   = System.Windows.Forms.VisualStyles.VerticalAlignment.Center;
            (firstLevelSourceDataGrid.Columns["ImageLink"] as GridImageColumn).CellStyle.HorizontalAlignment = HorizontalAlignment.Center;
            viewDefinition.DataGrid = firstLevelSourceDataGrid;
            this.sfDataGrid1.DetailsViewDefinitions.Add(viewDefinition);

            firstLevelSourceDataGrid.AutoSizeColumnsMode = AutoSizeColumnsMode.Fill;
            this.sfDataGrid1.AutoSizeColumnsMode         = AutoSizeColumnsMode.Fill;

            #endregion

            this.sfDataGrid1.HideEmptyGridViewDefinition = true;
        }