Dim d As Date = e.Form.Controls("DateTimePicker1").Value
MessageBox.Show(d.year)
If d <> Nothing Then
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
Dim int As Integer = 0
For Each r As WinForm.ListViewRow In lvw.Rows
If r.Checked = True
int = int+1
End If
Next
If Int = 0 Then
MessageBox.show("你并没有选择任何人!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
Dim Result As DialogResult
Result = MessageBox.Show("你本次到岗人数为:" & int & "人,缺勤人数为:"& int & " 人,确定考勤吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
For Each r As WinForm.ListViewRow In lvw.Rows
Dim dr As DataRow = DataTables("实名制考勤").Find("年='" & d.Year & "' And 月='" & d.Month & "' And 姓名='" & r.Text & "'")
If dr Is Nothing Then
dr = DataTables("实名制考勤").AddNew
dr("年") = d.Year
dr("月") = d.Month
dr("姓名") = r.Text
End If
If r.Checked = True
dr("日" & d.Day) = "√"
Else
dr("日" & d.Day) = "×"
End If
Next
DataTables("实名制考勤").Save
End If
End If
Else
MessageBox.show("考勤日期不能为空!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If