Exemple #1
0
 private void vistaButton6_Click(object sender, EventArgs e)
 {
     try
     {
         if (txt_no_induk.Text != "")
         {
             ds = new DataSet();
             ds = koneksi.GetData("select * from siswa where no_induk = '" + txt_no_induk.Text + "'");
             if (ds.Tables[0].Rows.Count > 0)
             {
                 foreach (DataRow kolom in ds.Tables[0].Rows)
                 {
                     txt_no_induk.Text        = kolom["no_induk"].ToString();
                     txt_nama.Text            = kolom["nama"].ToString();
                     txt_alamat.Text          = kolom["alamat"].ToString();
                     txt_namawali.Text        = kolom["nama_wali"].ToString();
                     txt_hp.Text              = kolom["no_hp"].ToString();
                     comboBox1.Text           = kolom["kelas"].ToString();
                     txt_no_induk.Enabled     = false;
                     btn_cari.Enabled         = false;
                     btn_simpan.Enabled       = false;
                     btn_bersih.Enabled       = true;
                     btn_ubah.Enabled         = true;
                     btn_hapus.Enabled        = true;
                     btn_delete_all.Enabled   = false;
                     textBox1.Enabled         = false;
                     dataGridView1.DataSource = ds.Tables[0];
                     SetDataGridView(ds);
                 }
             }
             else
             {
                 MessageBox.Show("Data yang anda cari tidak ada !", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 txt_no_induk.Clear();
                 txt_no_induk.Focus();
             }
         }
         else
         {
             MessageBox.Show("Masukkan nomer induk yang anda cari !!!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             txt_no_induk.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #2
0
 private void Guru_Load(object sender, EventArgs e)
 {
     try
     {
         koneksi                = new Konektor();
         ds                     = new DataSet();
         btn_bersih.Enabled     = false;
         btn_ubah.Enabled       = false;
         btn_hapus.Enabled      = false;
         btn_cari.Enabled       = true;
         btn_simpan.Enabled     = true;
         btn_delete_all.Enabled = true;
         txt_kodeguru.Enabled   = true;
         txt_kodeguru.Clear();
         txt_namaGuru.Clear();
         txt_Alamat.Clear();
         txt_hp.Clear();
         txt_jabatan.Clear();
         textBox5.Enabled = true;
         txt_kodeguru.Focus();
         ds.Clear();
         ds = koneksi.GetData("select * from guru");
         SetDataGridView(ds);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #3
0
 private void btn_cari_Click(object sender, EventArgs e)
 {
     try
     {
         if (txt_kodeguru.Text != "")
         {
             ds = new DataSet();
             ds = koneksi.GetData("select * from guru where no_guru = '" + txt_kodeguru.Text + "'");
             if (ds.Tables[0].Rows.Count > 0)
             {
                 foreach (DataRow kolom in ds.Tables[0].Rows)
                 {
                     txt_kodeguru.Text        = kolom["no_guru"].ToString();
                     txt_namaGuru.Text        = kolom["nama_guru"].ToString();
                     txt_Alamat.Text          = kolom["alamat"].ToString();
                     txt_hp.Text              = kolom["no_hp"].ToString();
                     txt_jabatan.Text         = kolom["jabatan"].ToString();
                     txt_kodeguru.Enabled     = false;
                     btn_cari.Enabled         = false;
                     btn_simpan.Enabled       = false;
                     btn_bersih.Enabled       = true;
                     btn_ubah.Enabled         = true;
                     btn_hapus.Enabled        = true;
                     btn_delete_all.Enabled   = false;
                     textBox5.Enabled         = false;
                     dataGridView1.DataSource = ds.Tables[0];
                     SetDataGridView(ds);
                 }
             }
             else
             {
                 MessageBox.Show("Data yang anda cari tidak ada !", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 txt_kodeguru.Clear();
                 txt_kodeguru.Focus();
             }
         }
         else
         {
             MessageBox.Show("Masukkan kode yang anda cari !!!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             txt_kodeguru.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
 private void AddSiswa_Load(object sender, EventArgs e)
 {
     try
     {
         koneksi = new Konektor();
         ds = new DataSet();
         ds = koneksi.GetData("select * from classes order by kelas desc");
         comboBox1.Items.Clear();
         for (byte i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             if (ds.Tables[0].Rows[i][0].ToString() != "Semua")
             {
                 comboBox1.Items.Add(ds.Tables[0].Rows[i][0].ToString());
             }
         }
         comboBox1.SelectedIndex = 0;
         btn_bersih.Enabled = false;
         btn_ubah.Enabled = false;
         btn_hapus.Enabled = false;
         btn_cari.Enabled = true;
         btn_simpan.Enabled = true;
         btn_delete_all.Enabled = true;
         txt_no_induk.Enabled = true;
         txt_no_induk.Clear();
         txt_nama.Clear();
         txt_alamat.Clear();
         txt_namawali.Clear();
         txt_hp.Clear();
         textBox1.Enabled = true;
         txt_no_induk.Focus();
         ds.Clear();
         ds = koneksi.GetData("select * from siswa");
         SetDataGridView(ds);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #5
0
 private void AddSiswa_Load(object sender, EventArgs e)
 {
     try
     {
         koneksi = new Konektor();
         ds      = new DataSet();
         ds      = koneksi.GetData("select * from classes order by kelas desc");
         comboBox1.Items.Clear();
         for (byte i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             if (ds.Tables[0].Rows[i][0].ToString() != "Semua")
             {
                 comboBox1.Items.Add(ds.Tables[0].Rows[i][0].ToString());
             }
         }
         comboBox1.SelectedIndex = 0;
         btn_bersih.Enabled      = false;
         btn_ubah.Enabled        = false;
         btn_hapus.Enabled       = false;
         btn_cari.Enabled        = true;
         btn_simpan.Enabled      = true;
         btn_delete_all.Enabled  = true;
         txt_no_induk.Enabled    = true;
         txt_no_induk.Clear();
         txt_nama.Clear();
         txt_alamat.Clear();
         txt_namawali.Clear();
         txt_hp.Clear();
         textBox1.Enabled = true;
         txt_no_induk.Focus();
         ds.Clear();
         ds = koneksi.GetData("select * from siswa");
         SetDataGridView(ds);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
 private void SetDataGridView(string query)
 {
     try
     {
         koneksi = new Konektor();
         dataGridView1.DataSource            = koneksi.GetData(query).Tables[0];
         dataGridView1.Columns[0].HeaderText = "Kelas";
         dataGridView1.Columns[0].Width      = 200;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #7
0
 private void FormSMS_Load(object sender, EventArgs e)
 {
     try
     {
         koneksi = new Konektor();
         ds      = new DataSet();
         ds      = koneksi.GetData("select * from classes order by kelas desc");
         comboBox1.Items.Add("Semua");
         for (byte i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             comboBox1.Items.Add(ds.Tables[0].Rows[i][0].ToString());
         }
         comboBox1.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        private void btn_simpan_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text != "")
                {
                    koneksi = new Konektor();
                    ds      = new DataSet();

                    query = "select * from classes where kelas = '" + textBox1.Text + "';";

                    ds = koneksi.GetData(query);
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        query = "insert into Classes values ('" + textBox1.Text + "');";
                        byte res = (byte)koneksi.ManipulasiData(query);
                        if (res == 1)
                        {
                            MessageBox.Show("Berhasil menambah data");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Kelas sudah terdaftar !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Mohon Lengkapi Data Dulu !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                Kelas_Load(null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #9
0
        private void btn_simpan_Click(object sender, EventArgs e)
        {
            try
            {
                koneksi = new Konektor();
                if (txt_kodeguru.Text == "" || txt_namaGuru.Text == "" || txt_Alamat.Text == "" || txt_hp.Text == "")
                {
                    MessageBox.Show("Mohon Lengkapi Data Dulu !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txt_kodeguru.Focus();
                }
                else
                {
                    ds = new DataSet();
                    ds = koneksi.GetData("select * from guru where no_guru = '" + txt_kodeguru.Text + "'");

                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        query = "insert into guru values ('" + txt_kodeguru.Text + "','" + txt_namaGuru.Text + "','" + txt_Alamat.Text + "','" + txt_hp.Text + "','" + txt_jabatan.Text + "');";
                        byte res = (byte)koneksi.ManipulasiData(query);
                        if (res == 1)
                        {
                            MessageBox.Show("Berhasil menambah data !!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        Guru_Load(null, null);
                    }
                    else
                    {
                        MessageBox.Show("No Induk sudah terpakai", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        txt_kodeguru.Clear();
                        txt_kodeguru.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #10
0
        private void vistaButton2_Click(object sender, EventArgs e)
        {
            try
            {
                koneksi = new Konektor();
                if (txt_no_induk.Text == "" || txt_nama.Text == "" || txt_namawali.Text == "" || txt_hp.Text == "")
                {
                    MessageBox.Show("Mohon Lengkapi Data Dulu !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txt_no_induk.Focus();
                }
                else
                {
                    ds = new DataSet();
                    ds = koneksi.GetData("select * from siswa where no_induk = '" + txt_no_induk.Text + "'");

                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        query = "insert into siswa values ('" + txt_no_induk.Text + "','" + txt_nama.Text + "','" + txt_alamat.Text + "','" + comboBox1.Text + "','" + txt_namawali.Text + "','" + txt_hp.Text + "');";
                        byte res = (byte)koneksi.ManipulasiData(query);
                        if (res == 1)
                        {
                            MessageBox.Show("Berhasil menambah data !!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        AddSiswa_Load(null, null);
                    }
                    else
                    {
                        MessageBox.Show("No Induk sudah terpakai", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        txt_no_induk.Clear();
                        txt_no_induk.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #11
0
        private DataTable GetDataSource(string query)
        {
            DataTable dTable = new DataTable();

            DataRow  dRow = null;
            DateTime dTime;
            Random   rnd = new Random();

            dTable.Columns.Add("_Check", System.Type.GetType("System.Boolean"));
            dTable.Columns.Add("_no_induk");
            dTable.Columns.Add("_nama");
            dTable.Columns.Add("_alamat");
            dTable.Columns.Add("_kelas");
            dTable.Columns.Add("_nama_wali");
            dTable.Columns.Add("_nomer_hp");

            ds = new DataSet();
            ds = koneksi.GetData(query);

            for (int n = 0; n < ds.Tables[0].Rows.Count; ++n)
            {
                dRow  = dTable.NewRow();
                dTime = DateTime.Now;

                dRow["_Check"]     = "true";
                dRow["_no_induk"]  = ds.Tables[0].Rows[n][0].ToString();
                dRow["_nama"]      = ds.Tables[0].Rows[n][1].ToString();
                dRow["_alamat"]    = ds.Tables[0].Rows[n][2].ToString();
                dRow["_kelas"]     = ds.Tables[0].Rows[n][3].ToString();
                dRow["_nama_wali"] = ds.Tables[0].Rows[n][4].ToString();
                dRow["_nomer_hp"]  = ds.Tables[0].Rows[n][5].ToString();

                dTable.Rows.Add(dRow);
                dTable.AcceptChanges();
            }

            return(dTable);
        }
 private void SetDataGridView(string query)
 {
     try
     {
         koneksi = new Konektor();
         dataGridView1.DataSource = koneksi.GetData(query).Tables[0];
         dataGridView1.Columns[0].HeaderText = "Kelas";
         dataGridView1.Columns[0].Width = 200;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        private DataTable GetDataSource(string query)
        {
            DataTable dTable = new DataTable();

            DataRow dRow = null;
            DateTime dTime;
            Random rnd = new Random();

            dTable.Columns.Add("_Check", System.Type.GetType("System.Boolean"));
            dTable.Columns.Add("_kode_guru");
            dTable.Columns.Add("_nama_guru");
            dTable.Columns.Add("alamat");
            dTable.Columns.Add("_no_hp");
            dTable.Columns.Add("jabatan");

            ds = new DataSet();
            koneksi = new Konektor();
            ds = koneksi.GetData(query);

            for (int n = 0; n < ds.Tables[0].Rows.Count; ++n)
            {
                dRow = dTable.NewRow();
                dTime = DateTime.Now;

                dRow["_Check"] = "true";
                dRow["_kode_guru"] = ds.Tables[0].Rows[n][0].ToString();
                dRow["_nama_guru"] = ds.Tables[0].Rows[n][1].ToString();
                dRow["alamat"] = ds.Tables[0].Rows[n][2].ToString();
                dRow["_no_hp"] = ds.Tables[0].Rows[n][3].ToString();
                dRow["jabatan"] = ds.Tables[0].Rows[n][4].ToString();

                dTable.Rows.Add(dRow);
                dTable.AcceptChanges();
            }

            return dTable;
        }
        private void btn_simpan_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text != "")
                {
                    koneksi = new Konektor();
                    ds = new DataSet();

                    query = "select * from classes where kelas = '"+textBox1.Text+"';";

                    ds = koneksi.GetData(query);
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        query = "insert into Classes values ('" + textBox1.Text + "');";
                        byte res = (byte)koneksi.ManipulasiData(query);
                        if (res == 1)
                        {
                            MessageBox.Show("Berhasil menambah data");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Kelas sudah terdaftar !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Mohon Lengkapi Data Dulu !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                Kelas_Load(null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void vistaButton2_Click(object sender, EventArgs e)
        {
            try
            {
                koneksi = new Konektor();
                if (txt_no_induk.Text == "" || txt_nama.Text == "" || txt_namawali.Text == "" || txt_hp.Text == "")
                {
                    MessageBox.Show("Mohon Lengkapi Data Dulu !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txt_no_induk.Focus();
                }
                else
                {
                    ds = new DataSet();
                    ds = koneksi.GetData("select * from siswa where no_induk = '"+txt_no_induk.Text+"'");

                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        query = "insert into siswa values ('" + txt_no_induk.Text + "','" + txt_nama.Text + "','" + txt_alamat.Text + "','" + comboBox1.Text + "','" + txt_namawali.Text + "','" + txt_hp.Text + "');";
                        byte res = (byte)koneksi.ManipulasiData(query);
                        if (res == 1)
                        {
                            MessageBox.Show("Berhasil menambah data !!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        AddSiswa_Load(null, null);
                    }
                    else
                    {
                        MessageBox.Show("No Induk sudah terpakai","Warning",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                        txt_no_induk.Clear();
                        txt_no_induk.Focus();
                    }

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
 private void FormSMS_Load(object sender, EventArgs e)
 {
     try
     {
         koneksi = new Konektor();
         ds = new DataSet();
         ds = koneksi.GetData("select * from classes order by kelas desc");
         comboBox1.Items.Add("Semua");
         for (byte i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             comboBox1.Items.Add(ds.Tables[0].Rows[i][0].ToString());
         }
         comboBox1.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #17
0
 private void Guru_Load(object sender, EventArgs e)
 {
     try
     {
         koneksi = new Konektor();
         ds = new DataSet();
         btn_bersih.Enabled = false;
         btn_ubah.Enabled = false;
         btn_hapus.Enabled = false;
         btn_cari.Enabled = true;
         btn_simpan.Enabled = true;
         btn_delete_all.Enabled = true;
         txt_kodeguru.Enabled = true;
         txt_kodeguru.Clear();
         txt_namaGuru.Clear();
         txt_Alamat.Clear();
         txt_hp.Clear();
         txt_jabatan.Clear();
         textBox5.Enabled = true;
         txt_kodeguru.Focus();
         ds.Clear();
         ds = koneksi.GetData("select * from guru");
         SetDataGridView(ds);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #18
0
        private void btn_simpan_Click(object sender, EventArgs e)
        {
            try
            {
                koneksi = new Konektor();
                if (txt_kodeguru.Text == "" || txt_namaGuru.Text == "" || txt_Alamat.Text == "" || txt_hp.Text == "")
                {
                    MessageBox.Show("Mohon Lengkapi Data Dulu !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txt_kodeguru.Focus();
                }
                else
                {
                    ds = new DataSet();
                    ds = koneksi.GetData("select * from guru where no_guru = '" + txt_kodeguru.Text + "'");

                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        query = "insert into guru values ('" + txt_kodeguru.Text + "','" + txt_namaGuru.Text + "','" + txt_Alamat.Text + "','" + txt_hp.Text + "','" + txt_jabatan.Text + "');";
                        byte res = (byte)koneksi.ManipulasiData(query);
                        if (res == 1)
                        {
                            MessageBox.Show("Berhasil menambah data !!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        Guru_Load(null, null);
                    }
                    else
                    {
                        MessageBox.Show("No Induk sudah terpakai", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        txt_kodeguru.Clear();
                        txt_kodeguru.Focus();
                    }

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }