コード例 #1
0
        private void ViewPollResult()
        {
            //총득표수 셋팅
            //this.GetPollSum();
            this.pollSum = PollBaseLib.GetPollSum(this.poll_id);

            dbUtil = new DBLib();
            string fieldNames, tableName, whereClause, orderBy;

            fieldNames  = "exNbr,example,pPoint";
            tableName   = "t_PollEX";
            whereClause = "poll_id =" + this.poll_id;
            orderBy     = "exNbr";
            //실제쿼리실행
            drPoll = dbUtil.Select_DR(fieldNames, tableName, whereClause, orderBy);

            Table     pTable = new Table();
            TableRow  tRow;
            TableCell tCell;

            while (drPoll.Read())
            {
                tRow             = new TableRow();
                tCell            = new TableCell();
                tCell.ColumnSpan = 2;
                tCell.Text       = drPoll["exNbr"].ToString() + "." + drPoll["example"].ToString();
                //Create a new cell and add it to the row.//행만들기
                tRow.Cells.Add(tCell);
                pTable.Rows.Add(tRow);

                tRow        = new TableRow();
                tCell       = new TableCell();
                tCell.Width = Unit.Percentage(2);
                //tCell.BackColor = Color.LightGreen;
                tCell.Text = " ";
                tRow.Cells.Add(tCell);

                tCell          = new TableCell();
                tCell.CssClass = "sTxt1";

                System.Web.UI.WebControls.Image imgBar = PollBaseLib.DrawGraph(Convert.ToInt32(drPoll["pPoint"]), this.pollSum);
                tCell.Controls.Add(imgBar);
                tCell.Controls.Add(new LiteralControl(" " + imgBar.AlternateText));
                tRow.Cells.Add(tCell);

                pTable.Width       = Unit.Percentage(100);
                pTable.BorderWidth = 0;
                pTable.CellPadding = 0;
                pTable.CellSpacing = 0;
                pTable.Rows.Add(tRow);
            }
            drPoll.Close();
            pnViewResult.Controls.Add(pTable);
        }
コード例 #2
0
ファイル: PollView.aspx.cs プロジェクト: sinyunsnag/test.com
        private bool LoadPollMain()
        {
            dbUtil = new DBLib();

            string fieldNames, tableName, whereClause, orderBy;

            fieldNames   = "poll_id,pTopic,pBeginTime,pEndTime";
            tableName    = "t_PollMain";
            whereClause  = "DATEDIFF(day, pBeginTime, '" + DateTime.Now.ToShortDateString() + "') >=0";
            whereClause += " AND DATEDIFF(day, pEndTime, '" + DateTime.Now.ToShortDateString() + "') <=0";
            whereClause += " AND pDisplay = 1 AND IsStaff = 0";
            whereClause += " AND poll_id = " + this.poll_id;
            orderBy      = "poll_id DESC";

            //실제쿼리실행
            drPoll = dbUtil.Select_DR(1, fieldNames, tableName, whereClause, orderBy);
            //Response.End();

            if (drPoll.HasRows)
            {
                drPoll.Read();
                PostState.Self["poll_id"] = drPoll["poll_id"].ToString();
                this.poll_id = Convert.ToInt32(drPoll["poll_id"]);
                pTopic.Text  = drPoll["pTopic"].ToString();
                //기간세팅
                period.Text = PollBaseLib.GetPeriod(drPoll["pBeginTime"], drPoll["pEndTime"]);
                drPoll.Close();
                return(true);
            }
            else
            {
                PostState.Self["poll_id"] = 0;
                pTopic.Text = "현재 진행하고 있지 않습니다.";
                return(false);
            }
        }
コード例 #3
0
ファイル: PollView.aspx.cs プロジェクト: sinyunsnag/test.com
        private void ViewPollResult()
        {
            //총득표수 셋팅
            //this.GetPollSum();
            this.pollSum = PollBaseLib.GetPollSum(this.poll_id);

            dbUtil = new DBLib();
            string fieldNames, tableName, whereClause, orderBy;

            fieldNames  = "exNbr,example,pPoint";
            tableName   = "t_PollEX";
            whereClause = "poll_id =" + this.poll_id;
            orderBy     = "exNbr";
            //실제쿼리실행
            drPoll = dbUtil.Select_DR(fieldNames, tableName, whereClause, orderBy);

            Table     pTable = new Table();
            TableRow  tRow;
            TableCell tCell;

            pTable.Width       = Unit.Percentage(100);
            pTable.BorderWidth = 1;
            pTable.BorderStyle = BorderStyle.Solid;
            pTable.BorderColor = Color.LightBlue;
            pTable.CellPadding = 1;
            pTable.CellSpacing = 2;


            tRow = new TableRow();
            tRow.HorizontalAlign = HorizontalAlign.Center;
            tRow.Height          = 30;
            tRow.BackColor       = JinsLibrary.IMAGE.ImageLib.Self.ColorFromArgb("d2", "f1", "ff");             //Color.FromArgb(Convert.ToInt32("d2",16),Convert.ToInt32("f1",16) ,Convert.ToInt32("ff",16));

            tCell          = new TableCell();
            tCell.CssClass = "header";
            tCell.Text     = "예문";
            tRow.Cells.Add(tCell);
            tCell          = new TableCell();
            tCell.CssClass = "header";
            tCell.Width    = 50;
            tCell.Text     = "득표수";
            tRow.Cells.Add(tCell);
            tCell          = new TableCell();
            tCell.CssClass = "header";
            tCell.Text     = "그래프";
            tRow.Cells.Add(tCell);
            pTable.Rows.Add(tRow);

            while (drPoll.Read())
            {
                tRow       = new TableRow();
                tCell      = new TableCell();
                tCell.Text = "&nbsp;" + drPoll["exNbr"].ToString() + "." + drPoll["example"].ToString();
                tRow.Cells.Add(tCell);

                tCell                 = new TableCell();
                tCell.BackColor       = JinsLibrary.IMAGE.ImageLib.Self.ColorFromArgb("f4", "fc", "ff");
                tCell.Text            = drPoll["pPoint"].ToString() + " 표";
                tCell.HorizontalAlign = HorizontalAlign.Center;
                tRow.Cells.Add(tCell);

                tCell = new TableCell();
                System.Web.UI.WebControls.Image imgBar = PollBaseLib.DrawGraph(Convert.ToInt32(drPoll["pPoint"]), this.pollSum);
                tCell.Controls.Add(imgBar);
                tCell.Controls.Add(new LiteralControl("&nbsp;" + imgBar.AlternateText));
                tRow.Cells.Add(tCell);

                pTable.Rows.Add(tRow);
            }
            tRow                 = new TableRow();
            tRow.BackColor       = JinsLibrary.IMAGE.ImageLib.Self.ColorFromArgb("d2", "f1", "ff");
            tCell                = new TableCell();
            tRow.Height          = 20;
            tCell.ColumnSpan     = 3;
            tRow.HorizontalAlign = HorizontalAlign.Center;
            tCell.Text           = "[총득표수 : " + this.pollSum.ToString() + "표]";
            tRow.Cells.Add(tCell);
            pTable.Rows.Add(tRow);

            drPoll.Close();
            phViewResult.Controls.Add(pTable);
        }