private void GetCastVote() { POLLONLINEREQ req = new POLLONLINEREQ(); req.dwBeginDate = ToUInt(DateTime.Now.AddYears(-1).ToString("yyyyMMdd")); req.dwEndDate = ToUInt(DateTime.Now.AddYears(1).ToString("yyyyMMdd")); req.dwVoteStat = (uint)POLLONLINE.DWVOTESTAT.VOTESTAT_OPENING | (uint)POLLONLINE.DWVOTESTAT.VOTESTAT_DONE; POLLONLINE[] rlt; if (m_Request.Admin.GetPollOnLine(req, out rlt) == REQUESTCODE.EXECUTE_SUCCESS) { voteList = ""; for (int i = 0; i < rlt.Length; i++) { POLLONLINE vote = rlt[i]; bool isDone = (vote.dwVoteStat & (uint)POLLONLINE.DWVOTESTAT.VOTESTAT_DONE) > 0; voteList += "<tr class='it'><td style='padding:10px 5px;'>" + vote.szPollSubject + "</td>" + "<td style='font-size:12px;vertical-align:top;'>" + vote.szMemo + "</td>" + "<td class='text-center'>" + ToDate(vote.dwEndDate) + "</td>" + "<td class='text-center'>" + vote.dwTotalUsers + "</td>" + "<td class='text-center'>" + ToState(vote.dwVoteStat) + "</td>" + "<td class='text-center'><a class='to-cast' url='../a/votedetail.aspx?back=true&type=poll&id=" + vote.dwPollID + "' cache='#cache_con'>" + (isDone?"查看":"投票") + "</a></td></tr>"; } } else { MsgBoxH(m_Request.szErrMsg); } }
private void GetCastVote() { POLLONLINEREQ req = new POLLONLINEREQ(); req.dwPollID = ToUInt(Request["id"]); POLLONLINE[] rlt; if (m_Request.Admin.GetPollOnLine(req, out rlt) == REQUESTCODE.EXECUTE_SUCCESS) { if (rlt.Length > 0) { POLLONLINE vote = rlt[0]; voteHeader = "<h1 class='h_title'>投票信息</h1><div class='line'></div><h3 class='text-center'>" + vote.szPollSubject + "</h3>"; uint done = (uint)POLLONLINE.DWVOTESTAT.VOTESTAT_DONE | (uint)POLLONLINE.DWVOTESTAT.VOTESTAT_CLOSED | (uint)POLLONLINE.DWVOTESTAT.VOTESTAT_UNOPEN; bool isDone = (vote.dwVoteStat & done) > 0; voteItems = "<a class='click' onclick='castVote(" + vote.dwPollID + ")'>" + (isDone ? "查看" : "投票") + "</a>"; POLLITEM[] list = vote.PollItems; if (list != null && list.Length > 0) { voteItems = "<div id='vote_" + vote.dwPollID + "'><div class='vote_items'>" + "<p class='grey'>" + vote.szMemo + "</p><ul vote='" + vote.dwPollID + "'>"; for (int i = 0; i < list.Length; i++) { POLLITEM item = list[i]; uint? max = vote.dwTotalUsers * item.dwMaxTickItems; double rate = (double)item.dwVotes / (double)max * 100; voteItems += "<li><label class='" + (isDone ? "grey" : "avail") + "'><input name='vote_" + vote.dwPollID + "' class='vote_item' type='radio' value='" + item.dwItemID + "' style='display:" + (isDone ? "none" : "") + "'/>" + item.szItemName + "</label><div class='progress'><div class='progress-bar progress-bar-success' role='progressbar' aria-valuenow='" + item.dwVotes + "' aria-valuemin='0' aria-valuemax='" + max + "' style='width: " + rate + "%;'>" + item.dwVotes + "</div></div></li>"; } string dt = ToDate(vote.dwBeginDate) + " - " + ToDate(vote.dwEndDate); voteItems += "</ul><div class='grey text-right'>投票日期:" + dt + "</div><div class='text-center'>" + (isDone ? "" : "<input type='button'' class='btn btn-info' value='提交' onclick='castVote(" + vote.dwPollID + ")'/>") + "</div></div></div>"; } } } else { MsgBoxH(m_Request.szErrMsg); } }
//暂未用 private string ToAct(POLLONLINE vote) { string ret = ""; uint open = (uint)POLLONLINE.DWVOTESTAT.VOTESTAT_OPENING; uint done = (uint)POLLONLINE.DWVOTESTAT.VOTESTAT_DONE; if ((vote.dwVoteStat & (open | done)) > 0) { bool isDone = (vote.dwVoteStat & done) > 0; ret += "<a class='click' onclick='castVote(" + vote.dwPollID + ")'>" + (isDone?"查看":"投票") + "</a>"; POLLITEM[] list = vote.PollItems; if (list != null && list.Length > 0) { ret += "<div class='hidden' id='vote_" + vote.dwPollID + "'><div class='vote_items'>" + "<h3>" + vote.szPollSubject + "</h3>" + "<p class='grey'>" + vote.szMemo + "</p>" + "<ul vote='" + vote.dwPollID + "'>"; for (int i = 0; i < list.Length; i++) { POLLITEM item = list[i]; uint? max = vote.dwTotalUsers * item.dwMaxTickItems; double rate = (double)item.dwVotes / (double)max * 100; ret += "<li><label class='" + (isDone?"grey":"avail") + "'><input name='vote_" + vote.dwPollID + "' class='vote_item' type='radio' value='" + item.dwItemID + "' style='display:" + (isDone?"none":"") + "'/>" + item.szItemName + "</label><div class='progress'><div class='progress-bar progress-bar-success' role='progressbar' aria-valuenow='" + item.dwVotes + "' aria-valuemin='0' aria-valuemax='" + max + "' style='width: " + rate + "%;'>" + item.dwVotes + "</div></div></li>"; } string dt = ToDate(vote.dwBeginDate) + " - " + ToDate(vote.dwEndDate); ret += "</ul><div class='grey text-right'>投票日期:" + dt + "</div><div class='text-center'>" + (isDone?"":"<input type='button'' class='btn btn-info cast' value='提交'/>") + "</div></div></div>"; } } else { ret = "<span class='grey'>不能投票</span>"; } return(ret); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { string szPid = Request["dwPollID"]; uint uPID = Parse(szPid); POLLONLINE newValue = new POLLONLINE(); GetHTTPObj(out newValue); newValue.dwPollKind = (uint)POLLONLINE.DWPOLLKIND.POLLKIND_MTICKS; newValue.dwPollScope = (uint)POLLONLINE.DWPOLLSCOPE.POLLSCOPE_MEMBER_LOOK + (uint)POLLONLINE.DWPOLLSCOPE.POLLSCOPE_MEMBER_VOTE; POLLITEM[] itemList = (POLLITEM[])Session["POLLITEM"]; if (itemList != null) { uint uGroupID = 1; for (uint i = 0; i < itemList.Length; i++) { itemList[i].dwGroupID = uGroupID; uGroupID = uGroupID + 1; if (itemList[i].dwItemID == null) { itemList[i].dwPollKind = (uint)POLLONLINE.DWPOLLKIND.POLLKIND_MTICKS; itemList[i].dwMaxTickItems = 1; } } } newValue.PollItems = itemList; ADMINLOGINRES vrAccInfo = (ADMINLOGINRES)Session["LoginResult"]; newValue.dwAccNo = vrAccInfo.AdminInfo.dwAccNo; //return; if (m_Request.Admin.SetPollOnLine(newValue, out newValue) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "设置失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE); } else { MessageBox("设置成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK); Session["POLLITEM"] = null; return; } } if (Request["op"] == "set") { bSet = true; POLLONLINEREQ vrGet = new POLLONLINEREQ(); vrGet.dwPollID = Parse(Request["ID"]); POLLONLINE[] vtRes; if (m_Request.Admin.GetPollOnLine(vrGet, out vtRes) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL); } else { if (vtRes.Length == 0) { MessageBox("获取失败", "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL); } else { PutJSObj(vtRes[0]); m_Title = "修改投票"; Session["POLLITEM"] = vtRes[0].PollItems; } } } else { m_Title = "新建投票"; } }