Beispiel #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Tunnel.Model.Tunnel_Votei> DataTableToList(DataTable dt)
        {
            List <Tunnel.Model.Tunnel_Votei> modelList = new List <Tunnel.Model.Tunnel_Votei>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Tunnel.Model.Tunnel_Votei model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Tunnel.Model.Tunnel_Votei();
                    if (dt.Rows[n]["ivote_Id"].ToString() != "")
                    {
                        model.ivote_Id = int.Parse(dt.Rows[n]["ivote_Id"].ToString());
                    }
                    model.ivote_Title = dt.Rows[n]["ivote_Title"].ToString();
                    if (dt.Rows[n]["ivote_Count"].ToString() != "")
                    {
                        model.ivote_Count = int.Parse(dt.Rows[n]["ivote_Count"].ToString());
                    }
                    model.ivote_yesUserId = dt.Rows[n]["ivote_yesUserId"].ToString();
                    if (dt.Rows[n]["ivote_voteId"].ToString() != "")
                    {
                        model.ivote_voteId = int.Parse(dt.Rows[n]["ivote_voteId"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #2
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     tvii = new Tunnel.Model.Tunnel_Votei();
     tvii.ivote_voteId = Convert.ToInt32(tempId);
     tvii.ivote_Title  = TextBox1.Text;
     tvii.ivote_Count  = 0;
     tvi.Add(tvii);
     TextBox1.Text = "";
     GridView1.DataBind();
 }
Beispiel #3
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (Button1.Text == "投票")
     {
         Tunnel.BLL.Tunnel_Votei   tvi  = new Tunnel.BLL.Tunnel_Votei();
         Tunnel.Model.Tunnel_Votei tvii = new Tunnel.Model.Tunnel_Votei();
         if (voteType == "0")
         {
             for (int i = 0; i < Repeater1.Items.Count; i++)
             {
                 if (((RadioButton)Repeater1.Items[i].FindControl("RadioButton1")).Checked)
                 {
                     tvii.ivote_Id = Convert.ToInt32(((RadioButton)Repeater1.Items[i].FindControl("RadioButton1")).ToolTip.ToString());
                     tvii          = tvi.GetModel(tvii.ivote_Id);
                     tvii.ivote_Count++;
                     Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin();
                     tvii.ivote_yesUserId += ul.LoginID + ",";
                     tvi.Update(tvii);
                 }
             }
         }
         else
         {
             for (int i = 0; i < Repeater1.Items.Count; i++)
             {
                 if (((CheckBox)Repeater1.Items[i].FindControl("CheckBox1")).Checked)
                 {
                     tvii.ivote_Id = Convert.ToInt32(((CheckBox)Repeater1.Items[i].FindControl("CheckBox1")).ToolTip.ToString());
                     tvii          = tvi.GetModel(tvii.ivote_Id);
                     tvii.ivote_Count++;
                     Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin();
                     tvii.ivote_yesUserId += ul.LoginID + ",";
                     tvi.Update(tvii);
                 }
             }
         }
         Tunnel.Common.Message.Show("投票成功!");
     }
     else
     {
         Response.Redirect("indexvoteshow.aspx?id=" + id + "");
     }
 }
Beispiel #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Tunnel.Model.Tunnel_Votei model)
 {
     dal.Update(model);
 }
Beispiel #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Tunnel.Model.Tunnel_Votei model)
 {
     return(dal.Add(model));
 }