Beispiel #1
0
        //签到功能
        private void button5_Click(object sender, EventArgs e)
        {
            if (dataGridView4.CurrentRow == null)
            {
                return;
            }
            int    clsid  = Convert.ToInt32(dataGridView4.CurrentRow.Cells[0].Value);
            string ip     = GetLocalIPAddress();
            string time   = DateTime.Now.ToString();
            string status = "成功";

            if ((int)SignManager.CheckSignUp(student.Id, clsid) == 0)
            {
                if (SignManager.SignUp(student, student.Name, clsid, ip, time, status))
                {
                    MessageBox.Show(
                        "签到成功!",
                        "成功",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                    Fill();
                }
                else
                {
                    MessageBox.Show("签到失败!请重新选择!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("该节课已签到!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }