Esempio n. 1
0
        private void EnableDropList(int subid)
        {
            DataTable table3 = new B_Votekey().GetList(0, "N_Type", "N_SubId=" + subid + "", " N_OrderId,N_KeyId").Tables[0];

            if (table3 != null)
            {
                foreach (DataRow dataRow in table3.Rows)
                {
                    //if (dataRow[0].ToString() == "2")
                    //{
                    //    drpType.Items.FindByValue("5").Enabled=false;
                    //    break;
                    //}
                    if (dataRow[0].ToString() == "5")
                    {
                        //{
                        //    drpType.Items.FindByValue("2").Enabled = false;
                        if (Id == 0)
                        {
                            btnSave.Enabled = false;
                        }
                    }
                    //    break;
                    //}
                }
            }
        }
Esempio n. 2
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;
                }
            }
        }
Esempio n. 3
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);
        }
Esempio n. 4
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}", "");
            }
        }
Esempio n. 5
0
        private void dataOne(string xh, int rr, int voteid, DataRow row, string[] fieldname, DataRow[] rowresult)
        {
            sb.Append("<tr><td style=\"border:1px solid #F0F0F0;height:30px;\">" + xh.ToString() + ((rr > 0) ? "." + rr : "") + " </td>");
            sb.Append("<td style=\"border:1px solid #F0F0F0;\" colspan=\"2\">" + row["C_SubTitle"] + "</td>");

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

            foreach (DataRow current in DT.Rows)
            {
                string str2 = "";
                int    num3 = 0;
                switch (int.Parse(current["N_Type"].ToString()))
                {
                case 1:
                case 5:
                    //N_KeyId,N_SubId,C_Reuslt
                    var rows =
                        rowresult.FirstOrDefault(x => (x.Field <int>("N_KeyId") == int.Parse(current["N_KeyId"].ToString()) && x.Field <int>("N_SubId") == int.Parse(row["SubId"].ToString())));
                    if (rows != null)
                    {
                        str2 = rows["C_Reuslt"].ToString();
                    }

                    sb.Append("<td colspan=" + fieldname.Length + " style=\"border:1px solid #F0F0F0;\">" + str2 + "</td>");
                    break;

                case 2:
                case 4:
                    var rows2 =
                        rowresult.FirstOrDefault(x => (x.Field <int>("N_KeyId") == int.Parse(current["N_KeyId"].ToString()) && x.Field <int>("N_SubId") == int.Parse(row["SubId"].ToString())));
                    if (rows2 != null)
                    {
                        num3 = 1;
                    }

                    sb.Append("<td style=\"border:1px solid #F0F0F0;\">" + num3 + "</td>");
                    break;

                case 3:
                    var rows3 =
                        rowresult.FirstOrDefault(x => (x.Field <int>("N_KeyId") == int.Parse(current["N_KeyId"].ToString()) && x.Field <int>("N_SubId") == int.Parse(row["SubId"].ToString())));
                    if (rows3 != null)
                    {
                        str2 = current["C_KeyTitle"].ToString();
                    }
                    ;
                    if (xmnum == 0)
                    {
                        sb.Append("<td colspan=" + fieldname.Length + " style=\"border:1px solid #F0F0F0;\">" + str2 + "");
                    }
                    else if (xmnum == DT.Rows.Count - 1)
                    {
                        sb.Append(" " + str2 + "</td>");
                    }
                    else
                    {
                        sb.Append(" " + str2 + "");
                    }
                    xmnum++;
                    break;
                }
            }
            sb.Append("</tr>");
        }