Beispiel #1
0
        private void FrmUserInterface_Load(object sender, EventArgs e)
        {
            try
            {
                this.flowLayoutPnl.Controls.Clear();
                this.lblNama.Text = user.Nama;
                this.pbUser.Image = new ImageConverter().ConvertFrom(user.Pict) as Image;

                using (var dao = new BarangDAO(Setting.GetConnectionString()))
                {
                    if (dao.GetAllDataBarang().Capacity > 0)
                    {
                        listBarang = dao.GetAllDataBarang();

                        foreach (var brg in listBarang)
                        {
                            CustomCntrlBrg custom = new CustomCntrlBrg(brg);
                            this.flowLayoutPnl.Controls.Add(custom);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #2
0
        private void FrmTampilBarang_Load(object sender, EventArgs e)
        {
            using (var dao = new BarangDAO(sqlString))
            {
                if (dao.GetAllDataBarang(brg).Capacity > 0)
                {
                    this.dgvDataBarang.DataSource = null;
                    this.dgvDataBarang.DataSource = dao.GetAllDataBarang(brg);
                    this.dgvDataBarang.Columns[0].DataPropertyName = "kode";
                    this.dgvDataBarang.Columns[1].DataPropertyName = "nama";
                    this.dgvDataBarang.Columns[2].DataPropertyName = "jumlah";
                    this.dgvDataBarang.Columns[3].DataPropertyName = "harga";
                    this.dgvDataBarang.Columns[4].DataPropertyName = "Pajak";
                }
            }

            if (listOrder == null)
            {
                this.listOrder = new List <Order>();
            }

            else
            {
                this.dgvDataOrder.Rows.Clear();
                foreach (Order ord in listOrder)
                {
                    this.dgvDataOrder.Rows.Add(new string[] {
                        ord.DataBarang.Kode, ord.DataBarang.Nama, ord.DataBarang.Harga.ToString("c"),
                        ord.JumlahBeli.ToString(), $"{ord.Pajak.ToString()} %", ord.SubTotal.ToString("c")
                    });
                }
            }

            this.lblTotal.Text = temp.ToString("c");
        }
Beispiel #3
0
 private void FrmEditBarang_Load(object sender, EventArgs e)
 {
     this.dgvData.DataSource             = dao.GetAllDataBarang();
     dgvData.Columns[0].DataPropertyName = "KodeBarang";
     dgvData.Columns[1].DataPropertyName = "NamaBarang";
     dgvData.Columns[2].DataPropertyName = "HargaBarang";
     dgvData.Columns[3].DataPropertyName = "PajakBarang";
 }
 private void FrmTampilBarang_Load(object sender, EventArgs e)
 {
     using (var dao = new BarangDAO(sqlString))
     {
         if (dao.GetAllDataBarang().Capacity > 0)
         {
             this.dataGridView1.DataSource = null;
             this.dataGridView1.DataSource = dao.GetAllDataBarang();
             this.dataGridView1.Columns[0].DataPropertyName = "kode";
             this.dataGridView1.Columns[1].DataPropertyName = "nama";
             this.dataGridView1.Columns[2].DataPropertyName = "harga";
             this.dataGridView1.Columns[3].DataPropertyName = "jumlah";
         }
     }
 }
Beispiel #5
0
        private void btnSimpan_Click(object sender, EventArgs e)
        {
            using (var barangdao = new BarangDAO())
            {
                list = barangdao.GetAllDataBarang();
            }



            if (txtKode.Text.Trim() == "" || txtNama.Text.Trim() == "" || txtHarga.Text.Trim() == "" || txtPajak.Text.Trim() == "")
            {
                MessageBox.Show("Tolong isi semua data yang diperlukan!", "Kosong", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (txtKode.Text.Length > 4)
            {
                MessageBox.Show("Kode Barang tidak boleh melebihi 4 karakter!", "Kode Barang", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (txtNama.Text.Length > 50)
            {
                MessageBox.Show("Nama tidak boleh melebihi 50 karakter !", "Nama Terlalu Panjang", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (Decimal.Parse(txtPajak.Text) > 100)
            {
                MessageBox.Show("Pajak tidak boleh melebihi 100%", "Pajak Melebihi Batas", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (list.Find(i => i.Kode.ToLower().ToString().Trim() == txtKode.Text.Trim().ToLower()) != null)
            {
                MessageBox.Show("Kode barang invalid ! Coba kode lain!", "Kode Invalid", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                try
                {
                    using (var barangdao = new BarangDAO())
                    {
                        barangdao.Insert(new Barang
                        {
                            Kode  = txtKode.Text,
                            Nama  = txtNama.Text,
                            Harga = Double.Parse(txtHarga.Text),
                            Pajak = Decimal.Parse(txtPajak.Text)
                        });
                    }
                    MessageBox.Show("Penambahan Barang Berhasil", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Beispiel #6
0
        private void FrmAdminInterface_Load(object sender, EventArgs e)
        {
            try
            {
                this.lblAdmin.Text     = admin.Nama;
                this.pictureBox1.Image = new ImageConverter().ConvertFrom(admin.Pict) as Image;

                using (var dao = new BarangDAO(Setting.GetConnectionString()))
                {
                    this.dgvDataBarang.DataSource = null;
                    this.dgvDataBarang.DataSource = dao.GetAllDataBarang();
                    this.dgvDataBarang.Columns[0].DataPropertyName        = nameof(Barang.Kode);
                    this.dgvDataBarang.Columns[1].DataPropertyName        = nameof(Barang.Nama);
                    this.dgvDataBarang.Columns[2].DataPropertyName        = nameof(Barang.Jumlah);
                    this.dgvDataBarang.Columns[2].DefaultCellStyle.Format = "n0";
                    this.dgvDataBarang.Columns[3].DataPropertyName        = nameof(Barang.Harga);
                    this.dgvDataBarang.Columns[3].DefaultCellStyle.Format = "c0";
                }

                using (var dao = new AkunDAO(Setting.GetConnectionString()))
                {
                    this.dgvDataMember.DataSource = null;
                    this.dgvDataMember.DataSource = dao.GetAllDataAccount();
                    this.dgvDataMember.Columns[0].DataPropertyName        = nameof(Akun.Username);
                    this.dgvDataMember.Columns[1].DataPropertyName        = nameof(Akun.Nama);
                    this.dgvDataMember.Columns[2].DataPropertyName        = nameof(Akun.Total);
                    this.dgvDataMember.Columns[2].DefaultCellStyle.Format = "c0";
                }

                using (var dao = new PenjualanDAO(Setting.GetConnectionString()))
                {
                    this.dgvDataOrder.DataSource = null;
                    listData = dao.SejarahPenjualan(null, Setting.GetConnectionString());

                    foreach (Penjualan jual in listData)
                    {
                        this.dgvDataOrder.Rows.Add(new string[]
                        {
                            jual.NoOrder.ToString(), jual.Tanggal.ToShortDateString(), jual.DataBarang.Kode,
                            jual.DataBarang.Nama, jual.DataAkun.Nama, jual.DataBarang.Harga.ToString("c0"), jual.Quantity.ToString("n0"), jual.Total.ToString("c0")
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #7
0
        private void FrmTampilBarang_Load(object sender, EventArgs e)
        {
            using (var dao = new BarangDAO(sqlString))
            {
                if (dao.GetAllDataBarang().Count >= 0)
                {
                    this.dgvDataBarang.DataSource = null;
                    this.dgvDataBarang.DataSource = dao.GetAllDataBarang();
                    this.dgvDataBarang.Columns[0].DataPropertyName        = nameof(Barang.Kode);
                    this.dgvDataBarang.Columns[1].DataPropertyName        = nameof(Barang.Nama);
                    this.dgvDataBarang.Columns[2].DataPropertyName        = nameof(Barang.Jumlah);
                    this.dgvDataBarang.Columns[3].DataPropertyName        = nameof(Barang.Harga);
                    this.dgvDataBarang.Columns[3].DefaultCellStyle.Format = "c";
                    this.dgvDataBarang.Columns[4].DataPropertyName        = nameof(Barang.Pajak);
                }
            }

            if (listOrder == null)
            {
                this.listOrder = new List <Order>();
            }

            else
            {
                this.dgvDataOrder.Rows.Clear();
                foreach (Order ord in listOrder)
                {
                    this.dgvDataOrder.Rows.Add(new string[] {
                        ord.DataBarang.Kode, ord.DataBarang.Nama, ord.DataBarang.Harga.ToString("c"),
                        ord.JumlahBeli.ToString(), $"{ord.Pajak.ToString()} %", ord.SubTotal.ToString("c")
                    });
                }
            }

            this.lblTotal.Text = temp.ToString("c");
        }
 private void FrmDgvResupply_Load(object sender, EventArgs e)
 {
     try
     {
         using (var dao = new BarangDAO())
         {
             this.dgvData.DataSource = dao.GetAllDataBarang();
             this.dgvData.Columns[0].DataPropertyName = "kode";
             this.dgvData.Columns[1].DataPropertyName = "nama";
             this.dgvData.Columns[2].DataPropertyName = "harga";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #9
0
        private void txtKodeBarang_Leave(object sender, EventArgs e)
        {
            this.dgvDataBarang.DataSource = null;
            using (var dao = new BarangDAO(Setting.GetConnectionString()))
            {
                this.dgvDataBarang.DataSource = dao.GetAllDataBarang(new Barang
                {
                    Nama   = this.txtNamaBarang.Text.Trim(),
                    Kode   = this.txtKodeBarang.Text.Trim(),
                    Gambar = null,
                    Harga  = 0,
                    Jumlah = 0,
                }, int.Parse(this.txtJumlahMin.Text, System.Globalization.NumberStyles.AllowThousands), int.Parse(this.txtJumlahMax.Text, System.Globalization.NumberStyles.AllowThousands), int.Parse(this.txtHargaMin.Text, System.Globalization.NumberStyles.AllowThousands), int.Parse(this.txtHargaMax.Text, System.Globalization.NumberStyles.AllowThousands));
            }

            this.dgvDataBarang.Columns[0].DataPropertyName = nameof(Barang.Kode);
            this.dgvDataBarang.Columns[1].DataPropertyName = nameof(Barang.Nama);
            this.dgvDataBarang.Columns[2].DataPropertyName = nameof(Barang.Jumlah);
            this.dgvDataBarang.Columns[3].DataPropertyName = nameof(Barang.Harga);
        }
Beispiel #10
0
        private void Form1_Load(object sender, EventArgs e)
        {
            listBelanja = new List <Belanja>();
            Form1_Resize(null, null);
            try
            {
                using (var barangdao = new BarangDAO())
                {
                    listBrg = barangdao.GetAllDataBarang();
                }

                dgv1.DataSource = listBrg;
                dgv1.Columns[0].DataPropertyName = "Kode";
                dgv1.Columns[1].DataPropertyName = "Nama";
                dgv1.Columns[2].DataPropertyName = "Harga";
                dgv1.Columns[3].DataPropertyName = "Pajak";
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }