public DataTable coba() { DataTable dt = new DataTable(); cmd = new command(); cmd.openCon(); dt = cmd.executeQuery(@"SELECT *FROM [dbo].[coba]"); cmd.closeCon(); return(dt); }
//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); }
//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); }
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); }
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); }
//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; } }
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; } }
//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; } }
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; } }
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); } }
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); } }
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; } }