예제 #1
0
        public DataTable coba()
        {
            DataTable dt = new DataTable();

            cmd = new command();
            cmd.openCon();
            dt = cmd.executeQuery(@"SELECT *FROM [dbo].[coba]");
            cmd.closeCon();
            return(dt);
        }
예제 #2
0
        //DATA PRODUK
        public DataTable getProduk()
        {
            DataTable dt = new DataTable();

            cmd = new command();
            cmd.openCon();
            dt = cmd.executeQuery(@"SELECT *FROM [dbo].[tb_barang]");
            cmd.closeCon();
            return(dt);
        }
예제 #3
0
        //Data KATEGORI

        public DataTable getKategori()
        {
            DataTable dt = new DataTable();

            cmd = new command();
            cmd.openCon();
            dt = cmd.executeQuery(@"SELECT *FROM [dbo].[tb_kategori]");
            cmd.closeCon();
            return(dt);
        }
예제 #4
0
        public DataTable getStok(string kode_produk)
        {
            DataTable dt = new DataTable();

            cmd = new command();
            List <SqlParameter> param = new List <SqlParameter>();

            param.Add(new SqlParameter("@kode_produk", kode_produk));
            cmd.openCon();
            dt = cmd.executeQuery(@"SELECT *FROM [dbo].[tb_stok] WHERE [kode_produk]=@kode_produk", param);
            cmd.closeCon();
            return(dt);
        }
예제 #5
0
        public DataTable getKategori(string kode_kategori)
        {
            DataTable dt = new DataTable();

            cmd = new command();
            List <SqlParameter> param = new List <SqlParameter>();

            param.Add(new SqlParameter("@kode_kategori", kode_kategori));
            cmd.openCon();
            dt = cmd.executeQuery(@"SELECT *FROM [dbo].[tb_kategori] WHERE [kode_kategori]=@kode_kategori", param);
            cmd.closeCon();
            return(dt);
        }
예제 #6
0
        //PRODUK PEMBELI
        public DataTable getProdukPembeli(string keterangan)
        {
            DataTable dt = new DataTable();

            cmd = new command();
            try
            {
                cmd.openCon();
                dt = cmd.executeQuery(@"select k.nama_kategori,b.nama_produk,b.gambar,b.harga_jual,b.kode_produk
                                        from tb_barang b inner join tb_kategori k on b.kode_kategori=k.kode_kategori
                                        where b.keterangan='" + keterangan + "'");
                cmd.closeCon();
                return(dt);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #7
0
        public DataTable countCeck(string id_pembeli)
        {
            DataTable dt = new DataTable();

            cmd = new command();
            try
            {
                cmd.openCon();
                dt = cmd.executeQuery(@"select sum (b.harga_jual) as total
                                        from tb_barang b inner join tb_cart c on b.kode_produk=c.kode_produk
                                        where c.id_pembeli='" + id_pembeli + "'");
                cmd.closeCon();
                return(dt);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #8
0
        //C E C K  O U T
        public DataTable ceckOut(string id_pembeli)
        {
            DataTable dt = new DataTable();

            cmd = new command();
            try
            {
                cmd.openCon();
                dt = cmd.executeQuery(@"select p.nama_produk,b.harga_jual
                                        from tb_cart p inner join tb_barang b on p.kode_produk=b.kode_produk
                                        where p.id_pembeli='" + id_pembeli + "'");
                cmd.closeCon();
                return(dt);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #9
0
        public DataTable getProf(string nama, string password)
        {
            DataTable dt = new DataTable();

            cmd = new command();
            try
            {
                cmd.openCon();
                dt = cmd.executeQuery(@"select p.nama,p.alamat,k.kota,p.no_telp
                                        from tb_pembeli p inner join tb_kota k on p.kode_kota=k.kode_kota
                                        where p.nama='" + nama + "' and p.password='******'");
                cmd.closeCon();
                return(dt);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #10
0
        public DataTable getAdmin(string Akses)
        {
            DataTable dt = new DataTable();

            try
            {
                cmd = new command();
                cmd.openCon();
                List <SqlParameter> param = new List <SqlParameter>();
                param.Add(new SqlParameter("@Akses", Akses));
                string query = @"SELECT Akses FROM [dbo].[tb_admin] where [Akses]=@Akses";
                dt = cmd.executeQuery(query, param);
                cmd.closeCon();
                return(dt);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
예제 #11
0
        public DataTable Cartt(string nama, string password)
        {
            DataTable dt = new DataTable();

            try
            {
                cmd = new command();
                cmd.openCon();
                List <SqlParameter> param = new List <SqlParameter>();
                param.Add(new SqlParameter("@nama", nama));
                param.Add(new SqlParameter("@password", password));
                string query = @"select [count_cart] from [dbo].[tb_pembeli] where [nama]=@nama and [password]=@password";
                dt = cmd.executeQuery(query, param);
                cmd.closeCon();
                return(dt);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
예제 #12
0
 public bool inPembayaran(string id_pembeli, int total_pembayaran, string kode_pembayaran, string status_pembayaran)
 {
     try
     {
         cmd = new command();
         List <SqlParameter> param = new List <SqlParameter>();
         param.Add(new SqlParameter("@id_pembeli", id_pembeli));
         param.Add(new SqlParameter("@total_pembayaran", total_pembayaran));
         param.Add(new SqlParameter("@kode_pembayaran", kode_pembayaran));
         param.Add(new SqlParameter("@status_pembayaran", status_pembayaran));
         cmd.openCon();
         cmd.executeQuery(@"INSERT INTO [dbo].[tb_pembayaran]
                             ([id_pembeli],[total_pembayaran],[kode_pembayaran],[status_pembayaran])
                             VALUES
                             (@id_pembeli,@total_pembayaran,@kode_pembayaran,@status_pembayaran)", param);
         cmd.closeCon();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }