public void Del(int id) { Tunnel.BLL.Tunnel_Vote tv = new Tunnel.BLL.Tunnel_Vote(); Tunnel.BLL.Tunnel_VoteRe tvr = new Tunnel.BLL.Tunnel_VoteRe(); List <Tunnel.Model.Tunnel_VoteRe> tvrList = tvr.GetModelList("vate_voteId=" + id + ""); foreach (Tunnel.Model.Tunnel_VoteRe item in tvrList) { tvr.Delete(item.vote_Id); } Tunnel.BLL.Tunnel_Votei tvi = new Tunnel.BLL.Tunnel_Votei(); List <Tunnel.Model.Tunnel_Votei> tviList = tvi.GetModelList("ivote_voteId=" + id + ""); foreach (Tunnel.Model.Tunnel_Votei item in tviList) { tvi.Delete(item.ivote_Id); } tv.Delete(id); Tunnel.BLL.Tunnel_Remind tr = new Tunnel.BLL.Tunnel_Remind(); Tunnel.Model.Tunnel_Remind trr = new Tunnel.Model.Tunnel_Remind(); List <Tunnel.Model.Tunnel_Remind> trList = new List <Tunnel.Model.Tunnel_Remind>(); trList = tr.GetModelList("m_type=4 and m_typeid=" + id + ""); foreach (Tunnel.Model.Tunnel_Remind item in trList) { tr.Delete(item.m_typeid); } }
/// <summary> /// 页面数据绑定 /// </summary> public void PageBind() { allCount = 0f; tvv = tv.GetModel(voteId); if (tvv != null) { tviiList = tvi.GetModelList("ivote_voteId = " + voteId + ""); if (tviiList.Count > 0) { foreach (Tunnel.Model.Tunnel_Votei item in tviiList) { allCount += Convert.ToInt32(item.ivote_Count.ToString()); } Repeater1.DataSource = tviiList; Repeater1.DataBind(); } } PageBase pb = new PageBase(); pb.TblName = "Tunnel_VoteRe"; pb.FldName = "vote_Id"; pb.ProcedureName = "pagination"; pb.PageSize = pageSize; if (cuttentPage == 0) { cuttentPage = pb.PageIndex; } pb.PageIndex = cuttentPage; pb.StrWhere = "vate_voteId=" + voteId + ""; pb.OrderName = "vate_Date"; pb.OrderType = 1; int count = 0; List <Tunnel.Model.Tunnel_VoteRe> modelList = new List <Tunnel.Model.Tunnel_VoteRe>(); modelList = tbll.GetList(pb, ref count); //获取分页结果 pb.DoCount = 1; tbll.GetList(pb, ref count); //获取总条数 //数据绑定 Repeater2.DataSource = modelList; Repeater2.DataBind(); //数据分页 MTCPager1.PageSize = pageSize; MTCPager1.RecordCount = count; MTCPager1.PageIndex = cuttentPage; if (count <= pb.PageSize) { MTCPager1.Visible = false; } else { MTCPager1.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { id = Convert.ToInt32(Request.QueryString["id"].ToString()); Tunnel.BLL.Tunnel_Vote t = new Tunnel.BLL.Tunnel_Vote(); Tunnel.Model.Tunnel_Vote tt = new Tunnel.Model.Tunnel_Vote(); Tunnel.BLL.Tunnel_menber tm = new Tunnel.BLL.Tunnel_menber(); tt = t.GetModel(id); voteTitle = tt.vote_Title; voteUserName = tm.GetModel(Convert.ToInt32(tt.vote_userId)).m_name; voteDate = Convert.ToDateTime(tt.vote_startDate).ToShortDateString(); voteMark = tt.vote_mark; voteMax = tt.vote_max.ToString(); voteType = tt.vote_Type.ToString(); max.Value = voteMax; tvList = tv.GetModelList("ivote_voteId=" + id + ""); Repeater1.DataSource = tvList; Repeater1.DataBind(); if (voteType == "0") { foreach (RepeaterItem item in Repeater1.Items) { ((CheckBox)item.FindControl("CheckBox1")).Visible = false; } } else { foreach (RepeaterItem item in Repeater1.Items) { ((RadioButton)item.FindControl("RadioButton1")).Visible = false; } } Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); bool b = false; foreach (Tunnel.Model.Tunnel_Votei item in tvList) { string[] temp = item.ivote_yesUserId.Split(','); foreach (string item1 in temp) { if (ul.LoginID.ToString() == item1) { b = true; } } } if (b) { //Button1.Text = "查看结果"; Response.Redirect("VoteShow.aspx?id=" + Request.QueryString["id"].ToString()); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { id = Convert.ToInt32(Request.QueryString["id"].ToString()); Tunnel.BLL.Tunnel_Vote t = new Tunnel.BLL.Tunnel_Vote(); Tunnel.Model.Tunnel_Vote tt = new Tunnel.Model.Tunnel_Vote(); Tunnel.BLL.Tunnel_menber tm = new Tunnel.BLL.Tunnel_menber(); tt = t.GetModel(id); voteTitle = tt.vote_Title; voteUserName = tm.GetModel(Convert.ToInt32(tt.vote_userId)).m_name; voteDate = Convert.ToDateTime(tt.vote_startDate).ToShortDateString(); if (!string.IsNullOrEmpty(tt.vote_mark)) { voteMark = "<img src=../image/info.png width=20px />" + tt.vote_mark; } voteMax = tt.vote_max.ToString(); voteType = tt.vote_Type.ToString(); max.Value = voteMax; tvList = tv.GetModelList("ivote_voteId=" + id + ""); Repeater1.DataSource = tvList; Repeater1.DataBind(); if (voteType == "0") { for (int i = 0; i < Repeater1.Items.Count; i++) { ((CheckBox)Repeater1.Items[i].FindControl("CheckBox1")).Visible = false; } } else { for (int i = 0; i < Repeater1.Items.Count; i++) { ((RadioButton)Repeater1.Items[i].FindControl("RadioButton1")).Visible = false; } } Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); bool b = false; for (int i = 0; i < tvList.Count; i++) { string[] temp = tvList[i].ivote_yesUserId.Split(','); for (int j = 0; j < temp.Length; j++) { if (ul.LoginID.ToString() == temp[j]) { b = true; } } } if (b) { Button1.Text = "查看结果"; } } else { Tunnel.BLL.Tunnel_Vote tv = new Tunnel.BLL.Tunnel_Vote(); List <Tunnel.Model.Tunnel_Vote> tvList = new List <Tunnel.Model.Tunnel_Vote>(); tvList = tv.GetModelList("(getdate()>vote_startDate and getdate()<vote_endDate) and vote_state=0 and vote_top =1 order by vote_startDate desc"); if (tvList.Count > 0) { Response.Redirect("indexvote.aspx?id=" + tvList[0].vote_Id + ""); } } } }