Пример #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            caridata cari = new caridata();

            this.Hide();
            cari.Show();
        }
Пример #2
0
        private void caridata_Click(object sender, EventArgs e)
        {
            caridata cari = new caridata();

            cari.passValue(username);
            this.Hide();
            cari.Show();
        }
Пример #3
0
        private void simpan_Click(object sender, EventArgs e)
        {
            if (nama.Text == "" || nip.Text == "" || tempat_lahir.Text == "" || pendidikan.Text == "" || pangkat.Text == "" || jabatan.Text == "" || gaji.Text == "" || terbilang.Text == "")
            {
                MessageBox.Show("Lengkapi Data Terlebih Dahulu");
            }
            else
            {
                string query1 = "INSERT INTO datapegawai (nama, nip, tmptlhr, tgllhr, pendidikan) VALUES (@Nama, @Nip, @tempat_lahir, @tanggal_lahir, @pendidikan)";
                string query2 = "INSERT INTO datask (nip, tglmsk, pangkat, jabatan, tmptkerja, gajipokok, terbilang, scan, tglsk) VALUES (@Nip, @tanggal_masuk, @pangkat, @jabatan, @tempat_kerja, @gaji_pokok, @Terbilang, @scan_sk, @tglsk)";
                try
                {
                    // Open the database
                    //databaseConnection.Open();
                    MyConn();
                    MySqlCommand cmd1 = new MySqlCommand(query1, conn);
                    cmd1.CommandTimeout = 60;
                    cmd1.Parameters.AddWithValue("@Nama", nama.Text);
                    cmd1.Parameters.AddWithValue("@Nip", nip.Text);
                    cmd1.Parameters.AddWithValue("@tempat_lahir", tempat_lahir.Text);
                    var tgl1 = this.tgl_lhr.Value.ToString("yyyy-MM-dd");
                    cmd1.Parameters.AddWithValue("@tanggal_lahir", tgl1);
                    cmd1.Parameters.AddWithValue("@pendidikan", pendidikan.Text);
                    cmd1.ExecuteNonQuery();
                    cmd1.Parameters.Clear();
                    MySqlCommand cmd2 = new MySqlCommand(query2, conn);
                    cmd2.CommandTimeout = 60;
                    cmd2.Parameters.AddWithValue("@Nip", nip.Text);
                    var tgl2 = this.tgl_mulai.Value.ToString("yyyy-MM-dd");
                    cmd2.Parameters.AddWithValue("@tanggal_masuk", tgl2);
                    cmd2.Parameters.AddWithValue("@pangkat", pangkat.Text);
                    cmd2.Parameters.AddWithValue("@jabatan", jabatan.Text);
                    cmd2.Parameters.AddWithValue("@tempat_kerja", tempat_Kerja.Text);
                    cmd2.Parameters.AddWithValue("@gaji_pokok", this.gaji.Text);
                    cmd2.Parameters.AddWithValue("@Terbilang", terbilang.Text);
                    cmd2.Parameters.AddWithValue("@scan_sk", System.IO.File.ReadAllBytes(openFileDialog1.FileName));
                    var tgl3 = this.tgl_sk.Value.ToString("yyyy-MM-dd");
                    cmd2.Parameters.AddWithValue("@tglsk", tgl3);
                    cmd2.ExecuteNonQuery();
                    cmd2.Parameters.Clear();

                    MessageBox.Show("Data berhasil disimpan");
                    caridata c = new caridata();
                    c.Show();
                    this.Hide();
                    //notif.opTanggal(dateTimePicker1);
                }
                catch (Exception ex)
                {
                    // Show any error message.
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    conn.Close();
                }
            }
        }
Пример #4
0
        private void simpan_Click(object sender, EventArgs e)
        {
            String name = nama.Text;
            String nipp = nip.Text;
            String tmpt = tempat_lahir.Text;
            //String tgl = tgl_lhr.Text;
            String pend = pendidikan.Text;
            //String tglM = tgl_mulai.Text;
            String pangkatt = pangkat.Text;
            String jabatann = jabatan.Text;
            String tmptK    = tempat_Kerja.Text;
            String gajii    = gaji.Text;
            String terbil   = terbilang.Text;
            var    tgl3     = this.tgl_sk.Value.ToString("yyyy-MM-dd");
            var    tgl2     = this.tgl_lhr.Value.ToString("yyyy-MM-dd");
            var    tgl1     = this.tgl_mulai.Value.ToString("yyyy-MM-dd");


            //if (openFileDialog1.FileName == null)
            //{
            MyConn();
            String       q   = "UPDATE datask a join datapegawai b ON a.nip = b.nip  SET b.nama=@n, b.tmptlhr=@lhr, b.tgllhr=@tgllhr, b.pendidikan=@pend, a.scan=@scan, a.nip=@nip, a.tglmsk=@tglmsk, a.pangkat=@pangkat, a.jabatan=@jabatan, a.tmptkerja=@tmptkrja, a.gajipokok=@gaji, a.terbilang=@terbilang, a.tglsk=@tgl_sk where a.nip=@NIP ";
            MySqlCommand cmd = new MySqlCommand(q, conn);

            try
            {
                cmd.Parameters.AddWithValue("@Scan", System.IO.File.ReadAllBytes(openFileDialog1.FileName));
                cmd.Parameters.AddWithValue("@n", name);
                cmd.Parameters.AddWithValue("@lhr", tmpt);
                cmd.Parameters.AddWithValue("@tgllhr", tgl2);
                cmd.Parameters.AddWithValue("@pend", pend);
                cmd.Parameters.AddWithValue("@nip", nipp);
                cmd.Parameters.AddWithValue("@tglmsk", tgl1);
                cmd.Parameters.AddWithValue("@pangkat", pangkatt);
                cmd.Parameters.AddWithValue("@jabatan", jabatann);
                cmd.Parameters.AddWithValue("@tmptkrja", tmptK);

                cmd.Parameters.AddWithValue("@gaji", gajii);
                cmd.Parameters.AddWithValue("@terbilang", terbil);
                cmd.Parameters.AddWithValue("@tgl_sk", tgl3);

                cmd.ExecuteNonQuery();
                MessageBox.Show("Edit profil berhasil!");
                caridata c = new caridata();
                c.Show();
                this.Hide();
            }
            catch (Exception)
            {
                MessageBox.Show("Data SK belum diinputkan");
            }


            //cmd.Parameters.AddWithValue("@tglmsk", tglM);
            conn.Close();

            //}
        }