public List <dataView> GetSemuaTransaksiViewStatusManual(string status) { List <dataView> list = new List <dataView>(); SqlConnection con = new SqlConnection("Data Source=FESAART-DEKSTOP;Initial Catalog=WCF_Projek-Akhir;Persist Security Info=True;User ID=sa;Password=123456"); SqlCommand cmd = new SqlCommand("select * from ViewTransaksi where Status LIKE '%" + status + "%'", con); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { dataView view = new dataView(); view.ID_Transaksi = reader.GetInt32(0); view.Nama_User = reader.GetString(1); view.Nama_Barang = reader.GetString(2); view.Nama_Admin = reader.GetString(3); view.Total_Harga = reader.GetInt32(4); view.Tanggal_Transaksi = reader.GetString(5); view.Alamat = reader.GetString(6); view.No_Telpon = reader.GetString(7); view.Status = reader.GetString(8); list.Add(view); } con.Close(); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(list); }
//Service Buat Ujian Mandiri public List <dataView> GetSemuaTransaksiManual() { try { List <dataView> list = new List <dataView>(); SqlConnection con = new SqlConnection("Data Source=FESAART-DEKSTOP;Initial Catalog=WCF_Projek-Akhir;Persist Security Info=True;User ID=sa;Password=123456"); SqlCommand cmd = new SqlCommand("select * from ViewTransaksi", con); con.Open(); SqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { dataView view = new dataView(); view.ID_Transaksi = reader.GetInt32(0); view.Nama_User = reader.GetString(1); view.Nama_Barang = reader.GetString(2); view.Nama_Admin = reader.GetString(3); view.Total_Harga = reader.GetInt32(4); view.Tanggal_Transaksi = reader.GetString(5); view.Alamat = reader.GetString(6); view.No_Telpon = reader.GetString(7); view.Status = reader.GetString(8); list.Add(view); } con.Close(); } return(list); } catch (Exception ex) { ErrorHandling err = new ErrorHandling(HttpStatusCode.InternalServerError.ToString(), "Owh Terjadi Eror : " + ex.Message); throw new WebFaultException <ErrorHandling>(err, System.Net.HttpStatusCode.InternalServerError); } }