コード例 #1
0
        private void frmCheckIn_Load(object sender, EventArgs e)
        {
            try
            {
                // Loading webcam
                imgarray  = null;
                imgarray1 = null;
                webcam    = new WebCam();
                webcam.InitializeWebCam(ref pictureBox1);
                webcam.Start();

                // BC_CheckIn obj = new BC_CheckIn();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }


            BC_CheckIn obj = new BC_CheckIn();
            DataTable  dt, dt1 = new DataTable();

            dt = obj.GetAllVisitPurpose();

            if (dt.Rows.Count > 0)
            {
                cmbPurpose.DataSource    = dt;
                cmbPurpose.DisplayMember = "PurposeName";
                cmbPurpose.ValueMember   = "id";
            }
            cmbPurpose.SelectedIndex = 0;
            // cmbPurpose.Text = "Select Visit Purpose";

            dataGridViewX1.DataSource = obj.GetAllCheckINToday();
        }
コード例 #2
0
        private void buttonX4_Click(object sender, EventArgs e)
        {
            BC_CheckIn obj = new BC_CheckIn();

            obj.Name         = txtCNIC.Text;
            obj.CNIC         = txtName.Text;
            obj.Contact      = txtContact.Text;
            obj.adress       = txtAdress.Text;
            obj.BadgeNo      = txtBadgeNo.Text;
            obj.VisitPurpose = Convert.ToInt32(cmbPurpose.SelectedValue);
            // obj.FaceImage = imgarray;
            obj.VisiterID = Convert.ToInt32(lblVisitorID.Text);
            obj.UserID    = 1;
            obj.VisitID   = Convert.ToInt32(lblVisitID.Text);

            int result = obj.UpdateCheckIn();

            if (result == 1 || result == 2)
            {
                MessageBox.Show("Record updated successfully ", "Record Insertion", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                refresh();
            }
            else
            {
                MessageBox.Show("Record Updation failed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);;
            }
        }
コード例 #3
0
        private void refresh()
        {
            BC_CheckIn obj = new BC_CheckIn();

            txtCNIC.Text              = "";
            txtName.Text              = "";
            txtAdress.Text            = "";
            txtBadgeNo.Text           = "";
            txtContact.Text           = "";
            cmbPurpose.SelectedIndex  = 0;
            dataGridViewX1.DataSource = obj.GetAllCheckINToday();
            imgarray  = null;
            imgarray1 = null;
            webcam.Start();
            txtCNIC.Focus();
        }
コード例 #4
0
        private void txtCNIC_MouseLeave(object sender, EventArgs e)
        {
            DataTable  tb  = new DataTable();
            BC_CheckIn obj = new BC_CheckIn();

            obj.CNIC = txtCNIC.Text;
            tb       = obj.SearchByCNIC();
            if (tb.Rows.Count > 0)
            {
                txtName.Text    = tb.Rows[0][1].ToString();
                txtContact.Text = tb.Rows[0][4].ToString();
                txtAdress.Text  = tb.Rows[0][3].ToString();
            }
            else
            {
            }
        }
コード例 #5
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            BC_CheckIn obj = new BC_CheckIn();

            Control[] ctl = new Control[2];
            ctl[0] = txtName;
            ctl[1] = txtCNIC;
            if (ValidateContorl(ctl))
            {
                obj.Name         = txtName.Text;
                obj.CNIC         = txtCNIC.Text;
                obj.Contact      = txtContact.Text;
                obj.adress       = txtAdress.Text;
                obj.BadgeNo      = txtBadgeNo.Text;
                obj.VisitPurpose = Convert.ToInt32(cmbPurpose.SelectedValue);
                capture();
                obj.FaceImage = imgarray;
                obj.UserID    = 1;
                int result;
                if (obj.CheckBadgeIssuance(Convert.ToInt32(obj.BadgeNo)) == 1)
                {
                    result = obj.AddCheckIn();
                    if (result == 1 || result == 2)
                    {
                        MessageBox.Show("Record Inserted successfully ", "Record Insertion", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                        refresh();
                        imgarray = null;
                    }
                    else
                    {
                        MessageBox.Show("Record Not Inserted.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);;
                        imgarray = null;
                    }
                }
                else
                {
                    MessageBox.Show("Please Change Badge Num, BDGE IS ALREADY ISSUED");
                    webcam.Start();
                }
            }
        }