Ejemplo n.º 1
0
        private void personList_Load(object sender, EventArgs e)
        {
            BindCmbKSMC();
            DataTable dtStudents = studentsModel.GetList(combSql()).Tables[0];

            dgvList.DataSource = dtStudents;

            TitleDgvBillList();
        }
Ejemplo n.º 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (checkTxt() && dgvList.Rows.Count > 1)
            {
                try
                {
                    db_students studentModel = new db_students();
                    DataTable   dt           = studentModel.GetList(" stuName='" + txtStuName.Text.Trim() + "' and idcard='" + txtIdCard.Text.Trim() + "' and examNameID='" + publicModel.examName + "'").Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        MessageBox.Show("已存在相同的信息!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        studentModel.stuName    = txtStuName.Text.Trim();
                        studentModel.IdCard     = txtIdCard.Text.Trim();
                        studentModel.examNameID = publicModel.examName;
                        db_exam modelexam = new db_exam(txtIdCard.Text.Trim(), publicModel.examName);
                        string  kcName    = modelexam == null ? "" : modelexam.kaochangName;
                        studentModel.kaochangName = kcName;
                        studentModel.status       = "异常";

                        studentModel.prushTime       = "";
                        studentModel.sex             = "";
                        studentModel.nation          = "";
                        studentModel.birthday        = "";
                        studentModel.address         = "";
                        studentModel.qianzhengjiguan = "";
                        studentModel.youxiaoqixian   = "";
                        studentModel.applyNo         = "";

                        if (getStuExamRandomNum(kcName))
                        {
                            studentModel.stuNo = printStuNo;
                            studentModel.Add();
                            MessageBox.Show("添加成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            //更改导入学生签到状态
                            modelexam.status = "已签到";
                            modelexam.Update();
                            return;
                        }
                        else
                        {
                            MessageBox.Show("添加失败!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            else
            {
                MessageBox.Show("请输入考生信息,再添加!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }