예제 #1
0
    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);
        }
    }
예제 #2
0
파일: Vote.aspx.cs 프로젝트: 262734254/OA
    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());
                }
            }
        }
    }
예제 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!string.IsNullOrEmpty(Request.QueryString["id"]))
         {
             tempId = Convert.ToInt32(Request.QueryString["id"].ToString());
             Tunnel.BLL.Tunnel_Vote tv = new Tunnel.BLL.Tunnel_Vote();
             voteTitle = tv.GetModel(tempId).vote_Title;
         }
     }
 }
예제 #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!string.IsNullOrEmpty(Request.QueryString["id"]))
         {
             voteId = 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(voteId);
             voteTitle = tt.vote_Title;
             voteMark  = tt.vote_mark;
             PageBind();
         }
     }
 }
예제 #5
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Tunnel.BLL.Tunnel_Vote   tv  = new Tunnel.BLL.Tunnel_Vote();
        Tunnel.Model.Tunnel_Vote tvv = new Tunnel.Model.Tunnel_Vote();
        Tunnel.BLL.UserLogin     ul  = new Tunnel.BLL.UserLogin();
        tvv.vote_userId    = Convert.ToInt32(ul.LoginID.ToString());
        tvv.vote_bumGroup  = TextbumId.Value;
        tvv.vote_startDate = TextBox1.Text.Trim().Length > 0 ? Convert.ToDateTime(TextBox1.Text) : DateTime.Now;
        tvv.vote_endDate   = TextBox2.Text.Trim().Length > 0 ? Convert.ToDateTime(TextBox2.Text) : Convert.ToDateTime(tvv.vote_startDate).AddYears(1);
        tvv.vote_mark      = txtText.Text;
        tvv.vote_state     = 0;
        tvv.vote_Title     = txtTitle.Text;
        tvv.vote_top       = 0;
        tvv.vote_Type      = Convert.ToInt32(DropDownList1.SelectedValue);
        tvv.vote_max       = 1;
        if (tvv.vote_Type == 1)
        {
            if (TextBox3.Text.Length > 0)
            {
                tvv.vote_max = Convert.ToInt32(TextBox3.Text.Trim());
            }
            else
            {
                tvv.vote_max = 1;
            }
        }
        int relf = tv.Add(tvv);

        if (relf > 0)
        {
            if (CheckBox1.Checked)
            {
                #region 发消息给大家//////////////////////////////////////
                //获得所需参数
                string strToIds = tvv.vote_bumGroup;
                string strTitle = "投票:" + tvv.vote_Title;
                //写入数据库
                if (strToIds != "" && strToIds != "|")
                {
                    strToIds = strToIds.Split('|')[0].ToString();
                    if (strToIds.LastIndexOf(',') > 0)
                    {
                        strToIds = strToIds.Remove(strToIds.LastIndexOf(','), 1);
                    }
                    string[] arr = strToIds.Split(',');
                    List <Tunnel.Model.Tunnel_menber> tmList = new List <Tunnel.Model.Tunnel_menber>();
                    foreach (string item in arr)
                    {
                        Tunnel.BLL.Tunnel_menber tm = new Tunnel.BLL.Tunnel_menber();
                        tmList = new List <Tunnel.Model.Tunnel_menber>();
                        tmList = tm.GetModelList("m_bum=" + item + "");
                        for (int j = 0; j < tmList.Count; j++)
                        {
                            call(strTitle, relf.ToString(), DateTime.Now, tmList[j].m_id);
                        }
                    }
                }
                else
                {
                    List <Tunnel.Model.Tunnel_menber> tmList = new List <Tunnel.Model.Tunnel_menber>();
                    Tunnel.BLL.Tunnel_menber          tm     = new Tunnel.BLL.Tunnel_menber();
                    tmList = tm.GetModelList("");

                    foreach (Tunnel.Model.Tunnel_menber item in tmList)
                    {
                        call(strTitle, relf.ToString(), DateTime.Now, item.m_id);
                    }
                }
                #endregion
            }
            Tunnel.Common.Message.Show("添加成功!", "VoteItemsAdd.aspx?id=" + relf + "");
        }
        else
        {
            Tunnel.Common.Message.Show("添加失败!");
        }
    }
예제 #6
0
    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 + "");
                }
            }
        }
    }