Beispiel #1
0
        private void InitMenuTreeView()
        {
            dbvwNumberInfo vw = new dbvwNumberInfo();
            DataTable      db = vw.GetAllDataFrom_vwNumberInfo();

            trvMenu.Nodes.Clear();
            /*加载先祖*/
            DataTable xianzu = vw.GetFirstPerson();

            if (xianzu.Rows.Count == 1)
            {
                /*顶级节点*/
                TreeNode tnTop = new TreeNode();
                tnTop.Text = xianzu.Rows[0]["姓名"].ToString();
                tnTop.Tag  = xianzu.Rows[0]["NiId"];
                trvMenu.Nodes.Add(tnTop);
                BindChildNode(tnTop);
            }
            trvMenu.ExpandAll();
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            dbvwNumberInfo num       = new dbvwNumberInfo();
            DataTable      td        = num.GetAllDataFrom_vwNumberInfo("Nistate = 30");
            int            zero_10   = 0;
            int            shi_20    = 0;
            int            ErShi_30  = 0;
            int            SanShi_40 = 0;
            int            shiwu_50  = 0;
            int            wushi_60  = 0;
            int            liushi_70 = 0;
            int            qishi_80  = 0;
            int            bashi_90  = 0;
            int            jiushi_Up = 0;

            for (int i = 0; i < td.Rows.Count; i++)
            {
                int NianLing = Convert.ToInt32(td.Rows[i]["年龄"]);
                switch (NianLing / 10)
                {
                case 0:
                {
                    zero_10++;
                } break;

                case 1:
                {
                    shi_20++;
                } break;

                case 2:
                {
                    ErShi_30++;
                } break;

                case 3:
                {
                    SanShi_40++;
                } break;

                case 4:
                {
                    shiwu_50++;
                } break;

                case 5:
                {
                    wushi_60++;
                } break;

                case 6:
                {
                    liushi_70++;
                } break;

                case 7:
                {
                    qishi_80++;
                } break;

                case 8:
                {
                    bashi_90++;
                } break;

                default:
                    jiushi_Up++;
                    break;
                }
            }
            //清除默认的series
            CharNainFenBu.Series.Clear();
            //new 一个叫做【Strength】的系列
            Series Strength = new Series("人员数量");

            //设置chart的类型,这里为柱状图
            Strength.ChartType = SeriesChartType.Column;
            //给系列上的点进行赋值,分别对应横坐标和纵坐标的值
            Strength.Points.AddXY("0~10", zero_10);
            Strength.Points.AddXY("10~20", shi_20);
            Strength.Points.AddXY("20~30", ErShi_30);
            Strength.Points.AddXY("30~40", SanShi_40);
            Strength.Points.AddXY("40~50", shiwu_50);
            Strength.Points.AddXY("50~60", wushi_60);
            Strength.Points.AddXY("60~70", liushi_70);
            Strength.Points.AddXY("70~80", qishi_80);
            Strength.Points.AddXY("80~90", bashi_90);
            Strength.Points.AddXY("90~", jiushi_Up);
            //把series添加到chart上
            CharNainFenBu.Series.Add(Strength);
        }
Beispiel #3
0
        private void ShowData()
        {
            dbConnection con            = new dbConnection();
            string       AllPeople      = con.CarryOutSqlGetFirstColmun("select count(*) from  [Family].[dbo].[tblNumberInfo]");
            double       countAllPeople = Convert.ToDouble(AllPeople);

            RsAllPeopleCount.Height = 200;
            RsAllPeopleCount.Width  = 25;
            lblAll.Text             = "总人数:" + countAllPeople;
            dbvwNumberInfo num                = new dbvwNumberInfo();
            DataTable      td                 = num.GetAllDataFrom_vwNumberInfo();
            int            sexCountGirl       = 0;
            int            sexCountBoy        = 0;
            int            weichengnian       = 0;
            int            lblLifeCount       = 0; //当前健在人口
            int            lblTillNowDieCount = 0; /*目前为止先祖人口*/
            int            lblNowDanCount     = 0; /*当前单身人数*/
            int            lblJiaZuJiCount    = 0; /*未记载*/
            int            BoyNowStillLfe     = 0;
            int            GirlNowLifeStill   = 0;
            int            JianZiaWeicheng    = 0;

            for (int i = 0; i < td.Rows.Count; i++)
            {
                if (td.Rows[i]["NiSex"].ToString() == "True")
                {
                    sexCountGirl++;
                }
                else
                {
                    sexCountBoy++;
                }
                if (Convert.ToInt32(td.Rows[i]["年龄"]) < 18)
                {
                    weichengnian++;
                }

                /*统计健在人口*/
                if (td.Rows[i]["Nistate"].ToString() == "30")
                {
                    lblLifeCount++;
                }
                /*统计死亡人口*/
                if (td.Rows[i]["Nistate"].ToString() == "40")
                {
                    lblTillNowDieCount++;
                }
                if (td.Rows[i]["配偶"].ToString() == "未记载" && td.Rows[i]["Nistate"].ToString() == "30")
                {
                    lblNowDanCount++;
                }
                if (td.Rows[i]["NiLifeStory"].ToString() == "" || td.Rows[i]["NiLifeStory"].ToString().Length < 50)
                {
                    lblJiaZuJiCount++;
                }
                if (td.Rows[i]["Nistate"].ToString() == "30" && td.Rows[i]["性别"].ToString() == "男")
                {
                    BoyNowStillLfe++;
                }
                if (td.Rows[i]["Nistate"].ToString() == "30" && td.Rows[i]["性别"].ToString() == "女")
                {
                    GirlNowLifeStill++;
                }
                if (Convert.ToInt32(td.Rows[i]["年龄"]) < 18 && td.Rows[i]["Nistate"].ToString() == "30")
                {
                    JianZiaWeicheng++;
                }
            }
            lblLifeCountNow.Text       = lblLifeCount.ToString();       /*显示健在总人口*/
            lblTillNowDieCountNow.Text = lblTillNowDieCount.ToString(); //显示死亡人口
            lblNowDanCountNow.Text     = lblNowDanCount.ToString();     /*单身人数*/
            lblJiZaiWithOut.Text       = lblJiaZuJiCount.ToString();    /*记载*/
            lblLifeGrilNow.Text        = GirlNowLifeStill.ToString();
            lblLifeBoyNow.Text         = BoyNowStillLfe.ToString();
            lblWhouChengNian.Text      = JianZiaWeicheng.ToString();
            lblWEichengnian.Text       = "未成年:" + weichengnian;
            lblGirl.Text          = "女生:" + sexCountGirl;
            lblBoy.Text           = "男生:" + sexCountBoy;
            RSGrilCount.Height    = Convert.ToInt32((sexCountGirl / countAllPeople) * 200);
            RSBoyCount.Height     = Convert.ToInt32((sexCountBoy / countAllPeople) * 200);
            CRWeichengNain.Height = Convert.ToInt32((weichengnian / countAllPeople) * 200);
            GetDate();
        }