/// <summary>
        /// 删除【black_unusual】表中重复数据
        /// </summary>
        /// <returns></returns>
        private bool DelBlackSN()
        {
            black_unusual black = new black_unusual();

            black.SN = txtCheckIn.Text.Trim();
            string sqlBlack = string.Format("delete from black_unusual where SN='{0}'", black.SN);

            return(SqlHelper.modify(sqlBlack));
        }
        /// <summary>
        /// 从【cktimeinfo】表,添加所有数据到【black_unusual】表中
        /// </summary>
        /// <returns></returns>
        private int InsertBlack()
        {
            int a = 0;

            for (int i = 0; i < dgvReport.Rows.Count; i++)
            {
                black_unusual black = new black_unusual();
                if (dgvReport.Rows[i].Cells[2].Value.ToString() == "0000/00/00 00:00:00")
                {
                    //MessageBox.Show("表格中有SNCheckOut为空的黑色异常,已终止该部分上传!");
                    continue;
                }

                black.SN          = dgvReport.Rows[i].Cells[0].Value.ToString();
                black.SNCheckIn   = dgvReport.Rows[i].Cells[1].Value.ToString();
                black.SNCheckOut  = dgvReport.Rows[i].Cells[2].Value.ToString();
                black.Minute      = dgvReport.Rows[i].Cells[3].Value.ToString();
                black.employee_id = dgvReport.Rows[i].Cells[4].Value.ToString();
                string sql = string.Format("insert into black_unusual(SN,SNCheckIn,SNCheckOut,Minute,employee_id)values('{0}','{1}','{2}','{3}','{4}')"
                                           , black.SN, black.SNCheckIn, black.SNCheckOut, black.Minute, black.employee_id);
                a = SqlHelper.update(sql);
            }
            return(a);
        }
        /// <summary>
        /// SNCheckIn回车事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtCheckIn_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (txtCheckIn.Text.Trim() != "")
                {
                    //string txtText = txtCheckIn.Text;
                    //string regular1 = @"^[A-Za-z0-9]{10}$";
                    //string regular2 = @"^[A-Za-z0-9]{23}$";
                    //bool a = Regex.IsMatch(txtText, regular2);
                    //bool b=Regex.IsMatch(txtText,regular1);
                    //if (b==false && a==false)
                    //{
                    //    MessageBox.Show("格式错误!请输入10位或者23位的字母数字组合!");
                    //    txtCheckIn.Text = string.Empty;
                    //    return;
                    //}



                    black_unusual black = new black_unusual();
                    black.SN = txtCheckIn.Text.Trim();
                    string    sqlBlack = "select*from black_unusual where SN='" + black.SN + "'";
                    DataTable dtBlack  = SqlHelper.GetList(sqlBlack);

                    CkTimeInfo ck = new CkTimeInfo();
                    ck.SN = txtCheckIn.Text.Trim();
                    string    sqlCk = "select*from cktimeinfo where SN='" + ck.SN + "'";
                    DataTable dtCk  = SqlHelper.GetList(sqlCk);

                    if (dtBlack.Rows.Count <= 0 && dtCk.Rows.Count <= 0)
                    {
                        InserSNcheckIn();
                        if (rdoPersonal.Checked == true)
                        {
                            rdoPersonal_Click(null, null);
                        }
                        else if (rdoPublic.Checked == true)
                        {
                            rdoPublic_Click(null, null);
                        }

                        txtCheckIn.Text  = string.Empty;
                        txtCheckOut.Text = string.Empty;
                        return;
                    }

                    else
                    {
                        MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
                        DialogResult      dr         = MessageBox.Show("该SN已录入,是否删除?", "删除原纪录!!!", messButton);
                        if (dr == DialogResult.OK)
                        {
                            DelCkSN();
                            DelBlackSN();

                            if (rdoPersonal.Checked == true)
                            {
                                rdoPersonal_Click(null, null);
                            }
                            else if (rdoPublic.Checked == true)
                            {
                                rdoPublic_Click(null, null);
                            }
                        }
                        else
                        {
                            return;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("SNCheckIn输入值不能为空!");
                    return;
                }
            }
        }