// Refresh After Update Biaya protected void BtnFrefresh_Click(object sender, EventArgs e) { this.LBResultFilter.Text = ""; this.PanelGVBiaya.Visible = true; this.PanelBuat.Visible = false; this.PanelEdit.Visible = false; if (DLThnPelaksanaan.SelectedItem.Text == "Tahun") { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Pilih Tahun Pelaksanaan');", true); return; } if (DLProgStudi.SelectedValue == "-1" || DLProgStudi.SelectedValue == "ALL") { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Pilih Program Studi');", true); return; } string CS = ConfigurationManager.ConnectionStrings["MainDb"].ConnectionString; using (SqlConnection con = new SqlConnection(CS)) { //----------------------------------------- GRID VIEW KP ------------------------------------------- con.Open(); SqlCommand cmdKP = new SqlCommand("SELECT id_kp,biaya FROM keu_biaya_kp where tahun=@tahun AND id_prog_study=@id_prodi", con); cmdKP.CommandType = System.Data.CommandType.Text; cmdKP.Parameters.AddWithValue("@tahun", this.DLThnPelaksanaan.SelectedItem.Text); cmdKP.Parameters.AddWithValue("@id_prodi", this.DLProgStudi.SelectedValue); DataTable TableKP = new DataTable(); TableKP.Columns.Add("Biaya"); using (SqlDataReader rdr = cmdKP.ExecuteReader()) { if (rdr.HasRows) { while (rdr.Read()) { DataRow datarow = TableKP.NewRow(); datarow["Biaya"] = rdr["biaya"]; TableKP.Rows.Add(datarow); } //Fill Gridview this.GVKP.DataSource = TableKP; this.GVKP.DataBind(); LBResultFilter.Text = ""; } else { //clear Gridview TableKP.Rows.Clear(); TableKP.Clear(); GVKP.DataSource = TableKP; GVKP.DataBind(); } } // ----------------------------------------- GRID VIEW PPL SD ------------------------------------------- SqlCommand cmdPPLSD = new SqlCommand("SELECT id_pplsd, biaya FROM keu_biaya_pplsd where tahun=@tahun AND id_prog_study=@id_prodi", con); cmdPPLSD.CommandType = System.Data.CommandType.Text; cmdPPLSD.Parameters.AddWithValue("@tahun", this.DLThnPelaksanaan.SelectedItem.Text); cmdPPLSD.Parameters.AddWithValue("@id_prodi", this.DLProgStudi.SelectedValue); DataTable TablePPLSD = new DataTable(); TablePPLSD.Columns.Add("Biaya"); using (SqlDataReader rdr = cmdPPLSD.ExecuteReader()) { if (rdr.HasRows) { while (rdr.Read()) { DataRow datarow = TablePPLSD.NewRow(); datarow["Biaya"] = rdr["biaya"]; TablePPLSD.Rows.Add(datarow); } //Fill Gridview this.GVPPLSD.DataSource = TablePPLSD; this.GVPPLSD.DataBind(); LBResultFilter.Text = ""; } else { //clear Gridview TablePPLSD.Rows.Clear(); TablePPLSD.Clear(); GVPPLSD.DataSource = TablePPLSD; GVPPLSD.DataBind(); } } // ----------------------------------------- GRID VIEW PPL SMA ------------------------------------------- SqlCommand cmdPPLSMA = new SqlCommand("SELECT id_pplsma, biaya FROM keu_biaya_pplsma where tahun=@tahun AND id_prog_study=@id_prodi", con); cmdPPLSMA.CommandType = System.Data.CommandType.Text; cmdPPLSMA.Parameters.AddWithValue("@tahun", this.DLThnPelaksanaan.SelectedItem.Text); cmdPPLSMA.Parameters.AddWithValue("@id_prodi", this.DLProgStudi.SelectedValue); DataTable TablePPLSMA = new DataTable(); TablePPLSMA.Columns.Add("Biaya"); using (SqlDataReader rdr = cmdPPLSMA.ExecuteReader()) { if (rdr.HasRows) { while (rdr.Read()) { DataRow datarow = TablePPLSMA.NewRow(); datarow["Biaya"] = rdr["biaya"]; TablePPLSMA.Rows.Add(datarow); } //Fill Gridview this.GVPPLSMA.DataSource = TablePPLSMA; this.GVPPLSMA.DataBind(); LBResultFilter.Text = ""; } else { //clear Gridview TablePPLSMA.Rows.Clear(); TablePPLSMA.Clear(); GVPPLSMA.DataSource = TablePPLSMA; GVPPLSMA.DataBind(); } } // ----------------------------------------- GRID VIEW KKN ------------------------------------------- SqlCommand cmdKKN = new SqlCommand("SELECT id_kkn, biaya FROM keu_biaya_kkn where tahun=@tahun AND id_prog_study=@id_prodi", con); cmdKKN.CommandType = System.Data.CommandType.Text; cmdKKN.Parameters.AddWithValue("@tahun", this.DLThnPelaksanaan.SelectedItem.Text); cmdKKN.Parameters.AddWithValue("@id_prodi", this.DLProgStudi.SelectedValue); DataTable TableKKN = new DataTable(); TableKKN.Columns.Add("Biaya"); using (SqlDataReader rdr = cmdKKN.ExecuteReader()) { if (rdr.HasRows) { while (rdr.Read()) { DataRow datarow = TableKKN.NewRow(); datarow["Biaya"] = rdr["biaya"]; TableKKN.Rows.Add(datarow); } //Fill Gridview this.GVKKN.DataSource = TableKKN; this.GVKKN.DataBind(); LBResultFilter.Text = ""; } else { //clear Gridview TableKKN.Rows.Clear(); TableKKN.Clear(); GVKKN.DataSource = TableKKN; GVKKN.DataBind(); } } // ----------------------------------------- GRID VIEW WISUDA ------------------------------------------- SqlCommand cmdWisuda = new SqlCommand("SELECT id_wisuda, biaya FROM keu_biaya_wisuda where tahun=@tahun AND id_prog_study=@id_prodi", con); cmdWisuda.CommandType = System.Data.CommandType.Text; cmdWisuda.Parameters.AddWithValue("@tahun", this.DLThnPelaksanaan.SelectedItem.Text); cmdWisuda.Parameters.AddWithValue("@id_prodi", this.DLProgStudi.SelectedValue); DataTable TableWisuda = new DataTable(); TableWisuda.Columns.Add("Biaya"); using (SqlDataReader rdr = cmdWisuda.ExecuteReader()) { if (rdr.HasRows) { while (rdr.Read()) { DataRow datarow = TableWisuda.NewRow(); datarow["Biaya"] = rdr["biaya"]; TableWisuda.Rows.Add(datarow); } //Fill Gridview this.GVWISUDA.DataSource = TableWisuda; this.GVWISUDA.DataBind(); LBResultFilter.Text = ""; } else { //clear Gridview TableWisuda.Rows.Clear(); TableWisuda.Clear(); GVWISUDA.DataSource = TableWisuda; GVWISUDA.DataBind(); } } } }
protected void DLThnPelaksanaan_SelectedIndexChanged(object sender, EventArgs e) { this.LBResultFilter.Text = ""; if (this.DLThnPelaksanaan.SelectedItem.Text == "Tahun") { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Pilih Tahun Pelaksanaan');", true); return; } //---------Fill GRID VIEW BIAYA AKHIR -------------------- string CS = ConfigurationManager.ConnectionStrings["MainDb"].ConnectionString; using (SqlConnection con = new SqlConnection(CS)) { con.Open(); //------------------ Fill GV Biaya KP ---------------- SqlCommand cmdKP = new SqlCommand(" SELECT bak_prog_study.prog_study, keu_biaya_kp.id_kp, keu_biaya_kp.tahun, keu_biaya_kp.biaya " + " FROM bak_prog_study INNER JOIN " + " keu_biaya_kp ON bak_prog_study.id_prog_study = keu_biaya_kp.id_prog_study " + " WHERE (bak_prog_study.prog_study = @prodi) AND (keu_biaya_kp.tahun = @tahun) ", con); cmdKP.CommandType = System.Data.CommandType.Text; cmdKP.Parameters.AddWithValue("@tahun", this.DLThnPelaksanaan.SelectedItem.Text); cmdKP.Parameters.AddWithValue("@prodi", this.LbProdi.Text); DataTable TableKP = new DataTable(); TableKP.Columns.Add("No."); TableKP.Columns.Add("Biaya"); using (SqlDataReader rdr = cmdKP.ExecuteReader()) { if (rdr.HasRows) { //show panel biaya this.PanelBiaya.Enabled = true; this.PanelBiaya.Visible = true; while (rdr.Read()) { DataRow datarow = TableKP.NewRow(); datarow["No."] = rdr["id_kp"]; datarow["Biaya"] = rdr["biaya"]; TableKP.Rows.Add(datarow); } //Fill Gridview this.GVKP.DataSource = TableKP; this.GVKP.DataBind(); LBResultFilter.Text = ""; } else { //clear Gridview TableKP.Rows.Clear(); TableKP.Clear(); GVKP.DataSource = TableKP; GVKP.DataBind(); } } //------------------ Fill GV Biaya PPLSD ---------------- SqlCommand cmdPPLSD = new SqlCommand("SELECT bak_prog_study.prog_study, keu_biaya_pplsd.id_pplsd, keu_biaya_pplsd.biaya, keu_biaya_pplsd.tahun " + " FROM bak_prog_study INNER JOIN " + " keu_biaya_pplsd ON bak_prog_study.id_prog_study = keu_biaya_pplsd.id_prog_study " + " WHERE (bak_prog_study.prog_study = @prodi) AND (keu_biaya_pplsd.tahun = @tahun)", con); cmdPPLSD.CommandType = System.Data.CommandType.Text; cmdPPLSD.Parameters.AddWithValue("@tahun", this.DLThnPelaksanaan.SelectedItem.Text); cmdPPLSD.Parameters.AddWithValue("@prodi", this.LbProdi.Text); DataTable TablePPLSD = new DataTable(); TablePPLSD.Columns.Add("No."); TablePPLSD.Columns.Add("Biaya"); using (SqlDataReader rdr = cmdPPLSD.ExecuteReader()) { if (rdr.HasRows) { //show panel biaya this.PanelBiaya.Enabled = true; this.PanelBiaya.Visible = true; while (rdr.Read()) { DataRow datarow = TablePPLSD.NewRow(); datarow["No."] = rdr["id_pplsd"]; datarow["Biaya"] = rdr["biaya"]; TablePPLSD.Rows.Add(datarow); } //Fill Gridview this.GVPPLSD.DataSource = TablePPLSD; this.GVPPLSD.DataBind(); LBResultFilter.Text = ""; } else { //clear Gridview TablePPLSD.Rows.Clear(); TablePPLSD.Clear(); GVPPLSD.DataSource = TablePPLSD; GVPPLSD.DataBind(); } } //------------------ Fill GV Biaya PPLSMA ---------------- SqlCommand cmdPPLSMA = new SqlCommand(" SELECT bak_prog_study.prog_study, keu_biaya_pplsma.id_pplsma, keu_biaya_pplsma.tahun, keu_biaya_pplsma.biaya " + " FROM bak_prog_study INNER JOIN " + " keu_biaya_pplsma ON bak_prog_study.id_prog_study = keu_biaya_pplsma.id_prog_study " + " WHERE (bak_prog_study.prog_study = @prodi) AND (keu_biaya_pplsma.tahun = @tahun)", con); cmdPPLSMA.CommandType = System.Data.CommandType.Text; cmdPPLSMA.Parameters.AddWithValue("@tahun", this.DLThnPelaksanaan.SelectedItem.Text); cmdPPLSMA.Parameters.AddWithValue("@prodi", this.LbProdi.Text); DataTable TablePPLSMA = new DataTable(); TablePPLSMA.Columns.Add("No."); TablePPLSMA.Columns.Add("Biaya"); using (SqlDataReader rdr = cmdPPLSMA.ExecuteReader()) { if (rdr.HasRows) { while (rdr.Read()) { //show panel biaya this.PanelBiaya.Enabled = true; this.PanelBiaya.Visible = true; DataRow datarow = TablePPLSMA.NewRow(); datarow["No."] = rdr["id_pplsma"]; datarow["Biaya"] = rdr["biaya"]; TablePPLSMA.Rows.Add(datarow); } //Fill Gridview this.GVPPLSMA.DataSource = TablePPLSMA; this.GVPPLSMA.DataBind(); LBResultFilter.Text = ""; } else { //clear Gridview TablePPLSMA.Rows.Clear(); TablePPLSMA.Clear(); GVPPLSMA.DataSource = TablePPLSMA; GVPPLSMA.DataBind(); } } //------------------ Fill GV Biaya KKN ---------------- SqlCommand cmdKKN = new SqlCommand(" SELECT keu_biaya_kkn.id_kkn, keu_biaya_kkn.tahun, keu_biaya_kkn.biaya, bak_prog_study.prog_study " + " FROM keu_biaya_kkn INNER JOIN " + " bak_prog_study ON keu_biaya_kkn.id_prog_study = bak_prog_study.id_prog_study " + " WHERE (keu_biaya_kkn.tahun = @tahun) AND (bak_prog_study.prog_study =@prodi)", con); cmdKKN.CommandType = System.Data.CommandType.Text; cmdKKN.Parameters.AddWithValue("@tahun", this.DLThnPelaksanaan.SelectedItem.Text); cmdKKN.Parameters.AddWithValue("@prodi", this.LbProdi.Text); DataTable TableKKN = new DataTable(); TableKKN.Columns.Add("No."); TableKKN.Columns.Add("Biaya"); using (SqlDataReader rdr = cmdKKN.ExecuteReader()) { if (rdr.HasRows) { //show panel biaya this.PanelBiaya.Enabled = true; this.PanelBiaya.Visible = true; while (rdr.Read()) { DataRow datarow = TableKKN.NewRow(); datarow["No."] = rdr["id_kkn"]; datarow["Biaya"] = rdr["biaya"]; TableKKN.Rows.Add(datarow); } //Fill Gridview this.GVKKN.DataSource = TableKKN; this.GVKKN.DataBind(); LBResultFilter.Text = ""; } else { //clear Gridview TableKKN.Rows.Clear(); TableKKN.Clear(); GVKKN.DataSource = TableKKN; GVKKN.DataBind(); } } //------------------ Fill GV Biaya WISUDA ---------------- SqlCommand cmdWisuda = new SqlCommand("SELECT bak_prog_study.prog_study, keu_biaya_wisuda.id_wisuda, keu_biaya_wisuda.tahun, keu_biaya_wisuda.biaya " + " FROM bak_prog_study INNER JOIN " + " keu_biaya_wisuda ON bak_prog_study.id_prog_study = keu_biaya_wisuda.id_prog_study " + " WHERE (bak_prog_study.prog_study = @prodi) AND (keu_biaya_wisuda.tahun = @tahun)", con); cmdWisuda.CommandType = System.Data.CommandType.Text; cmdWisuda.Parameters.AddWithValue("@tahun", this.DLThnPelaksanaan.SelectedItem.Text); cmdWisuda.Parameters.AddWithValue("@prodi", this.LbProdi.Text); DataTable TableWisuda = new DataTable(); TableWisuda.Columns.Add("No."); TableWisuda.Columns.Add("Biaya"); using (SqlDataReader rdr = cmdWisuda.ExecuteReader()) { if (rdr.HasRows) { while (rdr.Read()) { //show panel biaya this.PanelBiaya.Enabled = true; this.PanelBiaya.Visible = true; DataRow datarow = TableWisuda.NewRow(); datarow["No."] = rdr["id_wisuda"]; datarow["Biaya"] = rdr["biaya"]; TableWisuda.Rows.Add(datarow); } //Fill Gridview this.GVWISUDA.DataSource = TableWisuda; this.GVWISUDA.DataBind(); LBResultFilter.Text = ""; } else { //clear Gridview TableWisuda.Rows.Clear(); TableWisuda.Clear(); GVWISUDA.DataSource = TableWisuda; GVWISUDA.DataBind(); } } } }