Beispiel #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;
                }
            }
        }
Beispiel #2
0
        private void dataOne(int xh, int hh, int yb, int voteid, DataRow row, string[] fieldname)
        {
            int i = 0;

            sb.Append("<tr><td {rowspan} align=\"center\" style=\"border:thin solid #333333;\">" + xh.ToString() + ((hh > 0) ? "." + hh : "") + " </td>");
            sb.Append("<td {rowspan} style=\"border:thin solid #333333;\">" + row["C_SubTitle"] + "</td>");

            StringBuilder sbx = new StringBuilder();

            DataTable DT = new B_Votekey().GetList(0, "N_SubId=" + row["N_SubId"] + "", " N_OrderId,N_KeyId").Tables[0];
            int       jj = 0;

            foreach (DataRow current in DT.Rows)
            {
                //string str2 = "";
                int num3 = 0;
                // sb.Append("<td>"+int.Parse(current["N_Type"].ToString())+"</td>");
                switch (int.Parse(current["N_Type"].ToString()))
                {
                case 1:
                case 5:
                    DataTable item = bll.GetItem(voteid, int.Parse(row["SubId"].ToString()),
                                                 int.Parse(current["N_KeyId"].ToString()));
                    if (item != null && item.Rows.Count > 0)
                    {
                        foreach (DataRow row6 in item.Rows)
                        {
                            if (i == 0)
                            {
                                sb.Append("<td {rowspan} style=\"border:thin solid #333333;\"></td>");
                                sb.Append("<td colspan=" + fieldname.Length +
                                          " style=\"border:thin solid #333333;\">" + row6["C_Reuslt"].ToString() +
                                          "</td>");
                                sb.Append("</tr>");
                            }
                            else
                            {
                                sbx.Append("<tr><td colspan=" + fieldname.Length +
                                           " style=\"border:thin solid #333333;\" align=left>" + row6["C_Reuslt"].ToString() +
                                           "</td></tr>");
                            }
                            num3++;
                            i++;
                        }
                    }
                    else
                    {
                        sb.Append("<td {rowspan} style=\"border:thin solid #333333;\"></td>");
                        sb.Append("<td colspan=" + fieldname.Length + " style=\"border:thin solid #333333;\"></td>");
                    }

                    break;

                case 2:
                case 4:
                    if (jj == 0)
                    {
                        int soucre = bll.GetSumSource(" r.N_VoteId='" + voteid + "' and s.N_SubId =" + row["SubId"]);
                        var p      = yb == 0 ? 0 : (soucre * 1.0 / yb * 1.0);
                        sb.Append("<td style=\"border:thin solid #333333;\">" + p.ToString("0.00") + "</td>");
                    }
                    num3 = bll.GetSum(voteid, int.Parse(row["SubId"].ToString()),
                                      int.Parse(current["N_KeyId"].ToString()));

                    sb.Append("<td style=\"border:thin solid #333333;\">" + num3 + "</td>");
                    jj++;
                    break;

                case 3:

                    int colspan = fieldname.Length > 1 ? fieldname.Length - 1 : 0;
                    if (jj == 0)
                    {
                        // int soucre = bll.GetSum("C_Reuslt=3 and N_VoteId=" + voteid + " and N_SubId=" + row["SubId"].ToString());
                        sb.Append("<td {rowspan} style=\"border:thin solid #333333;\">0</td>");

                        sb.Append("<td align=left style=\"border:thin solid #333333;\">" + current["C_KeyTitle"].ToString() + "</td>");
                        sb.Append("<td colspan=\"" + colspan + "\" style=\"border:thin solid #333333;\">" + num3 + "</td>");
                        sb.Append("</tr>");
                    }
                    else
                    {
                        num3 = bll.GetSum(voteid, int.Parse(row["SubId"].ToString()),
                                          int.Parse(current["N_KeyId"].ToString()));
                        sb.Append(" <tr><td align=left style=\"border:thin solid #333333;\">" + current["C_KeyTitle"].ToString() +
                                  "</td><td colspan=\"" + colspan + "\" style=\"border:thin solid #333333;\">" + num3 +
                                  "</td> </tr>");
                    }
                    jj++;
                    i++;
                    break;
                }
            }
            if (i > 0)
            {
                sb.Append(sbx.ToString());
                sb.Replace("{rowspan}", "rowspan=\"" + i + "\"");
            }
            else
            {
                sb.Append("</tr>");
                sb.Replace("{rowspan}", "");
            }
        }