Beispiel #1
0
 private void CopyBaseColor(BaseColor bc1, BaseColor bc2)
 {
     bc1.UID = bc2.UID;
     bc1.Title = bc2.Title;
     bc1.Remark = bc2.Remark;
     bc1.Color = bc2.Color;
     bc1.Color1 = ColorTranslator.FromOle(bc2.Color);
 }
Beispiel #2
0
        private void RefreshChart()
        {
            List<PSP_ForecastValues> listValues = new List<PSP_ForecastValues>();

                    foreach (TreeListNode nd in treeList1.Nodes)
                    {
                        AddNodeDataToList(nd, listValues);
                    }

                    chart1.Series.Clear();

                    //if (!CheckChartData(listValues))
                    //{
                    //    MsgBox.Show("Ԥ���������쳣������ͼ�޷���ʾ��");
                    //    return;
                    //}

                    IList<BaseColor> list = Services.BaseService.GetList<BaseColor>("SelectBaseColorByWhere", "Remark='" + this.forecastReport.ID + "'");

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

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

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

                        chart1.DataBindCrossTab(listValues, "Caption", "Year", "Value", "");
                        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.Substring(0, chart1.Series[i].Name.IndexOf(","));
                                chart1.Series[i].Type = Dundas.Charting.WinControl.SeriesChartType.Line;

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

                        }
        }
Beispiel #3
0
        /// <summary>
        /// ˢ�±���е�����
        /// </summary>
        /// <returns>ture:�ɹ�  false:ʧ��</returns>
        public bool RefreshData()
        {
            try
            {
                ////////IList<BaseColor> list = Services.BaseService.GetStrongList<BaseColor>();

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

                ////////this.gridControl.DataSource = list;
                IList<BaseColor> list = Services.BaseService.GetList<BaseColor>("SelectBaseColorByWhere", "Remark='" + id + "'");

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

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

                }

                this.gridControl.DataSource = li;

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

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

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

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

            //�ø������½������
            DataConverter.CopyTo<BaseColor>(objCopy, obj);
            //ˢ�±��
            gridControl.RefreshDataSource();
        }
Beispiel #5
0
        /// <summary>
        /// ��Ӷ���
        /// </summary>
        public void AddObject()
        {
            //�����������Ƿ��Ѿ�����
            if (ObjectList == null)
            {
                return;
            }
            //�½�����
            BaseColor obj = new BaseColor();
            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);
        }