Ejemplo n.º 1
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            string login = "******" + txt_user.Text + "' and password='******'";

            dtlogin = conn.BukaTabel(login);

            if (dtlogin.Rows.Count > 0)
            {
                txt_user.Text = ""; //menghilangkan inputan awal teks
                txt_pass.Text = "";
                this.Hide();        //menghilangkan / mengecilkan menu form login

                koneksi.nmuser = dtlogin.Rows[0][1].ToString();
                menu mn = new menu();
                mn.Show();
                mn.lb_user.Text = koneksi.nmuser;
            }
            else
            {
                MessageBox.Show("Data Tidak Ditemukan");
            }
        }
Ejemplo n.º 2
0
        private void btn_sav_Click(object sender, EventArgs e)
        {
            /*menu mn = new menu();
             *
             * if (this.Text == "Invoice - Tambah data")
             * {
             *  string transaksi1 = "insert into invoice(noinvoice, tanggal, idcust, username, totalvol, totaltag) " +
             *          " values('" + txt_noinv.Text + "' , '" + pick_time.Text + "' , '" + cb_idcust.Text + "' , '" + koneksi.nmuser + "' , '" + txt_totalvol.Text + "' , '" + txt_totaltag.Text + "') ";
             *  conn.AksiQuery(transaksi1);
             *  string transaksi2 = "insert into detinvoice(noinvoice, kdkayu, kdjasa, volume, tagihan) " +
             *          " values('" +txt_noinv.Text + "' , '" + cb_kayu.Text + "' , '" + cb_jasa.Text + "' , '" + txt_vol.Text + "' , '" + txt_tag.Text + "') ";
             *  conn.AksiQuery(transaksi2);
             *  MessageBox.Show("Simpan Transaksi Sukses.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
             *  this.Text = "Invoice";
             *  txt_noinv.Enabled = false;
             *  cb_idcust.Enabled = false;
             *  cb_kayu.Text = null;
             *  cb_jasa.Text = null;
             *  txt_vol.Clear(); txt_tag.Clear();
             *  TampilDetail();
             *  btn_add.Focus();
             *  this.Text = "Invoice - Tambah Data";
             *
             * }*/

            string SqlSimpan1;
            string SqlSimpan2;
            menu   mn = new menu();


            if (txt_noinv.Text == "")
            {
                MessageBox.Show("No Invoice Tidak Boleh Kosong", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (this.Text == "Invoice - Tambah Data")
                {
                    SqlSimpan1 = "insert into invoice(noinvoice, tanggal, idcust, username) " +
                                 " values('" + txt_noinv.Text + "' , '" + pick_time.Text + "' , '" + cb_idcust.Text + "' , '" + koneksi.nmuser + "') ";
                    conn.AksiQuery(SqlSimpan1);
                    SqlSimpan2 = "insert into detinvoice(noinvoice, kdkayu, kdjasa, volume, tagihan) " +
                                 " values('" + txt_noinv.Text + "' , '" + cb_kayu.Text + "' , '" + cb_jasa.Text + "' , '" + txt_vol.Text + "' , '" + txt_tag.Text + "') ";
                    conn.AksiQuery(SqlSimpan2);
                    MessageBox.Show("Data Invoice Berhasil Disimpan");
                    TampilInvoice();
                    this.Text = "invoice";
                }
                else if (this.Text == "Invoice - Edit Jasa")
                {
                    string edit = "update invoice set tanggal='" + pick_time.Text + "', idcust='" + cb_idcust.Text + "' where noinvoice='" + txt_noinv.Text + "'";
                    conn.AksiQuery(edit);
                    string edit1 = "update detinvoice set kdkayu='" + cb_kayu.Text + "', kdjasa='" + cb_jasa.Text + "', volume='" + txt_vol.Text + "', tagihan='" + txt_tag.Text + "' where detinvoice='" + txt_noinv.Text + "'";
                    conn.AksiQuery(edit1);
                    MessageBox.Show("Edit Data Berhasil", "SUCCESS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txt_noinv.Clear();
                    pick_time.Text = null;
                    cb_idcust.Text = null; txt_nacust.Clear();

                    cb_kayu.Text = null; txt_nakayu.Clear();
                    cb_jasa.Text = null; txt_jenis.Clear();
                    txt_harga.Clear();
                    txt_vol.Clear();
                    TampilInvoice();
                }
            }
        }