Example #1
0
        /// <summary>
        /// 修改焦点对象
        /// </summary>
        public void UpdateObject()
        {
            //获取焦点对象
            FORBaseColor obj = FocusedObject;

            if (obj == null)
            {
                return;
            }

            //创建对象的一个副本
            FORBaseColor objCopy = new FORBaseColor();

            DataConverter.CopyTo <FORBaseColor>(obj, objCopy);

            //执行修改操作
            using (FrmBaseColorDialog dlg = new FrmBaseColorDialog())
            {
                dlg.Object = objCopy;                   //绑定副本
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //用副本更新焦点对象
            DataConverter.CopyTo <FORBaseColor>(objCopy, obj);
            //刷新表格
            gridControl.RefreshDataSource();
        }
Example #2
0
        /// <summary>
        /// 添加对象
        /// </summary>
        public void AddObject()
        {
            //检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }
            //新建对象
            FORBaseColor obj = new FORBaseColor();

            obj.Remark = id;

            //执行添加操作
            using (FrmBaseColorDialog dlg = new FrmBaseColorDialog())
            {
                dlg.IsCreate = true;                    //设置新建标志
                dlg.Object   = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //将新对象加入到链表中
            ObjectList.Add(obj);

            //刷新表格,并将焦点行定位到新对象上。
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
        }
Example #3
0
        /// <summary>
        /// 删除分类名
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem11_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode row = null;

            if (intFocuses == 1)
            {
                row        = this.treeList1.FocusedNode;
                intFocuses = 0;
            }
            else if (intFocuses == 2)
            {
                row        = this.treeList2.FocusedNode;
                intFocuses = 0;
            }
            if (row == null)
            {
                return;
            }

            if (row.Nodes.Count > 0)
            {
                MsgBox.Show("有下级分类,不可删除");
                return;
            }

            string parentid = row["ParentID"].ToString();



            if (MsgBox.ShowYesNo("是否删除分类 " + row["Title"].ToString() + "?") == DialogResult.Yes)
            {
                Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
                ForecastClass1.TreeNodeToDataObject(psp_Type, row);
                //psp_Type = Itop.Common.DataConverter.RowToObject<Ps_Forecast_Math>(row);
                Ps_Forecast_Math psp_Values = new Ps_Forecast_Math();
                psp_Values.ID = psp_Type.ID;

                try
                {
                    //DeletePSP_ValuesByType里面删除数据和分类
                    Common.Services.BaseService.Delete <Ps_Forecast_Math>(psp_Values);
                    FORBaseColor bc1 = new FORBaseColor();

                    bc1.Remark = forecastReport.ID + "-" + type;
                    bc1.Title  = row["Title"].ToString();
                    Common.Services.BaseService.Update("DeleteFORBaseColorByTitleRemark", bc1);

                    //this.treeList1.Nodes.Remove(row);
                }
                catch (Exception ex)
                {
                    this.Cursor = Cursors.WaitCursor;
                    LoadData();
                    this.Cursor = Cursors.Default;
                }
                LoadData();
                RefreshChart();
            }
        }
Example #4
0
 private void CopyBaseColor(FORBaseColor bc1, FORBaseColor bc2)
 {
     bc1.UID    = bc2.UID;
     bc1.Title  = bc2.Title;
     bc1.Remark = bc2.Remark;
     bc1.Color  = bc2.Color;
     bc1.Color1 = ColorTranslator.FromOle(bc2.Color);
 }
Example #5
0
        /// <summary>
        /// 删除焦点对象
        /// </summary>
        public void DeleteObject()
        {
            //获取焦点对象
            FORBaseColor obj = FocusedObject;

            if (obj == null)
            {
                return;
            }

            //请求确认
            if (MsgBox.ShowYesNo(Strings.SubmitDelete) != DialogResult.Yes)
            {
                return;
            }

            //执行删除操作
            try
            {
                Services.BaseService.Delete <FORBaseColor>(obj);
            }
            catch (Exception exc)
            {
                Debug.Fail(exc.Message);
                HandleException.TryCatch(exc);
                return;
            }

            this.gridView.BeginUpdate();
            //记住当前焦点行索引
            int iOldHandle = this.gridView.FocusedRowHandle;

            //从链表中删除
            ObjectList.Remove(obj);
            //刷新表格
            gridControl.RefreshDataSource();
            //设置新的焦点行索引
            GridHelper.FocuseRowAfterDelete(this.gridView, iOldHandle);
            this.gridView.EndUpdate();
        }
Example #6
0
        private void RefreshChart()
        {
            ArrayList ht = new ArrayList();

            ht.Add(Color.Red);
            ht.Add(Color.Blue);
            ht.Add(Color.Green);
            ht.Add(Color.Yellow);
            ht.Add(Color.HotPink);
            ht.Add(Color.LawnGreen);
            ht.Add(Color.Khaki);
            ht.Add(Color.LightSlateGray);
            ht.Add(Color.LightSeaGreen);
            ht.Add(Color.Lime);
            ht.Add(Color.Black);
            ht.Add(Color.Brown);
            ht.Add(Color.Crimson);
            int m = 0;

            IList <FORBaseColor> list = Services.BaseService.GetList <FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + MIS.ProgUID + "-" + type + "'");

            IList <FORBaseColor> li = new List <FORBaseColor>();
            bool      bl            = false;
            ArrayList aldatablr     = new ArrayList();

            foreach (DataRow row in dataTable.Rows)
            {
                aldatablr.Add(row["ID"].ToString());
            }
            foreach (DataRow row in dataTable.Rows)
            {
                if (aldatablr.Contains(row["ParentID"].ToString()))
                {
                    continue;
                }
                bl = false;
                foreach (FORBaseColor bc in list)
                {
                    if (row["Col3"].ToString() + "-" + row["Title"].ToString() == bc.Title)
                    {
                        bl = true;
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.Color1 = Color.Blue;
                        CopyBaseColor(bc1, bc);
                        li.Add(bc1);
                    }
                }
                if (!bl)
                {
                    FORBaseColor bc1 = new FORBaseColor();
                    bc1.UID    = Guid.NewGuid().ToString();
                    bc1.Remark = MIS.ProgUID + "-" + type;
                    bc1.Title  = row["Col3"].ToString() + "-" + row["Title"].ToString();
                    bc1.Color  = 16711680;
                    if (m == 0)
                    {
                        Random rd = new Random();
                        m = rd.Next(100);
                    }
                    Color cl = (Color)ht[m % 13];
                    bc1.Color  = ColorTranslator.ToOle(cl);
                    bc1.Color1 = cl;
                    //bc1.Color1 = Color.Blue;
                    Services.BaseService.Create <FORBaseColor>(bc1);
                    li.Add(bc1);
                }
                m++;
            }
            ArrayList hs = new ArrayList();

            foreach (FORBaseColor bc2 in li)
            {
                hs.Add(bc2.Color1);
            }

            List <Ps_Forecast_Math> listValues = new List <Ps_Forecast_Math>();

            for (int i = 0; i < treeList1.Nodes.Count; i++)
            {
                TreeListNode row = treeList1.Nodes[i];
                if (row.ParentNode == null)
                {
                    foreach (TreeListColumn col in treeList1.Columns)
                    {
                        if (col.FieldName.IndexOf("y") > -1 && col.FieldName != "y1990")
                        {
                            object obj = row[col.FieldName];
                            if (obj != DBNull.Value)
                            {
                                Ps_Forecast_Math v = new Ps_Forecast_Math();
                                v.ForecastID = MIS.ProgUID;
                                v.ID         = (string)row["ID"];
                                v.Title      = row["Col3"].ToString() + "-" + row["Title"].ToString();
                                v.Sort       = Convert.ToInt32(col.FieldName.Replace("y", ""));
                                v.y1991      = (double)row[col.FieldName];

                                listValues.Add(v);
                            }
                        }
                    }
                }
            }

            this.chart_user1.RefreshChart(listValues, "Title", "Sort", "y1991", hs);
        }
Example #7
0
        private void RefreshChart(int syear, int eyear)
        {
            IList<FORBaseColor> list = Services.BaseService.GetList<FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-" + type + "'");

            IList<FORBaseColor> li = new List<FORBaseColor>();
            bool bl = false;
            foreach (DataRow row in dataTable.Rows)
            {
                bl = false;
                foreach (FORBaseColor bc in list)
                {
                    if (row["Title"].ToString() == bc.Title)
                    {
                        bl = true;
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.Color1 = Color.Blue;
                        CopyBaseColor(bc1, bc);
                        li.Add(bc1);
                    }

                }
                if (!bl)
                {
                    FORBaseColor bc1 = new FORBaseColor();
                    bc1.UID = Guid.NewGuid().ToString();
                    bc1.Remark = this.forecastReport.ID.ToString() + "-" + type;
                    bc1.Title = row["Title"].ToString();
                    bc1.Color = 16711680;
                    bc1.Color1 = Color.Blue;
                    Services.BaseService.Create<FORBaseColor>(bc1);
                    li.Add(bc1);
                }

            }
            ArrayList hs = new ArrayList();
            foreach (FORBaseColor bc2 in li)
            {
                hs.Add(bc2.Color1);
            }

            List<Ps_Forecast_Math> listValues = new List<Ps_Forecast_Math>();

            for (int i = 0; i < this.treeList1.Nodes.Count; i++)
            {
                TreeListNode row = treeList1.Nodes[i];
                foreach (TreeListColumn col in treeList1.Columns)
                {
                    if (col.FieldName.IndexOf("y") > -1)
                    {
                        int yyear = int.Parse(col.FieldName.Replace("y", ""));
                        if (yyear >= syear && yyear <= eyear)
                        {
                            object obj = row[col.FieldName];
                            if (obj != DBNull.Value)
                            {
                                Ps_Forecast_Math v = new Ps_Forecast_Math();
                                v.ForecastID = forecastReport.ID;
                                v.ID = (string)row["ID"];
                                v.Title = row["Title"].ToString();
                                v.Sort = Convert.ToInt32(col.FieldName.Replace("y", ""));
                                v.y1990 = (double)row[col.FieldName];

                                listValues.Add(v);
                            }
                        }
                    }
                }

            }
            this.chart_user1.RefreshChart(listValues, "Title", "Sort", "y1990", hs);
        }
Example #8
0
        private void RefreshChart(int syear, int eyear)
        {
            IList<FORBaseColor> list = Services.BaseService.GetList<FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-" + type + "'");

            IList<FORBaseColor> li = new List<FORBaseColor>();
            bool bl = false;
            foreach (DataRow row in dataTable.Rows)
            {
                bl = false;
                foreach (FORBaseColor bc in list)
                {
                    if (row["Title"].ToString() == bc.Title)
                    {
                        bl = true;
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.Color1 = Color.Blue;
                        CopyBaseColor(bc1, bc);
                        li.Add(bc1);
                    }

                }
                if (!bl)
                {
                    FORBaseColor bc1 = new FORBaseColor();
                    bc1.UID = Guid.NewGuid().ToString();
                    bc1.Remark = this.forecastReport.ID.ToString() + "-" + type;
                    bc1.Title = row["Title"].ToString();
                    bc1.Color = 16711680;
                    bc1.Color1 = Color.Blue;
                    Services.BaseService.Create<FORBaseColor>(bc1);
                    li.Add(bc1);
                }

            }
            ArrayList hs = new ArrayList();
            foreach (FORBaseColor bc2 in li)
            {
                hs.Add(bc2.Color1);
            }

            List<Ps_Forecast_Math> listValues = new List<Ps_Forecast_Math>();

            for (int i = 0; i < this.treeList1.Nodes.Count; i++)
            {
                TreeListNode row = treeList1.Nodes[i];
                foreach (TreeListColumn col in treeList1.Columns)
                {
                    if (col.FieldName.IndexOf("y") > -1)
                    {
                        int yyear = int.Parse(col.FieldName.Replace("y", ""));
                        if (yyear >= syear && yyear <= eyear)
                        {
                            object obj = row[col.FieldName];
                            if (obj != DBNull.Value)
                            {
                                Ps_Forecast_Math v = new Ps_Forecast_Math();
                                v.ForecastID = forecastReport.ID;
                                v.ID = (string)row["ID"];
                                v.Title = row["Title"].ToString();
                                v.Sort = Convert.ToInt32(col.FieldName.Replace("y", ""));
                                v.y1990 = (double)row[col.FieldName];

                                listValues.Add(v);
                            }
                        }
                    }
                }

            }

            chart1.Series.Clear();

            chart1.DataBindCrossTab(listValues, "Title", "Sort", "y1990", "");
            //for (int i = 0; i < chart1.Series.Count; i++)
            //{
            //    chart1.Series[i].Color = (Color)hs[i];
            //    chart1.Series[i].Name = (i + 1).ToString() + "." + chart1.Series[i].Name;
            //    chart1.Series[i].Type = Dundas.Charting.WinControl.SeriesChartType.Line;

            //    chart1.Series[i].MarkerSize = 7;
            //    chart1.Series[i].MarkerStyle = (Dundas.Charting.WinControl.MarkerStyle)(2);

            //}
            m_pf.SetChart(chart1, checkBox1, hs, null);
        }
Example #9
0
        private ArrayList chartbasecolor()
        {
            ArrayList basecolor = colorlist();

            IList<FORBaseColor> list = Services.BaseService.GetList<FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-" + typeFlag + "'");

            IList<FORBaseColor> li = new List<FORBaseColor>();
            bool bl = false;
            ArrayList aldatablr = new ArrayList();
            int m = 0;
            foreach (DataRow row in dataTable.Rows)
            {
                aldatablr.Add(row["ID"].ToString());
            }
            foreach (DataRow row in dataTable.Rows)
            {
                if (aldatablr.Contains(row["ParentID"].ToString()))
                    continue;
                bl = false;
                foreach (FORBaseColor bc in list)
                {
                    if (row["Title"].ToString() == bc.Title && row["ParentID"] != DBNull.Value)
                    {
                        bl = true;
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.Color1 = Color.Blue;
                        CopyBaseColor(bc1, bc);
                        li.Add(bc1);
                    }

                }
                if (!bl)
                {
                    FORBaseColor bc1 = new FORBaseColor();
                    bc1.UID = Guid.NewGuid().ToString();
                    bc1.Remark = this.forecastReport.ID.ToString() + "-" + typeFlag;
                    bc1.Title = row["Title"].ToString();
                    if (m == 0)
                    {
                        Random rd = new Random();
                        m = rd.Next(100);
                    }
                    Color cl = (Color)basecolor[m % 13];
                    bc1.Color = cl.ToArgb();

                    bc1.Color1 = cl;
                    Services.BaseService.Create<FORBaseColor>(bc1);
                    li.Add(bc1);
                }
                m++;
            }
            ArrayList hs = new ArrayList();
            foreach (FORBaseColor bc2 in li)
            {
                hs.Add(bc2.Color1);
            }
            return hs;
        }
Example #10
0
        private void RefreshChart()
        {
            IList <FORBaseColor> list = Services.BaseService.GetList <FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-" + type + "'");

            IList <FORBaseColor> li = new List <FORBaseColor>();
            bool      bl            = false;
            ArrayList aldatablr     = new ArrayList();

            foreach (DataRow row in dataTable.Rows)
            {
                aldatablr.Add(row["ID"].ToString());
            }
            foreach (DataRow row in dataTable.Rows)
            {
                if (aldatablr.Contains(row["ParentID"].ToString()))
                {
                    continue;
                }
                bl = false;
                foreach (FORBaseColor bc in list)
                {
                    if (row["Title"].ToString() == bc.Title)
                    {
                        bl = true;
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.Color1 = Color.Blue;
                        CopyBaseColor(bc1, bc);
                        li.Add(bc1);
                    }
                }
                if (!bl)
                {
                    FORBaseColor bc1 = new FORBaseColor();
                    bc1.UID    = Guid.NewGuid().ToString();
                    bc1.Remark = this.forecastReport.ID.ToString() + "-" + type;
                    bc1.Title  = row["Title"].ToString();
                    bc1.Color  = 16711680;
                    bc1.Color1 = Color.Blue;
                    Services.BaseService.Create <FORBaseColor>(bc1);
                    li.Add(bc1);
                }
            }
            ArrayList hs = new ArrayList();

            foreach (FORBaseColor bc2 in li)
            {
                hs.Add(bc2.Color1);
            }



            List <Ps_Forecast_Math> listValues = new List <Ps_Forecast_Math>();

            for (int i = 0; i < treeList1.Nodes.Count; i++)
            {
                TreeListNode row = treeList1.Nodes[i];
                foreach (TreeListColumn col in treeList1.Columns)
                {
                    if (col.FieldName.IndexOf("y") > -1)
                    {
                        object obj = row[col.FieldName];
                        if (obj != DBNull.Value)
                        {
                            Ps_Forecast_Math v = new Ps_Forecast_Math();
                            v.ForecastID = forecastReport.ID;
                            v.ID         = (string)row["ID"];
                            v.Title      = (i + 1).ToString() + "." + row["Title"].ToString();
                            v.Sort       = Convert.ToInt32(col.FieldName.Replace("y", ""));
                            v.y1990      = (double)row[col.FieldName];

                            listValues.Add(v);
                        }
                    }
                }
            }

            chart1.Series.Clear();
            ArrayList al = new ArrayList();

            al.Add(Application.StartupPath + "/img/1.ico");
            al.Add(Application.StartupPath + "/img/2.ico");
            al.Add(Application.StartupPath + "/img/3.ico");
            al.Add(Application.StartupPath + "/img/4.ico");
            al.Add(Application.StartupPath + "/img/5.ico");
            al.Add(Application.StartupPath + "/img/6.ico");
            al.Add(Application.StartupPath + "/img/7.ico");


            chart1.DataBindCrossTab(listValues, "Title", "Sort", "y1990", "");
            //for (int i = 0; i < chart1.Series.Count; i++)
            //{
            //    chart1.Series[i].Color = (Color)hs[i];
            //    chart1.Series[i].Name =  chart1.Series[i].Name;
            //    chart1.Series[i].Type = Dundas.Charting.WinControl.SeriesChartType.Line;
            //    chart1.Series[i].MarkerImage = al[i % 7].ToString();
            //    chart1.Series[i].MarkerSize = 7;
            //    chart1.Series[i].MarkerStyle = (Dundas.Charting.WinControl.MarkerStyle)(2);
            //    chart1.Series[i].XValueIndexed = false;

            //}

            //chart1.ChartAreas["Default"].AxisX.MinorGrid.Enabled = false;
            //chart1.ChartAreas["Default"].AxisY.MinorGrid.Enabled = true;
            //chart1.ChartAreas["Default"].AxisY.MinorGrid.LineStyle = ChartDashStyle.Dash;
            //chart1.ChartAreas["Default"].AxisY.MinorGrid.LineColor = Color.Gray;
            m_pf.SetChart(chart1, checkBox1, hs, al);
        }
Example #11
0
        /*
        private void RefreshChart()
        {

            IList<FORBaseColor> list = Services.BaseService.GetList<FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-" + typeFlag + "'");

            IList<FORBaseColor> li = new List<FORBaseColor>();
            bool bl = false;
            ArrayList aldatablr = new ArrayList();
            foreach (DataRow row in dataTable.Rows)
            {
                aldatablr.Add(row["ID"].ToString());
            }
            foreach (DataRow row in dataTable.Rows)
            {
                if (aldatablr.Contains(row["ParentID"].ToString()))
                    continue;
                bl = false;
                foreach (FORBaseColor bc in list)
                {
                    if (row["Title"].ToString() == bc.Title && row["ParentID"]!=DBNull.Value)
                    {
                        bl = true;
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.Color1 = Color.Blue;
                        CopyBaseColor(bc1, bc);
                        li.Add(bc1);
                    }

                }
                if (!bl)
                {
                    FORBaseColor bc1 = new FORBaseColor();
                    bc1.UID = Guid.NewGuid().ToString();
                    bc1.Remark = this.forecastReport.ID.ToString() + "-" + typeFlag;
                    bc1.Title = row["Title"].ToString();
                    bc1.Color = 16711680;
                    bc1.Color1 = Color.Blue;
                    Services.BaseService.Create<FORBaseColor>(bc1);
                    li.Add(bc1);
                }

            }
            ArrayList hs = new ArrayList();
            foreach (FORBaseColor bc2 in li)
            {
                hs.Add(bc2.Color1);
            }

            List<Ps_Forecast_Math> listValues = new List<Ps_Forecast_Math>();

            for (int i = 0; i < treeList1.Nodes.Count; i++)
            {
                TreeListNode row = treeList1.Nodes[i];
                foreach (TreeListColumn col in treeList1.Columns)
                {
                    if (col.FieldName.IndexOf("y") > -1)
                    {
                        object obj = row[col.FieldName];
                        if (obj != DBNull.Value)
                        {
                            Ps_Forecast_Math v = new Ps_Forecast_Math();
                            v.ForecastID = forecastReport.ID;
                            v.ID = (string)row["ID"];
                            v.Title = (i + 1).ToString() + "." + row["Title"].ToString();
                            v.Sort = Convert.ToInt32(col.FieldName.Replace("y", ""));
                            v.y1990 = (double)row[col.FieldName];

                            listValues.Add(v);
                        }
                    }
                }

            }

            chart1.Series.Clear();

            ArrayList al = new ArrayList();
            al.Add(Application.StartupPath+"/img/1.ico");
            al.Add(Application.StartupPath + "/img/2.ico");
            al.Add(Application.StartupPath + "/img/3.ico");
            al.Add(Application.StartupPath + "/img/4.ico");
            al.Add(Application.StartupPath + "/img/5.ico");
            al.Add(Application.StartupPath + "/img/6.ico");
            al.Add(Application.StartupPath + "/img/7.ico");
            //al.Add("img/8.ico");
            //al.Add("img/9.ico");
            //al.Add("img/10.ico");

            LegendItem legendItem;
            LegendCell legendCell1;
            LegendCell legendCell2;
            LegendCell legendCell3;
            Legend legend = new Legend();
            legend.AutoFitText = false;

            chart1.DataBindCrossTab(listValues, "Title", "Sort", "y1990", "");
            for (int i = 0; i < chart1.Series.Count; i++)
            {
                legendItem = new Dundas.Charting.WinControl.LegendItem();
                legendCell1 = new Dundas.Charting.WinControl.LegendCell();
                legendCell1.CellType = Dundas.Charting.WinControl.LegendCellType.Image;
                legendCell1.Name = "Cell1";

                legendCell2 = new Dundas.Charting.WinControl.LegendCell();
                legendCell3 = new Dundas.Charting.WinControl.LegendCell();
                legendCell2.CellType = Dundas.Charting.WinControl.LegendCellType.Image;
                legendCell2.Name = "Cell2";
                legendCell3.Alignment = System.Drawing.ContentAlignment.MiddleLeft;
                legendCell3.Name = "Cell3";
                legendCell3.Text = chart1.Series[i].Name;
                legendCell3.TextColor = (Color)hs[i];
                /*Ĭ������״ͼ����������DZ��line
               // chart1.Series[i].Color = (Color)hs[i];
               // chart1.Series[i].Name =chart1.Series[i].Name;
               // chart1.Series[i].Type = Dundas.Charting.WinControl.SeriesChartType.Line;

               // chart1.Series[i].MarkerImage = al[i % 7].ToString();
               // chart1.Series[i].MarkerSize = 7;
               // chart1.Series[i].MarkerStyle = (Dundas.Charting.WinControl.MarkerStyle)(2);

               //// chart1.Series[i].XValueIndexed = true;
                chart1.Series[i].Color = (Color)hs[i];
                chart1.Series[i].Name = (i + 1).ToString() + "." + chart1.Series[i].Name;
                chart1.Series[i].Type = Dundas.Charting.WinControl.SeriesChartType.Line;
                chart1.Series[i].MarkerImage = al[i % 7].ToString();
                chart1.Series[i].MarkerSize = 7;
                chart1.Series[i].MarkerStyle = (Dundas.Charting.WinControl.MarkerStyle)(2);

                chart1.Series[i].ShowInLegend = false;

                legendItem.Cells.Add(legendCell1);
                legendItem.Cells.Add(legendCell3);
                legendItem.Tag = chart1.Series[i];
                if (checkBox1.Checked)
                {
                    legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_checked.png");

                }
                else
                {
                    legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_unchecked.png");
                }
                legend.CustomItems.Add(legendItem);
                chart1.Series[i].Enabled = checkBox1.Checked;
            }

            chart1.ChartAreas["Default"].AxisX.MinorGrid.Enabled = false;
            chart1.ChartAreas["Default"].AxisY.MinorGrid.Enabled = true;
            chart1.ChartAreas["Default"].AxisY.MinorGrid.LineStyle = ChartDashStyle.Dash;
            chart1.ChartAreas["Default"].AxisY.MinorGrid.LineColor = Color.Gray;
            legend.Name = "Default";
            chart1.Legends.Add(legend);

        }
        */
        private void RefreshChart()
        {
            ArrayList ht = new ArrayList();
            ht.Add(Color.Red);
            ht.Add(Color.Blue);
            ht.Add(Color.Green);
            ht.Add(Color.Yellow);
            ht.Add(Color.HotPink);
            ht.Add(Color.LawnGreen);
            ht.Add(Color.Khaki);
            ht.Add(Color.LightSlateGray);
            ht.Add(Color.LightSeaGreen);
            ht.Add(Color.Lime);
            ht.Add(Color.Black);
            ht.Add(Color.Brown);
            ht.Add(Color.Crimson);
            int m = 0;
            IList<FORBaseColor> list = Services.BaseService.GetList<FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-" + typeFlag + "'");

            IList<FORBaseColor> li = new List<FORBaseColor>();
            bool bl = false;
            ArrayList aldatablr = new ArrayList();
            foreach (DataRow row in dataTable.Rows)
            {
                aldatablr.Add(row["ID"].ToString());
            }
            foreach (DataRow row in dataTable.Rows)
            {
                if (aldatablr.Contains(row["ParentID"].ToString()))
                    continue;
                bl = false;
                foreach (FORBaseColor bc in list)
                {
                    if (row["Title"].ToString() == bc.Title && row["ParentID"] != DBNull.Value)
                    {
                        bl = true;
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.Color1 = bc.Color1;
                        //bc1.Color1 = Color.Blue;
                        CopyBaseColor(bc1, bc);
                        li.Add(bc1);
                    }

                }
                if (!bl)
                {
                    FORBaseColor bc1 = new FORBaseColor();
                    bc1.UID = Guid.NewGuid().ToString();
                    bc1.Remark = this.forecastReport.ID.ToString() + "-" + typeFlag;
                    bc1.Title = row["Title"].ToString();
                    //bc1.Color = 16711680;
                    if (m == 0)
                    {
                        Random rd = new Random();
                        m = rd.Next(100);
                    }
                    Color cl = (Color)ht[m % 13];
                    bc1.Color = ColorTranslator.ToOle(cl);
                    bc1.Color1 =cl;
                    //bc1.Color1 = Color.Blue;
                    Services.BaseService.Create<FORBaseColor>(bc1);
                    li.Add(bc1);
                }
                m++;
            }
            ArrayList hs = new ArrayList();
            foreach (FORBaseColor bc2 in li)
            {
                hs.Add(bc2.Color1);
            }

            List<Ps_Forecast_Math> listValues = new List<Ps_Forecast_Math>();

            for (int i = 0; i < treeList1.Nodes.Count; i++)
            {
                TreeListNode row = treeList1.Nodes[i];
                foreach (TreeListColumn col in treeList1.Columns)
                {
                    if (col.FieldName.IndexOf("y") > -1)
                    {
                        object obj = row[col.FieldName];
                        if (obj != DBNull.Value)
                        {
                            Ps_Forecast_Math v = new Ps_Forecast_Math();
                            v.ForecastID = forecastReport.ID;
                            v.ID = (string)row["ID"];
                            v.Title =  row["Title"].ToString();
                            v.Sort = Convert.ToInt32(col.FieldName.Replace("y", ""));
                            v.y1990 = (double)row[col.FieldName];

                            listValues.Add(v);
                        }
                    }
                }

            }

            this.chart_user1.RefreshChart(listValues, "Title", "Sort", "y1990", hs);
        }
Example #12
0
        /// <summary>
        /// 刷新表格中的数据
        /// </summary>
        /// <returns>ture:成功  false:失败</returns>
        public bool RefreshData()
        {
            try
            {
                ////////IList<FORBaseColor> list = Services.BaseService.GetStrongList<FORBaseColor>();

                ////////foreach (FORBaseColor bb in list)
                ////////{
                ////////    Color cl = ColorTranslator.FromOle(bb.Color);
                ////////    bb.Color1 = cl;
                ////////}


                ////////this.gridControl.DataSource = list;
                IList <FORBaseColor> list = Services.BaseService.GetList <FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + id + "-" + forcolor + "'");

                IList <FORBaseColor> li = new List <FORBaseColor>();
                bool bl = false;


                ArrayList al = new ArrayList();
                foreach (DataRow row in dt.Rows)
                {
                    al.Add(row["ID"].ToString());
                }



                foreach (DataRow row in dt.Rows)
                {
                    //if (row["ParentID"].ToString().Length > 12)
                    //    continue;
                    if (al.Contains(row["ParentID"].ToString()))
                    {
                        continue;
                    }


                    bl = false;
                    foreach (FORBaseColor bc in list)
                    {
                        if (row["Title"].ToString() == bc.Title)
                        {
                            bl = true;
                            FORBaseColor bc1 = new FORBaseColor();
                            CopyBaseColor(bc1, bc);
                            li.Add(bc1);
                        }
                    }
                    if (!bl)
                    {
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.UID    = Guid.NewGuid().ToString();
                        bc1.Remark = id + "-" + forcolor;
                        bc1.Title  = row["Title"].ToString();
                        bc1.Color  = 0;
                        bc1.Color1 = Color.Black;
                        Services.BaseService.Create <FORBaseColor>(bc1);
                        li.Add(bc1);
                    }
                }

                this.gridControl.DataSource = li;
            }
            catch (Exception exc)
            {
                Debug.Fail(exc.Message);
                HandleException.TryCatch(exc);
                return(false);
            }

            return(true);
        }
Example #13
0
        /// <summary>
        /// �޸Ľ������
        /// </summary>
        public void UpdateObject()
        {
            //��ȡ�������
            FORBaseColor obj = FocusedObject;
            if (obj == null)
            {
                return;
            }

            //���������һ������
            FORBaseColor objCopy = new FORBaseColor();
            DataConverter.CopyTo<FORBaseColor>(obj, objCopy);

            //ִ���޸IJ���
            using (FrmBaseColorDialog dlg = new FrmBaseColorDialog())
            {
                dlg.Object = objCopy;   //�󶨸���
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //�ø������½������
            DataConverter.CopyTo<FORBaseColor>(objCopy, obj);
            //ˢ�±��
            gridControl.RefreshDataSource();
        }
Example #14
0
        /// <summary>
        /// ˢ�±���е�����
        /// </summary>
        /// <returns>ture:�ɹ�  false:ʧ��</returns>
        public bool RefreshData()
        {
            try
            {
                ////////IList<FORBaseColor> list = Services.BaseService.GetStrongList<FORBaseColor>();

                ////////foreach (FORBaseColor bb in list)
                ////////{
                ////////    Color cl = ColorTranslator.FromOle(bb.Color);
                ////////    bb.Color1 = cl;
                ////////}

                ////////this.gridControl.DataSource = list;
                IList<FORBaseColor> list = Services.BaseService.GetList<FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + id +"-"+forcolor+ "'");

                IList<FORBaseColor> li = new List<FORBaseColor>();
                bool bl = false;

                ArrayList al = new ArrayList();
                foreach (DataRow row in dt.Rows)
                {
                    al.Add(row["ID"].ToString());
                }

                foreach (DataRow row in dt.Rows)
                {
                    //if (row["ParentID"].ToString().Length > 12)
                    //    continue;
                    if(al.Contains(row["ParentID"].ToString()))
                        continue;

                    bl = false;
                    foreach (FORBaseColor bc in list)
                    {
                        if (row["Title"].ToString() == bc.Title)
                        {
                            bl = true;
                            FORBaseColor bc1 = new FORBaseColor();
                            CopyBaseColor(bc1, bc);
                            li.Add(bc1);
                        }

                    }
                    if (!bl)
                    {
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.UID = Guid.NewGuid().ToString();
                        bc1.Remark = id + "-" + forcolor;
                        bc1.Title = row["Title"].ToString();
                        bc1.Color = 0;
                        bc1.Color1 = Color.Black;
                        Services.BaseService.Create<FORBaseColor>(bc1);
                        li.Add(bc1);
                    }

                }

                this.gridControl.DataSource = li;

            }
            catch (Exception exc)
            {
                Debug.Fail(exc.Message);
                HandleException.TryCatch(exc);
                return false;
            }

            return true;
        }
Example #15
0
        /// <summary>
        /// ��Ӷ���
        /// </summary>
        public void AddObject()
        {
            //�����������Ƿ��Ѿ�����
            if (ObjectList == null)
            {
                return;
            }
            //�½�����
            FORBaseColor obj = new FORBaseColor();
            obj.Remark = id;

            //ִ����Ӳ���
            using (FrmBaseColorDialog dlg = new FrmBaseColorDialog())
            {
                dlg.IsCreate = true;    //�����½���־
                dlg.Object = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //���¶�����뵽������
            ObjectList.Add(obj);

            //ˢ�±�񣬲��������ж�λ���¶����ϡ�
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
        }
        private void RefreshChart()
        {
            IList<FORBaseColor> list = Services.BaseService.GetList<FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-1" + type + "'");

            IList<FORBaseColor> li = new List<FORBaseColor>();
            bool bl = false;
            foreach (DataRow row in dataTable2.Rows)
            {
                bl = false;
                foreach (FORBaseColor bc in list)
                {
                    if (row["Title"].ToString() == bc.Title)
                    {
                        bl = true;
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.Color1 = Color.Blue;
                        CopyBaseColor(bc1, bc);
                        li.Add(bc1);
                    }

                }
                if (!bl)
                {
                    FORBaseColor bc1 = new FORBaseColor();
                    bc1.UID = Guid.NewGuid().ToString();
                    bc1.Remark = this.forecastReport.ID.ToString() + "-1" + type;
                    bc1.Title = row["Title"].ToString();
                    bc1.Color = 16711680;
                    bc1.Color1 = Color.Blue;
                    Services.BaseService.Create<FORBaseColor>(bc1);
                    li.Add(bc1);
                }

            }
            ArrayList hs = new ArrayList();
            foreach (FORBaseColor bc2 in li)
            {
                hs.Add(bc2.Color1);
            }

            List<Ps_Forecast_Math> listValues = new List<Ps_Forecast_Math>();

            for (int i = 0; i < treeList2.Nodes.Count; i++)
            {
                TreeListNode row = treeList2.Nodes[i];

                TreeListNode row1 = treeList1.Nodes[i];
                foreach (TreeListColumn col in treeList1.Columns)
                {
                    if (col.FieldName.IndexOf("y") > -1)
                    {
                        object obj = row[col.FieldName];
                        if (obj != DBNull.Value)
                        {
                            Ps_Forecast_Math v = new Ps_Forecast_Math();
                            v.ForecastID = forecastReport.ID;
                            v.ID = (string)row["ID"];
                            v.Title = (i + 1).ToString() + "." + row["Title"].ToString();
                            v.Sort = Convert.ToInt32(col.FieldName.Replace("y", ""));
                            v.y1990 = (double)row[col.FieldName]+(double)row1[col.FieldName];

                            listValues.Add(v);
                        }
                    }
                }

            }

            chart1.Series.Clear();
            ArrayList al = new ArrayList();
            al.Add(Application.StartupPath + "/img/1.ico");
            al.Add(Application.StartupPath + "/img/2.ico");
            al.Add(Application.StartupPath + "/img/3.ico");
            al.Add(Application.StartupPath + "/img/4.ico");
            al.Add(Application.StartupPath + "/img/5.ico");
            al.Add(Application.StartupPath + "/img/6.ico");
            al.Add(Application.StartupPath + "/img/7.ico");

            chart1.DataBindCrossTab(listValues, "Title", "Sort", "y1990", "");
            for (int i = 0; i < chart1.Series.Count; i++)
            {
                chart1.Series[i].Color = (Color)hs[i];
                chart1.Series[i].Name = chart1.Series[i].Name;
                chart1.Series[i].Type = Dundas.Charting.WinControl.SeriesChartType.Line;
                chart1.Series[i].MarkerImage = al[i % 7].ToString();
                chart1.Series[i].MarkerSize = 7;
                chart1.Series[i].MarkerStyle = (Dundas.Charting.WinControl.MarkerStyle)(2);

            }
        }
Example #17
0
 private void CopyBaseColor(FORBaseColor bc1, FORBaseColor bc2)
 {
     bc1.UID = bc2.UID;
     bc1.Title = bc2.Title;
     bc1.Remark = bc2.Remark;
     bc1.Color = bc2.Color;
     bc1.Color1 = ColorTranslator.FromOle(bc2.Color);
 }
Example #18
0
        private void RefreshChart()
        {
            //ArrayList ht = new ArrayList();
            //ht.Add(Color.Red);
            //ht.Add(Color.Blue);
            //ht.Add(Color.Green);
            //ht.Add(Color.Yellow);
            //ht.Add(Color.HotPink);
            //ht.Add(Color.LawnGreen);
            //ht.Add(Color.Khaki);
            //ht.Add(Color.LightSlateGray);
            //ht.Add(Color.LightSeaGreen);
            //ht.Add(Color.Lime);

            IList<FORBaseColor> list = Services.BaseService.GetList<FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-" + typeFlag + "'");

            IList<FORBaseColor> li = new List<FORBaseColor>();
            bool bl = false;
            foreach (DataRow row in dataTable.Rows)
            {

                bl = false;
                foreach (FORBaseColor bc in list)
                {
                    if (row["Title"].ToString() == bc.Title)
                    {
                        bl = true;
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.Color1 = Color.Blue;
                        CopyBaseColor(bc1, bc);
                        li.Add(bc1);
                    }

                }
                if (!bl)
                {
                    FORBaseColor bc1 = new FORBaseColor();
                    bc1.UID = Guid.NewGuid().ToString();
                    bc1.Remark = this.forecastReport.ID.ToString() + "-" + typeFlag;
                    bc1.Title = row["Title"].ToString();
                    bc1.Color = 16711680;
                    bc1.Color1 = Color.Blue;
                    Services.BaseService.Create<FORBaseColor>(bc1);
                    li.Add(bc1);
                }

            }
            ArrayList ht = new ArrayList();
            foreach (FORBaseColor bc2 in li)
            {
                ht.Add(bc2.Color1);
            }

            List<Ps_Forecast_Math> listValues = new List<Ps_Forecast_Math>();

            for (int i = 0; i < this.dataTable.Rows.Count; i++)
            {
                DataRow row = this.dataTable.Rows[i];
                foreach (TreeListColumn col in treeList1.Columns)
                {
                    if (col.FieldName.IndexOf("y") > -1)
                    {
                        object obj = row[col.FieldName];
                        if (obj != DBNull.Value)
                        {
                            Ps_Forecast_Math v = new Ps_Forecast_Math();
                            v.ForecastID = forecastReport.ID;
                            v.ID = (string)row["ID"];
                            v.Title = row["Title"].ToString();
                            v.Sort = Convert.ToInt32(col.FieldName.Replace("y", ""));
                            v.y1990 = (double)row[col.FieldName];

                            listValues.Add(v);
                        }
                    }
                }

            }

            chart1.Series.Clear();

            ArrayList al = new ArrayList();
            al.Add(Application.StartupPath + "/img/1.ico");
            al.Add(Application.StartupPath + "/img/2.ico");
            al.Add(Application.StartupPath + "/img/3.ico");
            al.Add(Application.StartupPath + "/img/4.ico");
            al.Add(Application.StartupPath + "/img/5.ico");
            al.Add(Application.StartupPath + "/img/6.ico");
            al.Add(Application.StartupPath + "/img/7.ico");

            chart1.DataBindCrossTab(listValues, "Title", "Sort", "y1990", "");
            LegendItem legendItem;
            LegendCell legendCell1;
            LegendCell legendCell2;
            LegendCell legendCell3;
            Legend legend = new Legend();
            legend.AutoFitText = false;
            //legend.BackColor = System.Drawing.Color.Transparent;
            //legend.BorderColor = System.Drawing.Color.FromArgb(((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)));
            for (int i = 0; i < chart1.Series.Count; i++)
            {
                int j = i % 10;
                legendItem = new Dundas.Charting.WinControl.LegendItem();
                legendCell1 = new Dundas.Charting.WinControl.LegendCell();
                legendCell2 = new Dundas.Charting.WinControl.LegendCell();
                legendCell3 = new Dundas.Charting.WinControl.LegendCell();
                legendCell1.CellType = Dundas.Charting.WinControl.LegendCellType.Image;
                legendCell2.CellType = Dundas.Charting.WinControl.LegendCellType.Image;
                legendCell1.Name = "Cell1";
                legendCell2.Name = "Cell2";
                legendCell3.Alignment = System.Drawing.ContentAlignment.MiddleLeft;
                legendCell3.Name = "Cell3";
                legendCell3.Text = chart1.Series[i].Name;
                legendCell3.TextColor = (Color)ht[i];
                chart1.Series[i].Color = (Color)ht[i];
                chart1.Series[i].Name = (i + 1).ToString() + "." + chart1.Series[i].Name;
                chart1.Series[i].Type = Dundas.Charting.WinControl.SeriesChartType.Line;
                chart1.Series[i].MarkerImage = al[i % 7].ToString();
                chart1.Series[i].MarkerSize = 7;
                chart1.Series[i].MarkerStyle = (Dundas.Charting.WinControl.MarkerStyle)(2);
                chart1.Series[i].ShowInLegend = false;
                chart1.Series[i].Enabled = true;
                chart1.Series[i].XValueIndexed = true;
                legendItem.Cells.Add(legendCell1);
                legendItem.Cells.Add(legendCell2);
                legendItem.Cells.Add(legendCell3);
                legendItem.Tag = chart1.Series[i];
                legendItem.Cells[1].Image = al[i % 7].ToString();
                if (checkBox1.Checked)
                {
                    legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_checked.png");

                }
                else
                {
                    legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_unchecked.png");
                }
                legend.CustomItems.Add(legendItem);
                chart1.Series[i].Enabled = checkBox1.Checked;

            }
            chart1.ChartAreas["Default"].AxisY.MinorGrid.Enabled = true;
            chart1.ChartAreas["Default"].AxisY.MinorGrid.LineStyle = ChartDashStyle.Dash;
            chart1.ChartAreas["Default"].AxisY.MinorGrid.LineColor = Color.Gray;

            legend.Name = "Default";

            this.chart1.Legends.Add(legend);
        }
Example #19
0
        private void barButtonItem24_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode row = this.treeList1.FocusedNode;
            if (row == null)
            {
                return;
            }

            if (row.Nodes.Count > 0)
            {
                MsgBox.Show("���¼����࣬����ɾ��");
                return;
            }

            string parentid = row["ParentID"].ToString();

            if (MsgBox.ShowYesNo("�Ƿ�ɾ������ " + row["Title"].ToString() + "��") == DialogResult.Yes)
            {
                Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
                ForecastClass1.TreeNodeToDataObject(psp_Type, row);
                //psp_Type = Itop.Common.DataConverter.RowToObject<Ps_Forecast_Math>(row);
                Ps_Forecast_Math psp_Values = new Ps_Forecast_Math();
                psp_Values.ID = psp_Type.ID;

                try
                {
                    //DeletePSP_ValuesByType����ɾ�����ݺͷ���
                    Common.Services.BaseService.Delete<Ps_Forecast_Math>(psp_Values);
                    FORBaseColor bc1 = new FORBaseColor();

                    bc1.Remark = forecastReport.ID+ "-" + typeFlag;
                    bc1.Title = row["Title"].ToString();
                    Common.Services.BaseService.Update("DeleteFORBaseColorByTitleRemark", bc1);

                    this.treeList1.Nodes.Remove(row);
                }
                catch (Exception ex)
                {
                    this.Cursor = Cursors.WaitCursor;
                    LoadData();
                    this.Cursor = Cursors.Default;
                }
                RefreshChart();
            }
        }
Example #20
0
        private void RefreshChart()
        {
            IList <FORBaseColor> list = Services.BaseService.GetList <FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-" + type + "'");

            IList <FORBaseColor> li = new List <FORBaseColor>();
            bool bl = false;

            foreach (DataRow row in dataTable2.Rows)
            {
                bl = false;
                foreach (FORBaseColor bc in list)
                {
                    if (row["Title"].ToString() == bc.Title)
                    {
                        bl = true;
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.Color1 = Color.Blue;
                        CopyBaseColor(bc1, bc);
                        li.Add(bc1);
                    }
                }
                if (!bl)
                {
                    FORBaseColor bc1 = new FORBaseColor();
                    bc1.UID    = Guid.NewGuid().ToString();
                    bc1.Remark = this.forecastReport.ID.ToString() + "-" + type;
                    bc1.Title  = row["Title"].ToString();
                    bc1.Color  = 16711680;
                    bc1.Color1 = Color.Blue;
                    Services.BaseService.Create <FORBaseColor>(bc1);
                    li.Add(bc1);
                }
            }
            ArrayList hs = new ArrayList();

            foreach (FORBaseColor bc2 in li)
            {
                hs.Add(bc2.Color1);
            }



            List <Ps_Forecast_Math> listValues = new List <Ps_Forecast_Math>();

            for (int i = 0; i < gridView2.RowCount; i++)
            {
                DataRow row = gridView2.GetDataRow(i);
                foreach (GridColumn col in gridView2.Columns)
                {
                    if (col.FieldName.IndexOf("y") > -1)
                    {
                        object obj = row[col.FieldName];
                        if (obj != DBNull.Value)
                        {
                            Ps_Forecast_Math v = new Ps_Forecast_Math();
                            v.ForecastID = forecastReport.ID;
                            v.ID         = (string)row["ID"];
                            v.Title      = (i + 1).ToString() + "." + row["Title"].ToString();
                            v.Sort       = Convert.ToInt32(col.FieldName.Replace("y", ""));
                            v.y1990      = (double)row[col.FieldName];

                            listValues.Add(v);
                        }
                    }
                }
            }

            chart1.Series.Clear();
            ArrayList al = new ArrayList();

            al.Add(Application.StartupPath + "/img/1.ico");
            al.Add(Application.StartupPath + "/img/2.ico");
            al.Add(Application.StartupPath + "/img/3.ico");
            al.Add(Application.StartupPath + "/img/4.ico");
            al.Add(Application.StartupPath + "/img/5.ico");
            al.Add(Application.StartupPath + "/img/6.ico");
            al.Add(Application.StartupPath + "/img/7.ico");


            chart1.DataBindCrossTab(listValues, "Title", "Sort", "y1990", "");
            for (int i = 0; i < chart1.Series.Count; i++)
            {
                chart1.Series[i].Color       = (Color)hs[i];
                chart1.Series[i].Name        = chart1.Series[i].Name;
                chart1.Series[i].Type        = Dundas.Charting.WinControl.SeriesChartType.Line;
                chart1.Series[i].MarkerImage = al[i % 7].ToString();
                chart1.Series[i].MarkerSize  = 7;
                chart1.Series[i].MarkerStyle = (Dundas.Charting.WinControl.MarkerStyle)(2);
            }
        }
Example #21
0
        private void RefreshChart(int syear, int eyear)
        {
            IList <FORBaseColor> list = Services.BaseService.GetList <FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-" + type + "'");

            IList <FORBaseColor> li = new List <FORBaseColor>();
            bool bl = false;

            foreach (DataRow row in dataTable.Rows)
            {
                bl = false;
                foreach (FORBaseColor bc in list)
                {
                    if (row["Title"].ToString() == bc.Title)
                    {
                        bl = true;
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.Color1 = Color.Blue;
                        CopyBaseColor(bc1, bc);
                        li.Add(bc1);
                    }
                }
                if (!bl)
                {
                    FORBaseColor bc1 = new FORBaseColor();
                    bc1.UID    = Guid.NewGuid().ToString();
                    bc1.Remark = this.forecastReport.ID.ToString() + "-" + type;
                    bc1.Title  = row["Title"].ToString();
                    bc1.Color  = 16711680;
                    bc1.Color1 = Color.Blue;
                    Services.BaseService.Create <FORBaseColor>(bc1);
                    li.Add(bc1);
                }
            }
            ArrayList hs = new ArrayList();

            foreach (FORBaseColor bc2 in li)
            {
                hs.Add(bc2.Color1);
            }

            List <Ps_Forecast_Math> listValues = new List <Ps_Forecast_Math>();

            for (int i = 0; i < this.treeList1.Nodes.Count; i++)
            {
                TreeListNode row = treeList1.Nodes[i];
                foreach (TreeListColumn col in treeList1.Columns)
                {
                    if (col.FieldName.IndexOf("y") > -1)
                    {
                        int yyear = int.Parse(col.FieldName.Replace("y", ""));
                        if (yyear >= syear && yyear <= eyear)
                        {
                            object obj = row[col.FieldName];
                            if (obj != DBNull.Value)
                            {
                                Ps_Forecast_Math v = new Ps_Forecast_Math();
                                v.ForecastID = forecastReport.ID;
                                v.ID         = (string)row["ID"];
                                v.Title      = row["Title"].ToString();
                                v.Sort       = Convert.ToInt32(col.FieldName.Replace("y", ""));
                                v.y1990      = (double)row[col.FieldName];

                                listValues.Add(v);
                            }
                        }
                    }
                }
            }

            chart1.Series.Clear();


            chart1.DataBindCrossTab(listValues, "Title", "Sort", "y1990", "");
            //for (int i = 0; i < chart1.Series.Count; i++)
            //{
            //    chart1.Series[i].Color = (Color)hs[i];
            //    chart1.Series[i].Name = (i + 1).ToString() + "." + chart1.Series[i].Name;
            //    chart1.Series[i].Type = Dundas.Charting.WinControl.SeriesChartType.Line;

            //    chart1.Series[i].MarkerSize = 7;
            //    chart1.Series[i].MarkerStyle = (Dundas.Charting.WinControl.MarkerStyle)(2);

            //}
            m_pf.SetChart(chart1, checkBox1, hs, null);
        }
        private void RefreshChart(int syear, int eyear)
        {
            IList <FORBaseColor> list = Services.BaseService.GetList <FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-" + type + "'");

            IList <FORBaseColor> li = new List <FORBaseColor>();
            bool bl = false;

            foreach (DataRow row in dataTable.Rows)
            {
                bl = false;
                foreach (FORBaseColor bc in list)
                {
                    if (row["Title"].ToString() == bc.Title)
                    {
                        bl = true;
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.Color1 = Color.Blue;
                        CopyBaseColor(bc1, bc);
                        li.Add(bc1);
                    }
                }
                if (!bl)
                {
                    FORBaseColor bc1 = new FORBaseColor();
                    bc1.UID    = Guid.NewGuid().ToString();
                    bc1.Remark = this.forecastReport.ID.ToString() + "-" + type;
                    bc1.Title  = row["Title"].ToString();
                    bc1.Color  = 16711680;
                    bc1.Color1 = Color.Blue;
                    Services.BaseService.Create <FORBaseColor>(bc1);
                    li.Add(bc1);
                }
            }
            ArrayList hs = new ArrayList();

            foreach (FORBaseColor bc2 in li)
            {
                hs.Add(bc2.Color1);
            }

            List <Ps_Forecast_Math> listValues = new List <Ps_Forecast_Math>();

            for (int i = 0; i < this.treeList1.Nodes.Count; i++)
            {
                TreeListNode row = treeList1.Nodes[i];
                foreach (TreeListColumn col in treeList1.Columns)
                {
                    if (col.FieldName.IndexOf("y") > -1)
                    {
                        int yyear = int.Parse(col.FieldName.Replace("y", ""));
                        if (yyear >= syear && yyear <= eyear)
                        {
                            object obj = row[col.FieldName];
                            if (obj != DBNull.Value)
                            {
                                Ps_Forecast_Math v = new Ps_Forecast_Math();
                                v.ForecastID = forecastReport.ID;
                                v.ID         = (string)row["ID"];
                                v.Title      = row["Title"].ToString();
                                v.Sort       = Convert.ToInt32(col.FieldName.Replace("y", ""));
                                v.y1990      = (double)row[col.FieldName];

                                listValues.Add(v);
                            }
                        }
                    }
                }
            }

            this.chart_user1.RefreshChart(listValues, "Title", "Sort", "y1990", hs);
        }
Example #23
0
        private void RefreshChart()
        {
            //ArrayList ht = new ArrayList();
            //ht.Add(Color.Red);
            //ht.Add(Color.Blue);
            //ht.Add(Color.Green);
            //ht.Add(Color.Yellow);
            //ht.Add(Color.HotPink);
            //ht.Add(Color.LawnGreen);
            //ht.Add(Color.Khaki);
            //ht.Add(Color.LightSlateGray);
            //ht.Add(Color.LightSeaGreen);
            //ht.Add(Color.Lime);

            IList <FORBaseColor> list = Services.BaseService.GetList <FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-" + typeFlag + "'");

            IList <FORBaseColor> li = new List <FORBaseColor>();
            bool bl = false;

            foreach (DataRow row in dataTable.Rows)
            {
                bl = false;
                foreach (FORBaseColor bc in list)
                {
                    if (row["Title"].ToString() == bc.Title)
                    {
                        bl = true;
                        FORBaseColor bc1 = new FORBaseColor();
                        bc1.Color1 = Color.Blue;
                        CopyBaseColor(bc1, bc);
                        li.Add(bc1);
                    }
                }
                if (!bl)
                {
                    FORBaseColor bc1 = new FORBaseColor();
                    bc1.UID    = Guid.NewGuid().ToString();
                    bc1.Remark = this.forecastReport.ID.ToString() + "-" + typeFlag;
                    bc1.Title  = row["Title"].ToString();
                    bc1.Color  = 16711680;
                    bc1.Color1 = Color.Blue;
                    Services.BaseService.Create <FORBaseColor>(bc1);
                    li.Add(bc1);
                }
            }
            ArrayList ht = new ArrayList();

            foreach (FORBaseColor bc2 in li)
            {
                ht.Add(bc2.Color1);
            }


            List <Ps_Forecast_Math> listValues = new List <Ps_Forecast_Math>();

            for (int i = 0; i < this.dataTable.Rows.Count; i++)
            {
                DataRow row = this.dataTable.Rows[i];
                foreach (TreeListColumn col in treeList1.Columns)
                {
                    if (col.FieldName.IndexOf("y") > -1)
                    {
                        object obj = row[col.FieldName];
                        if (obj != DBNull.Value)
                        {
                            Ps_Forecast_Math v = new Ps_Forecast_Math();
                            v.ForecastID = forecastReport.ID;
                            v.ID         = (string)row["ID"];
                            v.Title      = row["Title"].ToString();
                            v.Sort       = Convert.ToInt32(col.FieldName.Replace("y", ""));
                            v.y1990      = (double)row[col.FieldName];

                            listValues.Add(v);
                        }
                    }
                }
            }

            chart1.Series.Clear();

            ArrayList al = new ArrayList();

            al.Add(Application.StartupPath + "/img/1.ico");
            al.Add(Application.StartupPath + "/img/2.ico");
            al.Add(Application.StartupPath + "/img/3.ico");
            al.Add(Application.StartupPath + "/img/4.ico");
            al.Add(Application.StartupPath + "/img/5.ico");
            al.Add(Application.StartupPath + "/img/6.ico");
            al.Add(Application.StartupPath + "/img/7.ico");

            chart1.DataBindCrossTab(listValues, "Title", "Sort", "y1990", "");
            LegendItem legendItem;
            LegendCell legendCell1;
            LegendCell legendCell2;
            LegendCell legendCell3;
            Legend     legend = new Legend();

            legend.AutoFitText = false;
            //legend.BackColor = System.Drawing.Color.Transparent;
            //legend.BorderColor = System.Drawing.Color.FromArgb(((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)));
            for (int i = 0; i < chart1.Series.Count; i++)
            {
                int j = i % 10;
                legendItem                     = new Dundas.Charting.WinControl.LegendItem();
                legendCell1                    = new Dundas.Charting.WinControl.LegendCell();
                legendCell2                    = new Dundas.Charting.WinControl.LegendCell();
                legendCell3                    = new Dundas.Charting.WinControl.LegendCell();
                legendCell1.CellType           = Dundas.Charting.WinControl.LegendCellType.Image;
                legendCell2.CellType           = Dundas.Charting.WinControl.LegendCellType.Image;
                legendCell1.Name               = "Cell1";
                legendCell2.Name               = "Cell2";
                legendCell3.Alignment          = System.Drawing.ContentAlignment.MiddleLeft;
                legendCell3.Name               = "Cell3";
                legendCell3.Text               = chart1.Series[i].Name;
                legendCell3.TextColor          = (Color)ht[i];
                chart1.Series[i].Color         = (Color)ht[i];
                chart1.Series[i].Name          = (i + 1).ToString() + "." + chart1.Series[i].Name;
                chart1.Series[i].Type          = Dundas.Charting.WinControl.SeriesChartType.Line;
                chart1.Series[i].MarkerImage   = al[i % 7].ToString();
                chart1.Series[i].MarkerSize    = 7;
                chart1.Series[i].MarkerStyle   = (Dundas.Charting.WinControl.MarkerStyle)(2);
                chart1.Series[i].ShowInLegend  = false;
                chart1.Series[i].Enabled       = true;
                chart1.Series[i].XValueIndexed = true;
                legendItem.Cells.Add(legendCell1);
                legendItem.Cells.Add(legendCell2);
                legendItem.Cells.Add(legendCell3);
                legendItem.Tag            = chart1.Series[i];
                legendItem.Cells[1].Image = al[i % 7].ToString();
                if (checkBox1.Checked)
                {
                    legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_checked.png");
                }
                else
                {
                    legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_unchecked.png");
                }
                legend.CustomItems.Add(legendItem);
                chart1.Series[i].Enabled = checkBox1.Checked;
            }
            chart1.ChartAreas["Default"].AxisY.MinorGrid.Enabled   = true;
            chart1.ChartAreas["Default"].AxisY.MinorGrid.LineStyle = ChartDashStyle.Dash;
            chart1.ChartAreas["Default"].AxisY.MinorGrid.LineColor = Color.Gray;

            legend.Name = "Default";

            this.chart1.Legends.Add(legend);
        }
Example #24
0
        private void RefreshChart()
        {
            IList <FORBaseColor> list = Services.BaseService.GetList <FORBaseColor>("SelectFORBaseColorByWhere", "Remark='电力发展实绩-" + Itop.Client.MIS.ProgUID + "-1'");

            IList <FORBaseColor> li = new List <FORBaseColor>();
            bool      bl            = false;
            ArrayList ht            = new ArrayList();

            ht.Add(Color.Red);
            ht.Add(Color.Blue);
            ht.Add(Color.Green);
            ht.Add(Color.Yellow);
            ht.Add(Color.HotPink);
            ht.Add(Color.LawnGreen);
            ht.Add(Color.Khaki);
            ht.Add(Color.LightSlateGray);
            ht.Add(Color.LightSeaGreen);
            ht.Add(Color.Lime);
            ArrayList hs        = new ArrayList();
            int       m         = 0;
            ArrayList aldatablr = new ArrayList();

            foreach (DataRow row in dataTable.Rows)
            {
                aldatablr.Add(row["ID"].ToString());
            }
            foreach (DataRow row in dataTable.Rows)
            {
                if (aldatablr.Contains(row["ParentID"].ToString()))
                {
                    continue;
                }
                bl = false;
                foreach (FORBaseColor bc in list)
                {
                    if (row["Title"].ToString() == bc.Title)
                    {
                        m++;
                        bl = true;
                        FORBaseColor bc1 = new FORBaseColor();
                        Color        cl  = (Color)ht[m % 10];
                        bc1.Color1 = cl;
                        //bc1.Color = cl.ToArgb();
                        //bc1.Color1 = Color.Blue;

                        ////bc1.Color = 0;
                        ////bc1.Color1 = bc.Color1;
                        //bc1.Color1 = ColorTranslator.FromOle(bc.Color);
                        //CopyBaseColor(bc1, bc);
                        li.Add(bc1);
                    }
                }
                if (!bl)
                {
                    FORBaseColor bc1 = new FORBaseColor();
                    bc1.UID = Guid.NewGuid().ToString();
                    //bc1.Remark = "电力发展实绩" + "-" + ProjectUID + "-0";
                    bc1.Remark = "电力发展实绩-" + Itop.Client.MIS.ProgUID + "-1";
                    bc1.Title  = row["Title"].ToString();
                    //bc1.Color = 16711680;
                    //bc1.Color1 = Color.Blue;
                    Color cl = (Color)ht[m % 10];
                    bc1.Color  = 0;
                    bc1.Color1 = Color.Black;
                    Services.BaseService.Create <FORBaseColor>(bc1);
                    li.Add(bc1);
                    m++;
                }
            }

            foreach (FORBaseColor bc2 in li)
            {
                //bc2.Color1 = Color.Black;
                hs.Add(bc2.Color1);
            }


            List <Ps_History> listValues = new List <Ps_History>();

            for (int i = 0; i < treeList1.Nodes.Count; i++)
            {
                TreeListNode row = treeList1.Nodes[i];
                foreach (TreeListColumn col in treeList1.Columns)
                {
                    if (col.FieldName.IndexOf("y") > -1)
                    {
                        object obj = row[col.FieldName];
                        if (obj != DBNull.Value)
                        {
                            Ps_History v = new Ps_History();
                            v.ForecastID = type1;
                            v.ID         = (string)row["ID"];
                            v.Title      = (i + 1).ToString() + "." + row["Title"].ToString();
                            v.Sort       = Convert.ToInt32(col.FieldName.Replace("y", ""));
                            v.y1990      = (double)row[col.FieldName];

                            listValues.Add(v);
                        }
                    }
                }
            }

            chart1.Series.Clear();


            chart1.DataBindCrossTab(listValues, "Title", "Sort", "y1990", "");
            for (int i = 0; i < chart1.Series.Count; i++)
            {
                //chart1.Series[i].Color = (Color)hs[i];
                //chart1.Series[i].Name = (i + 1).ToString() + "." + chart1.Series[i].Name;
                //chart1.Series[i].Type = Dundas.Charting.WinControl.SeriesChartType.Line;

                //chart1.Series[i].MarkerSize = 7;
                //chart1.Series[i].MarkerStyle = (Dundas.Charting.WinControl.MarkerStyle)(2);
                chart1.Series[i].Color = (Color)hs[i];

                chart1.Series[i].Name = chart1.Series[i].Name;
                chart1.Series[i].Type = Dundas.Charting.WinControl.SeriesChartType.Line;

                chart1.Series[i].MarkerSize  = 7;
                chart1.Series[i].MarkerStyle = (Dundas.Charting.WinControl.MarkerStyle)(2);
                //chart1.Series[i].XValueIndexed = true;
            }
        }