Beispiel #1
0
        private void checkin_simpleButton_Click(object sender, EventArgs e)
        {
            if (XtraMessageBox.Show("确认为勾选的学生签到吗", "消息",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            List <StudentInfo> checkin = new List <StudentInfo>();

            for (int i = 0; i < gridView2.RowCount; i++)
            {
                StudentInfo stu = gridView2.GetRow(i) as StudentInfo;
                if (stu.Checkin)
                {
                    checkin.Add(stu);
                }
            }

            foreach (var v in checkin)
            {
                v.Remaining -= 1;
                int result = StudentInfo.Updata(v);
            }
            CheckGroupMembers();
            XtraMessageBox.Show("签到完成", "消息", MessageBoxButtons.OK);

            //异步插入签到记录
            System.Threading.Tasks.Task t = new System.Threading.Tasks.Task(new Action(() => {
                checkin.ForEach(p => CheckinRecordInfo.AddRecord(p));
            }));
            t.Start();
        }
        private void Query()
        {
            gridControl1.DataSource    = CheckinRecordInfo.SimpleQuery(_pageIndex, _pageSize, _key, out _pageTotal);
            gridView1.FocusedRowHandle = _selectionRow;
            ColumnView columnView = gridControl1.FocusedView as ColumnView;

            columnView.MoveBy(0);
            gridControl1.RefreshDataSource();
            _page.SetPage(_pageIndex, _pageSize, _pageTotal);
        }