예제 #1
0
        private void GetTable(int xh, int hh, int yb, int voteid, DataRow row, ref DataTable table)
        {
            DataRow row2 = table.NewRow();

            row2["sub"]  = "<span class=\"splace\">&nbsp;</span>" + xh.ToString() + ((hh > 0) ? "-" + hh : "") + ". " + row["C_SubTitle"].ToString();
            row2["tp"]   = DBNull.Value;
            row2["type"] = DBNull.Value;
            table.Rows.Add(row2);

            DataTable DT        = new B_Votekey().GetList(0, "N_SubId=" + row["N_SubId"] + "", " N_OrderId,N_KeyId").Tables[0];
            int       jj        = 0;
            int       totalsubs = bll.GetVoteNumBySubId(voteid, int.Parse(row["SubId"].ToString()), int.Parse(row["N_SysId"].ToString()));

            foreach (DataRow current in DT.Rows)
            {
                string str2 = "";
                int    num3 = 0;
                row2         = table.NewRow();
                row2["type"] = int.Parse(current["N_Type"].ToString());
                switch (int.Parse(current["N_Type"].ToString()))
                {
                case 1:
                case 5:
                    str2 = "<span class=\"splace2\">&nbsp;&nbsp;</span>" + current["C_KeyTitle"].ToString() + "<br/>";
                    DataTable item = bll.GetItem(voteid, int.Parse(row["SubId"].ToString()),
                                                 int.Parse(current["N_KeyId"].ToString()));
                    foreach (DataRow row6 in item.Rows)
                    {
                        str2 = str2 + row6["C_Reuslt"].ToString() + "<br/>";
                        num3++;
                    }

                    row2["sub"] = str2;
                    row2["tp"]  = num3;   //DBNull.Value;
                    table.Rows.Add(row2);
                    break;

                case 2:
                case 3:
                case 4:
                    num3 = bll.GetSum(voteid, int.Parse(row["SubId"].ToString()),
                                      int.Parse(current["N_KeyId"].ToString()));
                    row2["sub"] = "<span class=\"splace2\">&nbsp;&nbsp;</span>" + current["C_KeyTitle"];
                    var p = (num3 * 1.0 / totalsubs * 1.0) * 100;
                    row2["tp"] = p.ToString("0.00");     //DBNull.Value;
                    table.Rows.Add(row2);
                    break;
                }
            }
        }
예제 #2
0
        private DataTable method_1(int voteid, int sysid)
        {
            int       num   = 1;
            DataTable table = new DataTable();

            table.Columns.Add("编号", typeof(int));
            table.Columns.Add("名称", typeof(string));
            table.Columns.Add("票数", typeof(string));
            // table.Columns.Add("类型", typeof(int));
            foreach (DataRow row7 in new B_Votesubject().GetList(0, "parentid!=0 and N_SysId=" + sysid + "", "N_OrderId,N_SubId").Tables[0].Rows)
            {
                DataRow row2 = table.NewRow();
                row2["编号"] = num;
                row2["名称"] = row7["C_SubTitle"];
                row2["票数"] = DBNull.Value;
                //row2["类型"] = DBNull.Value;
                table.Rows.Add(row2);

                DataTable DT        = new B_Votekey().GetList(0, "N_SubId=" + row7["N_SubId"] + "", " N_OrderId,N_KeyId").Tables[0];
                int       totalsubs = bll.GetVoteNumBySubId(voteid, int.Parse(row7["N_SubId"].ToString()), sysid);
                foreach (DataRow current in DT.Rows)
                {
                    string str2;
                    int    num3 = 0;
                    switch (int.Parse(current["N_Type"].ToString()))
                    {
                    case 1:
                        DataTable item = bll.GetItem(voteid, int.Parse(current["N_SubId"].ToString()),
                                                     int.Parse(current["N_KeyId"].ToString()));
                        str2 = current["C_KeyTitle"].ToString() + "<br/>";
                        foreach (DataRow row6 in item.Rows)
                        {
                            str2 = str2 + row6["C_Reuslt"].ToString() + "<br/>";
                            num3++;
                        }
                        row2       = table.NewRow();
                        row2["编号"] = DBNull.Value;
                        row2["名称"] = str2;
                        //var pp = (num3 * 1.0 / totalsubs * 1.0) * 100;
                        row2["票数"] = num3;    //DBNull.Value;
                        //row2["类型"] = 1;
                        table.Rows.Add(row2);
                        break;

                    case 2:
                    case 3:
                    case 4:
                        row2       = table.NewRow();
                        row2["编号"] = DBNull.Value;
                        row2["名称"] = current["C_KeyTitle"];
                        num3       = bll.GetSum(voteid, int.Parse(current["N_SubId"].ToString()),
                                                int.Parse(current["N_KeyId"].ToString()));
                        var p = (num3 * 1.0 / totalsubs * 1.0) * 100;
                        row2["票数"] = num3;    //p.ToString("0.00");
                        // row2["类型"] = int.Parse(current["N_Type"].ToString());
                        table.Rows.Add(row2);
                        break;

                    case 5:
                        string    str;
                        DataTable table3 = bll.GetItem(voteid, int.Parse(current["N_SubId"].ToString()),
                                                       int.Parse(current["N_KeyId"].ToString()));
                        str = current["C_KeyTitle"].ToString() + "<br/>";
                        foreach (DataRow row3 in table3.Rows)
                        {
                            str = str + row3["C_Reuslt"].ToString() + "<br/>";
                            num3++;
                        }
                        row2       = table.NewRow();
                        row2["编号"] = DBNull.Value;
                        row2["名称"] = str;
                        // var p_5 = (num3 * 1.0 / totalsubs * 1.0) * 100;
                        row2["票数"] = num3;    // p_5.ToString("0.00");
                        //row2["类型"] = 5;
                        table.Rows.Add(row2);
                        break;
                    }
                }

                num++;
            }
            return(table);
        }