Imports BaseFunction.PublicMethod
Partial Class Manager_Vote_VoteUser
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Dim mclsAnswer As New DB_Vote.clsVote_Answer
            Dim ID As Integer = 0
            If Integer.TryParse(Request("ID"), ID) Then
                Select Case Request("Action")
                    Case "Checked"
                        If mclsAnswer.ChangerChecked(ID) > 0 Then
                            ShowMessage(Me, "提示", "操作成功！", "")
                        Else
                            ShowMessage(Me, "提示", "操作失败！", "")
                        End If
                    Case "Del"
                        Dim mclsAnDetail As New DB_Vote.clsVote_Detailed
                        If mclsAnswer.Delete(ID) Then
                            mclsAnDetail.DeleteByAnswerID(ID)
                            ShowMessage(Me, "提示", "删除成功！", "")
                        Else
                            ShowMessage(Me, "提示", "删除失败！", "")
                        End If
                End Select
            End If
            GetList()
        End If
    End Sub
    Private Sub GetList()
        Dim mQueryLinq As IQueryable(Of DB_Vote.Vote_Answer) = DB_Vote.clsVote_Answer.GetLinq()
        Dim mList As List(Of DB_Vote.Vote_Answer)
        If txtUserName.Text.Length > 0 Then
            mQueryLinq = mQueryLinq.Where(Function(w) w.UserName = txtUserName.Text)
        End If
        If icEnd.SelectDateTime > icStart.SelectDateTime Then
            mQueryLinq = mQueryLinq.Where(Function(w) w.Addtime >= icStart.SelectDateTime And w.Addtime <= icEnd.SelectDateTime)
        End If
        If ListPaging.SumCount >= 0 Then
            mList = mQueryLinq.ToList
            ListPaging.SumCount = mList.Count
            mList = mList.Skip(ListPaging.PageSize * ListPaging.PageNo).Take(ListPaging.PageSize).ToList
        Else
            mList = mQueryLinq.Skip(ListPaging.PageSize * ListPaging.PageNo).Take(ListPaging.PageSize).ToList
        End If
        rptList.DataSource = mList
        rptList.DataBind()
    End Sub

    Protected Sub ListPaging_Submit(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListPaging.Submit
        GetList()
    End Sub

    Protected Sub imgSearch_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgSearch.Click
        GetList()
    End Sub
End Class
