Пример #1
0
        private void PhanTich_Load(object sender, EventArgs e)
        {
            LoadThongTinChiTiet();
            LayoutControlGroup newGroup = dataLayoutControl1.Root.AddGroup();
            LayoutControlItem  item1    = newGroup.AddItem();

            gridControl            = new GridControl();
            gridControl.Dock       = DockStyle.Fill;
            gridControl.DataSource = getMarkDataWithID(MaHocVien);
            item1.Control          = gridControl;
            GridView   gridView1 = gridControl.MainView as GridView;
            GridColumn colHocKy  = gridView1.Columns["HocKy"];
            GridColumn colNam    = gridView1.Columns["Nam"];
            GridColumn colDiem   = gridView1.Columns["Diem"];

            colNam.GroupIndex   = 0;
            colHocKy.GroupIndex = 1;
            gridView1.ExpandAllGroups();

            //Change Format Rule

            GridFormatRule             gridFormatRule             = new GridFormatRule();
            FormatConditionRuleIconSet formatConditionRuleIconSet = new FormatConditionRuleIconSet();
            FormatConditionIconSet     iconSet = formatConditionRuleIconSet.IconSet = new FormatConditionIconSet();
            FormatConditionIconSetIcon icon1   = new FormatConditionIconSetIcon();
            FormatConditionIconSetIcon icon2   = new FormatConditionIconSetIcon();
            FormatConditionIconSetIcon icon3   = new FormatConditionIconSetIcon();
            FormatConditionIconSetIcon icon4   = new FormatConditionIconSetIcon();

            //Choose predefined icons.
            icon1.PredefinedName = "Rating4_1.png";
            icon2.PredefinedName = "Rating4_2.png";
            icon3.PredefinedName = "Rating4_3.png";
            icon4.PredefinedName = "Rating4_4.png";

            //Specify the type of threshold values.
            iconSet.ValueType = FormatConditionValueType.Number;

            //Define ranges to which icons are applied by setting threshold values.
            icon1.Value           = 8; // target range: 8 <= value
            icon1.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
            icon2.Value           = 7; // target range: 7 <= value < 8
            icon2.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
            icon3.Value           = 5; // target range: 5 <= value < 7
            icon3.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
            icon4.Value           = 0; // target range: 0 <= value < 5
            icon4.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
            //Add icons to the icon set.
            iconSet.Icons.Add(icon1);
            iconSet.Icons.Add(icon2);
            iconSet.Icons.Add(icon3);
            iconSet.Icons.Add(icon4);

            //Specify the rule type.
            gridFormatRule.Rule = formatConditionRuleIconSet;
            //Specify the column to which formatting is applied.
            gridFormatRule.Column = colDiem;
            //Add the formatting rule to the GridView.
            gridView1.FormatRules.Add(gridFormatRule);
        }
Пример #2
0
        FormatConditionRuleIconSet createThreeTrianglesIconSetRule()
        {
            FormatConditionRuleIconSet ruleIconSet = new FormatConditionRuleIconSet();
            FormatConditionIconSet     iconSet     = ruleIconSet.IconSet = new FormatConditionIconSet();
            FormatConditionIconSetIcon icon1       = new FormatConditionIconSetIcon();
            FormatConditionIconSetIcon icon2       = new FormatConditionIconSetIcon();
            FormatConditionIconSetIcon icon3       = new FormatConditionIconSetIcon();

            //Choose predefined icons.
            icon1.PredefinedName = "Triangles3_3.png";
            icon2.PredefinedName = "Triangles3_2.png";
            icon3.PredefinedName = "Triangles3_1.png";
            //Specify the type of threshold values.
            iconSet.ValueType = FormatConditionValueType.Number;
            //Define ranges to which icons are applied by setting threshold values.
            icon1.Value           = Decimal.MinValue;
            icon1.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
            icon2.Value           = 0;
            icon2.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
            icon3.Value           = 0;
            icon3.ValueComparison = FormatConditionComparisonType.Greater;
            //Add icons to the icon set.
            iconSet.Icons.Add(icon1);
            iconSet.Icons.Add(icon2);
            iconSet.Icons.Add(icon3);
            return(ruleIconSet);
        }
Пример #3
0
        void InitGridControlCadet(string maLop)
        {
            string query = "";

            if (maLop == null)
            {
                query = "EXEC dbo.LayThongTinDiemCacKiCuaHocVien";
            }
            else
            {
                query = string.Format("EXECUTE dbo.LayThongTinDiemCacKiCuaHocVienTheoLop {0}", maLop);
            }

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand cmd = new SqlCommand(query, connection);
                using (SqlDataAdapter adapter = new SqlDataAdapter(cmd))
                {
                    DataTable table = new DataTable();
                    adapter.Fill(table);
                    gridControlCadet.DataSource = table;
                    GridColumn colID          = gridViewCadet.Columns["HocVienID"];
                    GridColumn colName        = gridViewCadet.Columns["TenHocVien"];
                    GridColumn colQue         = gridViewCadet.Columns["QueQuan"];
                    GridColumn colNgaySinh    = gridViewCadet.Columns["NgaySinh"];
                    GridColumn colTenLop      = gridViewCadet.Columns["TenLop"];
                    GridColumn colHocKy       = gridViewCadet.Columns["HocKy"];
                    GridColumn colHocKyId     = gridViewCadet.Columns["HocKyID"];
                    GridColumn colNamHocId    = gridViewCadet.Columns["NamHocID"];
                    GridColumn colTongKet     = gridViewCadet.Columns["TongKet"];
                    GridColumn colNam         = gridViewCadet.Columns["Nam"];
                    GridColumn colDuongDanAnh = gridViewCadet.Columns["DuongDanAnh"];
                    GridColumn colTangTruong  = gridViewCadet.Columns["TangTruong"];
                    colID.Visible          = false;
                    colHocKyId.Visible     = false;
                    colNamHocId.Visible    = false;
                    colDuongDanAnh.Visible = false;
                    colName.Caption        = "Tên Học Viên";
                    colQue.Caption         = "Quê Quán";
                    colNgaySinh.Caption    = "Ngày Sinh";
                    colTenLop.Caption      = "Lớp";
                    colHocKy.Caption       = "Học Kì";
                    colTongKet.Caption     = "Điểm Tổng Kết Kì";
                    colNam.Caption         = "Năm Học";
                    colNam.GroupIndex      = 0;
                    colHocKy.GroupIndex    = 1;
                    colNgaySinh.Summary.Clear();
                    colNgaySinh.Summary.Add(SummaryItemType.Count, colNgaySinh.FieldName, "Tổng Số : {0}");
                    colNgaySinh.Summary.Add(SummaryItemType.Max, colNgaySinh.FieldName, "Độ Tuổi : <= {0:d}");
                    gridViewCadet.OptionsView.ShowFooter           = true;
                    gridViewCadet.FindPanelVisible                 = true;
                    gridViewCadet.OptionsFind.HighlightFindResults = true;


                    //Change Format Rule

                    GridFormatRule             gridFormatRule             = new GridFormatRule();
                    FormatConditionRuleIconSet formatConditionRuleIconSet = new FormatConditionRuleIconSet();
                    FormatConditionIconSet     iconSet = formatConditionRuleIconSet.IconSet = new FormatConditionIconSet();
                    FormatConditionIconSetIcon icon1   = new FormatConditionIconSetIcon();
                    FormatConditionIconSetIcon icon2   = new FormatConditionIconSetIcon();
                    FormatConditionIconSetIcon icon3   = new FormatConditionIconSetIcon();

                    //Choose predefined icons.
                    icon1.PredefinedName = "Arrows3_1.png";
                    icon2.PredefinedName = "Arrows3_2.png";
                    icon3.PredefinedName = "Arrows3_3.png";

                    //Specify the type of threshold values.
                    iconSet.ValueType = FormatConditionValueType.Number;

                    //Define ranges to which icons are applied by setting threshold values.
                    icon1.Value           = 30;   // target range: 30% <= value
                    icon1.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
                    icon2.Value           = 10;   // target range: 10% <= value < 30%
                    icon2.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
                    icon3.Value           = -100; // target range: -100% <= value < 10%
                    icon3.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;

                    //Add icons to the icon set.
                    iconSet.Icons.Add(icon1);
                    iconSet.Icons.Add(icon2);
                    iconSet.Icons.Add(icon3);

                    //Specify the rule type.
                    gridFormatRule.Rule = formatConditionRuleIconSet;
                    //Specify the column to which formatting is applied.
                    gridFormatRule.Column = colTangTruong;
                    //Add the formatting rule to the GridView.
                    gridViewCadet.FormatRules.Add(gridFormatRule);
                    gridViewCadet.ExpandAllGroups();
                }
            }
        }
Пример #4
0
        private void BindingData(string ARG_PROCESS, string ARG_LINE, string ARG_MLINE)
        {
            DataTable dt = SEL_MULTI_SKILL_V2("Q", ARG_PROCESS, ARG_LINE, ARG_MLINE);

            gridView1.Columns.Clear();
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    dt.Columns[i].ColumnName = dt.Columns[i].ColumnName.Replace("'", "").Replace("_", " ");
                }

                gridControl1.DataSource = dt;


                //format Condition
                for (int i = 2; i < gridView1.Columns.Count; i++)
                {
                    GridFormatRule             gridFormatRule             = new GridFormatRule();
                    FormatConditionRuleIconSet formatConditionRuleIconSet = new FormatConditionRuleIconSet();
                    FormatConditionIconSet     iconSet = formatConditionRuleIconSet.IconSet = new FormatConditionIconSet();

                    FormatConditionIconSetIcon icon1 = new FormatConditionIconSetIcon();
                    FormatConditionIconSetIcon icon2 = new FormatConditionIconSetIcon();
                    FormatConditionIconSetIcon icon3 = new FormatConditionIconSetIcon();
                    FormatConditionIconSetIcon icon4 = new FormatConditionIconSetIcon();
                    FormatConditionIconSetIcon icon5 = new FormatConditionIconSetIcon();

                    //Choose predefined icons.
                    icon1.PredefinedName = "Quarters5_1.png";
                    icon2.PredefinedName = "Quarters5_2.png";
                    icon3.PredefinedName = "Quarters5_3.png";
                    icon4.PredefinedName = "Quarters5_4.png";
                    icon5.PredefinedName = "Quarters5_5.png";

                    //Specify the type of threshold values.
                    iconSet.ValueType = FormatConditionValueType.Automatic;

                    //Define ranges to which icons are applied by setting threshold values.
                    icon1.Value           = 100; // target range: 100% <= value
                    icon1.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;

                    icon2.Value           = 75; // target range: 50% <= value < 75%
                    icon2.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
                    icon3.Value           = 50; // target range: 25% <= value < 50%
                    icon3.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
                    icon4.Value           = 25; // target range: 0% <= value < 25%
                    icon4.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
                    icon5.Value           = 0;  // target range: 0% <= value < 33%
                    icon5.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;

                    //Add icons to the icon set.
                    iconSet.Icons.Add(icon1);
                    iconSet.Icons.Add(icon2);
                    iconSet.Icons.Add(icon3);
                    iconSet.Icons.Add(icon4);
                    iconSet.Icons.Add(icon5);

                    //Specify the rule type.
                    gridFormatRule.Rule = formatConditionRuleIconSet;

                    //Specify the column to which formatting is applied.

                    gridFormatRule.Column = gridView1.Columns[i];
                    //Add the formatting rule to the GridView.
                    gridView1.FormatRules.Add(gridFormatRule);

                    gridView1.Columns[i].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                    gridView1.Columns[i].AppearanceCell.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
                    gridView1.Columns[i].OptionsColumn.AllowEdit = false;
                }
                gridView1.BestFitColumns();
                gridView1.OptionsView.ColumnAutoWidth = false;
            }
            else
            {
                gridControl1.Hide();
            }
            //  gridControl1.EndUpdate();
        }
Пример #5
0
        private void dtfill(DataTable dt)
        {
            gridControl1.Refresh();
            gridControl1.DataSource = datos;
            gridView1.Columns[4].DisplayFormat.FormatType    = FormatType.Numeric;
            gridView1.Columns[4].DisplayFormat.FormatString  = "c2";
            gridView1.Columns[5].DisplayFormat.FormatType    = FormatType.Numeric;
            gridView1.Columns[5].DisplayFormat.FormatString  = "c2";
            gridView1.Columns[6].DisplayFormat.FormatType    = FormatType.Numeric;
            gridView1.Columns[6].DisplayFormat.FormatString  = "c2";
            gridView1.Columns[7].DisplayFormat.FormatType    = FormatType.Numeric;
            gridView1.Columns[7].DisplayFormat.FormatString  = "c2";
            gridView1.Columns[8].DisplayFormat.FormatType    = FormatType.Numeric;
            gridView1.Columns[8].DisplayFormat.FormatString  = "c2";
            gridView1.Columns[9].DisplayFormat.FormatType    = FormatType.Numeric;
            gridView1.Columns[9].DisplayFormat.FormatString  = "c2";
            gridView1.Columns[10].DisplayFormat.FormatType   = FormatType.Numeric;
            gridView1.Columns[10].DisplayFormat.FormatString = "c2";
            gridView1.Columns[11].DisplayFormat.FormatType   = FormatType.Numeric;
            gridView1.Columns[11].DisplayFormat.FormatString = "c2";
            gridView1.Columns[12].DisplayFormat.FormatType   = FormatType.Numeric;
            gridView1.Columns[12].DisplayFormat.FormatString = "c2";
            gridView1.Columns[13].DisplayFormat.FormatType   = FormatType.Numeric;
            // gridView1.Columns[13].DisplayFormat.FormatString = "P";



            GridFormatRule             gridFormatRule             = new GridFormatRule();
            FormatConditionRuleIconSet formatConditionRuleIconSet = new FormatConditionRuleIconSet();

            FormatConditionIconSet iconSet = formatConditionRuleIconSet.IconSet = new FormatConditionIconSet();

            FormatConditionIconSetIcon icon1 = new FormatConditionIconSetIcon();
            FormatConditionIconSetIcon icon2 = new FormatConditionIconSetIcon();
            FormatConditionIconSetIcon icon3 = new FormatConditionIconSetIcon();
            FormatConditionIconSetIcon icon4 = new FormatConditionIconSetIcon();
            FormatConditionIconSetIcon icon5 = new FormatConditionIconSetIcon();

            //Choose predefined icons.
            icon1.PredefinedName = "Arrows5_1.png";
            icon2.PredefinedName = "Arrows5_2.png";
            icon3.PredefinedName = "Arrows5_3.png";
            icon4.PredefinedName = "Arrows5_4.png";
            icon5.PredefinedName = "Arrows5_5.png";

            //Specify the type of threshold values.
            iconSet.ValueType = FormatConditionValueType.Number;


            //Define ranges to which icons are applied by setting threshold values.
            icon1.Value           = 90; // target range: 67% <= value
            icon1.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
            icon2.Value           = 70; // target range: 33% <= value < 67%
            icon2.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
            icon3.Value           = 50; // target range: 0% <= value < 33%
            icon3.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
            icon4.Value           = 25; // target range: 0% <= value < 33%
            icon4.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;
            icon5.Value           = 0;  // target range: 0% <= value < 33%
            icon5.ValueComparison = FormatConditionComparisonType.GreaterOrEqual;

            //Add icons to the icon set.
            iconSet.Icons.Add(icon1);
            iconSet.Icons.Add(icon2);
            iconSet.Icons.Add(icon3);
            iconSet.Icons.Add(icon4);
            iconSet.Icons.Add(icon5);

            //Specify the rule type.
            gridFormatRule.Rule = formatConditionRuleIconSet;
            //Specify the column to which formatting is applied.
            gridFormatRule.Column = gridView1.Columns["ALCANCE"];
            //Add the formatting rule to the GridView.
            gridView1.FormatRules.Add(gridFormatRule);



            groupBox3.Hide();

            button2.Enabled = true;
        }