private void dg_peg_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (dg_peg.SelectedIndex >= 0)
            {
                DataRowView dataRow = (DataRowView)dg_peg.SelectedItem;
                string      index   = dataRow.Row[0].ToString();

                k.sql = "select *from pegawai left join akun on pegawai.nip = akun.nip where pegawai.nip = '" + index + "'";
                k.setdt();
                Byte[] tmpfoto = new Byte[0];
                String tgllahir;
                foreach (DataRow baris in k.dt.Rows)
                {
                    txt_nip.Text  = baris[0].ToString();
                    txt_nama.Text = baris[1].ToString();
                    if (baris[2].ToString() == "Laki - Laki")
                    {
                        rb_laki.IsChecked = true;
                    }
                    else
                    {
                        rb_perempuan.IsChecked = true;
                    }
                    tgllahir = baris[3].ToString();
                    DateTime dt = Convert.ToDateTime(tgllahir);
                    dp_tgllahir.SelectedDate = dt;
                    txt_alamat.Text          = baris[4].ToString();
                    txt_tempatlahir.Text     = baris[5].ToString();
                    cmb_agama.Text           = baris[6].ToString();
                    cmb_jabatan.Text         = baris[7].ToString();


                    txt_nohp.Text = baris[8].ToString();

                    tmpfoto         = (Byte[])baris[9];
                    img_foto.Source = ByteImageConverter.ByteToImage(tmpfoto);


                    txt_username.Text     = baris[10].ToString();
                    txt_password.Password = baris[11].ToString();
                }
                btn_ubah.IsEnabled  = true;
                btn_hapus.IsEnabled = true;
            }
        }
Ejemplo n.º 2
0
        public form_menu(string nip, string _sessionid)
        {
            InitializeComponent();
            //load nama user
            //-----------------------------------
            k.sql = "select *from pegawai inner join akun on pegawai.nip = akun.nip where pegawai.nip='" + nip + "'";
            k.setdt();
            string cekhak = "";

            Byte[] tmpfoto = new Byte[0];
            foreach (DataRow baris in k.dt.Rows)
            {
                txt_namausr.Text    = baris[1].ToString();
                txt_nipusr.Text     = baris[0].ToString();
                txt_hakusr.Text     = baris[13].ToString();
                tmpfoto             = (Byte[])baris[9];
                fotousr.ImageSource = ByteImageConverter.ByteToImage(tmpfoto);
            }
            txt_namausr2.Text    = txt_namausr.Text;
            txt_nipusr2.Text     = txt_nipusr.Text;
            txt_hakusr2.Text     = txt_hakusr.Text;
            fotousr2.ImageSource = fotousr.ImageSource;

            sessionId = _sessionid;

            //timer-------------
            DispatcherTimer timer = new DispatcherTimer(DispatcherPriority.Render);

            timer.Interval = TimeSpan.FromMilliseconds(2500);
            timer.Tick    += timer_refreshData;
            timer.Start();

            //---------

            //Digital Clock-------------
            DispatcherTimer clock = new DispatcherTimer(DispatcherPriority.Render);

            clock.Interval = TimeSpan.FromSeconds(1);
            clock.Tick    += digitalClockTick;
            clock.Start();

            //---------
        }
        private void showdata()
        {
            k.sql = "select *from data_sekolah";
            k.setdt();

            Byte[] tmpfoto = new Byte[0];

            foreach (DataRow baris in k.dt.Rows)
            {
                txt_kdsklh.Text     = baris[0].ToString();
                txt_namasklh.Text   = baris[1].ToString();
                txt_alamat.Text     = baris[2].ToString();
                txt_kota.Text       = baris[3].ToString();
                txt_kec.Text        = baris[4].ToString();
                txt_kdpos.Text      = baris[5].ToString();
                txt_kepalasklh.Text = baris[6].ToString();
                txt_nip.Text        = baris[7].ToString();
                txt_notelp.Text     = baris[8].ToString();
                tmpfoto             = (Byte[])baris[9];
                img_foto.Source     = ByteImageConverter.ByteToImage(tmpfoto);
            }
        }
Ejemplo n.º 4
0
        private void dg_sisw_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (dg_sisw.SelectedIndex >= 0)
            {
                DataRowView dataRow = (DataRowView)dg_sisw.SelectedItem;
                string      index   = dataRow.Row[0].ToString();

                k.sql = "select *from siswa left join kelas on siswa.kd_kelas = kelas.kd_kelas where siswa.nis = '" + index + "'";
                k.setdt();
                Byte[] tmpfoto = new Byte[0];
                String tgllahir;
                foreach (DataRow baris in k.dt.Rows)
                {
                    txt_nisn.Text = baris[0].ToString();
                    txt_nis.Text  = baris[1].ToString();
                    txt_nama.Text = baris[2].ToString();
                    if (baris[3].ToString() == "Laki - Laki")
                    {
                        rb_laki.IsChecked = true;
                    }
                    else
                    {
                        rb_perempuan.IsChecked = true;
                    }
                    tgllahir = baris[4].ToString();
                    DateTime dt = Convert.ToDateTime(tgllahir);
                    dp_tgllahir.SelectedDate = dt;
                    txt_tempatlahir.Text     = baris[5].ToString();
                    txt_alamat.Text          = baris[6].ToString();
                    cmb_agama.Text           = baris[7].ToString();

                    tmpfoto         = (Byte[])baris[9];
                    img_foto.Source = ByteImageConverter.ByteToImage(tmpfoto);
                }
                btn_ubah.IsEnabled  = true;
                btn_hapus.IsEnabled = true;
            }
        }