예제 #1
0
        public List <Peserta> getPesertaAssign(String sessionID)
        {
            List <Peserta> peser = new List <Peserta>();

            conn.getConnected.Open();
            SqlCommand    cmd = new SqlCommand("select * from peserta where not exists (select sessionid from checkin where checkin.pesertaid=peserta.pesertaid and sessionid='" + sessionID + " ') ", conn.getConnected);
            SqlDataReader dr  = cmd.ExecuteReader();

            while (dr.Read())
            {
                Peserta p = new Peserta();
                p.pesertaID    = dr[0].ToString();
                p.nama         = dr[1].ToString();
                p.gender       = dr[2].ToString();
                p.email        = dr[3].ToString();
                p.phone        = dr[4].ToString();
                p.jenisPeserta = dr[5].ToString();
                p.asalNegara   = dr[6].ToString();
                p.university   = dr[7].ToString();
                p.paket        = dr[8].ToString();
                p.panel1       = dr[9].ToString();
                p.panel2       = dr[10].ToString();
                peser.Add(p);
            }
            dr.Close();
            conn.getConnected.Close();
            return(peser);
        }
예제 #2
0
        public Peserta getPeserta(String pesertaID)
        {
            Peserta p = new Peserta();

            if (conn.getConnected.State != ConnectionState.Open)
            {
                conn.getConnected.Open();
            }
            SqlCommand    cmd = new SqlCommand("SELECT * from Peserta where pesertaID= '" + pesertaID + "' ", conn.getConnected);
            SqlDataReader dr  = cmd.ExecuteReader();

            while (dr.Read())
            {
                p.pesertaID    = dr[0].ToString();
                p.nama         = dr[1].ToString();
                p.gender       = dr[2].ToString();
                p.email        = dr[3].ToString();
                p.phone        = dr[4].ToString();
                p.jenisPeserta = dr[5].ToString();
                p.asalNegara   = dr[6].ToString();
                p.university   = dr[7].ToString();
                p.paket        = dr[8].ToString();
                p.panel1       = dr[9].ToString();
                p.panel2       = dr[10].ToString();
            }
            dr.Close();
            conn.getConnected.Close();
            return(p);
        }
예제 #3
0
        public void checkin(Peserta p, Session s)
        {
            if (conn.getConnected.State == ConnectionState.Closed)
            {
                conn.getConnected.Open();
            }
            SqlCommand cmd = new SqlCommand("UPDATE checkin SET Status ='Checkedin',checkin='" + DateTime.Now.ToString("HH:mm:ss") + "' WHERE pesertaid='" + p.pesertaID + "' and sessionid='" + s.sessionID + "'", conn.getConnected);

            cmd.ExecuteNonQuery();
            conn.getConnected.Close();
            Console.WriteLine();
        }
예제 #4
0
        private Peserta checkin2()
        {
            bool auth = ad.Checkin(Currentemail, ses.sessionID);

            if (auth == true)
            {
                authorizedPeserta = true;
                Peserta p = ad.getPeserta(ad.getPesertaID(Currentemail));
                return(p);
            }
            else
            {
                authorizedPeserta = false;
                return(null);
            }
        }
예제 #5
0
        private void checkin()
        {
            bool auth = ad.Checkin(txtEmail.Text, ses.sessionID);

            if (auth == true)
            {
                Peserta p = ad.getPeserta(ad.getPesertaID(txtEmail.Text));
                //MessageBox.Show("Welcome " + p.nama + " !");
                hidecontrol();
                FormParticipantCheckin s = new FormParticipantCheckin(p, ses);
                s.ShowDialog();
                if (s.DialogResult == DialogResult.OK)
                {
                    showcontrol();
                    txtEmail.Text      = "Enter your email here";
                    txtEmail.ForeColor = Color.Gray;
                    label2.Focus();
                }
            }
            else
            {
                if (ad.CheckStatusCheckin(txtEmail.Text, ses.sessionID) == "Checkedin")
                {
                    MessageBox.Show("You have done the check-in. Thank you.");
                }
                else
                {
                    attemp += 1;
                    if (attemp >= 3)
                    {
                        MessageBox.Show("There must be a mistake, please refer to our officers.");
                    }
                    else
                    {
                        MessageBox.Show("Sorry, you entered wrong email. Please try again.");
                    }
                }
            }
        }
예제 #6
0
        public void loadPesertaCheckin(System.Windows.Forms.DataGridView dgv, String sessionID)
        {
            List <String> pesertaids = new List <string>();

            if (conn.getConnected.State == ConnectionState.Closed)
            {
                conn.getConnected.Open();
            }
            SqlCommand    cmd = new SqlCommand(@"select pesertaid from checkin where sessionid='" + sessionID + "'", conn.getConnected);
            SqlDataReader dr  = cmd.ExecuteReader();

            while (dr.Read())
            {
                pesertaids.Add(dr[0].ToString());
            }
            dr.Close();
            conn.getConnected.Close();
            if (dgv.RowCount > 0)
            {
                dgv.Rows.Clear();
            }
            for (int i = 0; i < pesertaids.Count; i++)
            {
                Peserta p      = getPeserta(pesertaids[i]);
                String  status = getPesertaCheckinStatus(sessionID, p.pesertaID);
                dgv.Rows.Add(getPesertaTimestamp(sessionID, p.pesertaID), status, p.nama, p.email, p.jenisPeserta, p.asalNegara, p.university, p.paket);
                int n = dgv.RowCount;
                n -= 1;
                dgv.Rows[n].Cells[1].Style.ForeColor = System.Drawing.Color.White;
                if (status == "Checkedin")
                {
                    dgv.Rows[n].Cells[1].Style.BackColor = System.Drawing.Color.Green;
                }
                else
                {
                    dgv.Rows[n].Cells[1].Style.BackColor = System.Drawing.Color.Navy;
                }
            }
        }
예제 #7
0
        public DataTable loadPesertaCheckin3(String sessionID)
        {
            //List<Peserta> pesertas = new List<Peserta>();
            if (conn.getConnected.State == ConnectionState.Closed)
            {
                conn.getConnected.Open();
            }
            SqlDataAdapter sda = new SqlDataAdapter(@"select pesertaid from checkin where sessionid='" + sessionID + "'", conn.getConnected);
            DataTable      dat = new DataTable();

            sda.Fill(dat);
            DataTable dt = new DataTable();

            dt.Columns.Add("Timestamp");
            dt.Columns.Add("Status");
            dt.Columns.Add("Nama");
            dt.Columns.Add("Email");
            dt.Columns.Add("Jenis Peserta");
            dt.Columns.Add("Asal Negara");
            dt.Columns.Add("University");
            dt.Columns.Add("Paket");
            for (int i = 0; i < dat.Rows.Count; i++)
            {
                Peserta p   = getPeserta(dat.Rows[i][0].ToString());
                DataRow row = dt.NewRow();
                row["Timestamp"]     = getPesertaTimestamp(sessionID, p.pesertaID);
                row["Status"]        = getPesertaCheckinStatus(sessionID, p.pesertaID);
                row["Nama"]          = p.nama;
                row["Email"]         = p.email;
                row["Jenis Peserta"] = p.jenisPeserta;
                row["Asal Negara"]   = p.asalNegara;
                row["University"]    = p.university;
                row["Paket"]         = p.paket;
                dt.Rows.Add(row);
            }
            conn.getConnected.Close();
            return(dt);
        }
예제 #8
0
 private void btnCheckin_Click(object sender, EventArgs e)
 {
     try
     {
         Peserta pr = new Peserta();
         pr.pesertaID = ad.getIDpesByEmail(dataGridView1.SelectedRows[0].Cells[3].Value.ToString());
         foreach (Session item in ad.getSession())
         {
             if (item.name == comboSession.SelectedItem.ToString())
             {
                 pr.checkin(pr, item); break;
             }
         }
         MessageBox.Show("Success!");
         dataGridView1.SelectedRows[0].Cells[0].Value           = DateTime.Now.ToString("HH:mm:ss");
         dataGridView1.SelectedRows[0].Cells[1].Value           = "Checkedin";
         dataGridView1.SelectedRows[0].Cells[1].Style.BackColor = System.Drawing.Color.Green;
         dataGridView1.SelectedRows[0].Cells[1].Style.ForeColor = System.Drawing.Color.White;
     }
     catch (Exception ex)
     {
         MessageBox.Show("[ERROR] " + ex.Message);
     }
 }
예제 #9
0
 public FormParticipantCheckin(Peserta per, Session ss)
 {
     InitializeComponent();
     pr  = per;
     ses = ss;
 }