示例#1
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("A", typeof(string));
            dataTable.Columns.Add("B", typeof(bool));
            dataTable.Columns.Add("C", typeof(bool));
            dataTable.Rows.Clear();
            foreach (BurdenYear bl in li)
            {
                DataRow newRow = dataTable.NewRow();
                newRow["A"] = bl.BurdenYears;
                newRow["B"] = false;
                newRow["C"] = false;
                dataTable.Rows.Add(newRow);
            }

            FormYears cy = new FormYears();

            cy.DT = dataTable;
            if (cy.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            IList <BurdenYear> li1 = new List <BurdenYear>();

            double values = 0;
            int    years  = 0;

            bool iszzl = false;

            foreach (DataRow row in dataTable.Rows)
            {
                foreach (BurdenYear bl1 in li)
                {
                    if ((bool)row["B"] && row["A"].ToString() == bl1.BurdenYears.ToString())
                    {
                        li1.Add(bl1);
                        if ((bool)row["C"])
                        {
                            BurdenYear by = new BurdenYear();
                            by.BurdenYears = 10000 + bl1.BurdenYears;
                            by.Values      = Math.Round(Math.Pow(bl1.Values / values, 1.0 / (bl1.BurdenYears - years)) - 1, 4);

                            by.Values = Math.Round(by.Values, 3);
                            li1.Add(by);

                            iszzl  = true;
                            values = bl1.Values;
                            years  = bl1.BurdenYears;
                        }
                        if (!iszzl)
                        {
                            values = bl1.Values;
                            years  = bl1.BurdenYears;
                        }
                    }
                }
            }


            FrmBurdenMaxYear1 frm = new FrmBurdenMaxYear1();

            if (!PrintRight)
            {
                frm.print = false;
            }
            frm.Text     = this.Text;
            frm.ObjList  = li1;
            frm.IsSelect = isSelect;
            if (frm.ShowDialog() == DialogResult.OK && isSelect)
            {
                gcontrol = frm.Gcontrol;
                title    = frm.Title;
                //unit = "单位:万千瓦";
                DialogResult = DialogResult.OK;
            }
        }
示例#2
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataTable dataTable = new DataTable();
            dataTable.Columns.Add("A", typeof(string));
            dataTable.Columns.Add("B", typeof(bool));
            dataTable.Columns.Add("C", typeof(bool));
            dataTable.Rows.Clear();
            foreach (BurdenYear bl in li)
            {
                DataRow newRow = dataTable.NewRow();
                newRow["A"] = bl.BurdenYears;
                newRow["B"] = false;
                newRow["C"] = false;
                dataTable.Rows.Add(newRow);
            }

            FormYears cy = new FormYears();
            cy.DT = dataTable;
            if (cy.ShowDialog() != DialogResult.OK)
                return;

            IList<BurdenYear> li1 = new List<BurdenYear>();

            double values = 0;
            int years = 0;

            bool iszzl = false;
            foreach (DataRow row in dataTable.Rows)
            {
                foreach (BurdenYear bl1 in li)
                {
                    if ((bool)row["B"] && row["A"].ToString() == bl1.BurdenYears.ToString())
                    {

                        li1.Add(bl1);
                        if ((bool)row["C"])
                        {
                            BurdenYear by = new BurdenYear();
                            by.BurdenYears = 10000 + bl1.BurdenYears;
                            by.Values = Math.Round(Math.Pow(bl1.Values / values, 1.0 / (bl1.BurdenYears-years)) - 1, 4);

                            by.Values=Math.Round(by.Values, 3);
                            li1.Add(by);

                            iszzl = true;
                            values = bl1.Values;
                            years = bl1.BurdenYears;
                        }
                        if (!iszzl)
                        {
                            values = bl1.Values;
                            years = bl1.BurdenYears;
                        }
                    }
                }
            }

            FrmBurdenMaxYear1 frm = new FrmBurdenMaxYear1();
            if (!PrintRight)
            {
                frm.print = false;
            }
            frm.Text = this.Text;
            frm.ObjList = li1;
            frm.IsSelect = isSelect;
            if (frm.ShowDialog() == DialogResult.OK && isSelect)
            {
                gcontrol = frm.Gcontrol;
                title = frm.Title;
                //unit = "��λ����ǧ��";
                DialogResult = DialogResult.OK;
            }
        }