Exemple #1
0
        protected void DLProdiMakul_SelectedIndexChanged(object sender, EventArgs e)
        {
            string CS = ConfigurationManager.ConnectionStrings["MainDb"].ConnectionString;

            using (SqlConnection con = new SqlConnection(CS))
            {
                con.Open();
                SqlCommand CmdMakul = new SqlCommand("SELECT no,kode_makul,makul,kurikulum,sks FROM dbo.bak_makul WHERE makul_univ='yes' AND aktif='yes' AND id_prog_study=@id_prodi", con);
                CmdMakul.CommandType = System.Data.CommandType.Text;

                CmdMakul.Parameters.AddWithValue("@id_prodi", this.DLProdiMakul.SelectedValue);

                DataTable TableMakul = new DataTable();
                TableMakul.Columns.Add("Kode");
                TableMakul.Columns.Add("Mata Kuliah");
                TableMakul.Columns.Add("KURIKULUM");
                TableMakul.Columns.Add("SKS");

                using (SqlDataReader rdr = CmdMakul.ExecuteReader())
                {
                    if (rdr.HasRows)
                    {
                        this.PanelDetailMakul.Enabled = true;
                        this.PanelDetailMakul.Visible = true;

                        while (rdr.Read())
                        {
                            DataRow datarow = TableMakul.NewRow();
                            datarow["Kode"]        = rdr["kode_makul"];
                            datarow["Mata Kuliah"] = rdr["makul"];
                            datarow["KURIKULUM"]   = rdr["kurikulum"];
                            datarow["SKS"]         = rdr["sks"];

                            TableMakul.Rows.Add(datarow);
                        }

                        //Fill Gridview
                        this.GVMakul.DataSource = TableMakul;
                        this.GVMakul.DataBind();
                    }
                    else
                    {
                        //clear Gridview
                        TableMakul.Rows.Clear();
                        TableMakul.Clear();
                        GVMakul.DataSource = TableMakul;
                        GVMakul.DataBind();

                        this.PanelDetailMakul.Enabled = false;
                        this.PanelDetailMakul.Visible = false;
                    }
                }
            }
        }
Exemple #2
0
        protected void DLProdi_SelectedIndexChanged(object sender, EventArgs e)
        {
            //form validation
            if (this.DLTahun.SelectedValue == "Tahun")
            {
                this.DLProdi.SelectedIndex = 0;

                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Pilih Tahun Akademik');", true);
                return;
            }
            if (this.DLSemester.SelectedValue == "Semester")
            {
                this.DLProdi.SelectedIndex = 0;

                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Pilih Semester');", true);
                return;
            }

            this.PanelPeserta.Enabled = false;
            this.PanelPeserta.Visible = false;

            string CS = ConfigurationManager.ConnectionStrings["MainDb"].ConnectionString;

            using (SqlConnection con = new SqlConnection(CS))
            {
                con.Open();
                SqlCommand CmdMakul = new SqlCommand("SpListJadwal3", con);
                CmdMakul.CommandType = System.Data.CommandType.StoredProcedure;

                CmdMakul.Parameters.AddWithValue("@id_prodi", this.DLProdi.SelectedValue);
                CmdMakul.Parameters.AddWithValue("@semester", this.DLTahun.SelectedItem.Text + this.DLSemester.SelectedItem.Text);

                DataTable TableMakul = new DataTable();
                TableMakul.Columns.Add("Kode");
                TableMakul.Columns.Add("Mata Kuliah");
                TableMakul.Columns.Add("SKS");
                TableMakul.Columns.Add("NIDN");
                TableMakul.Columns.Add("Dosen");
                TableMakul.Columns.Add("Kelas");
                TableMakul.Columns.Add("Hari");
                TableMakul.Columns.Add("Mulai");
                TableMakul.Columns.Add("Selesai");
                TableMakul.Columns.Add("Ruang");
                TableMakul.Columns.Add("Jenis Kelas");

                using (SqlDataReader rdr = CmdMakul.ExecuteReader())
                {
                    if (rdr.HasRows)
                    {
                        this.PanelMakul.Enabled = true;
                        this.PanelMakul.Visible = true;

                        while (rdr.Read())
                        {
                            DataRow datarow = TableMakul.NewRow();
                            datarow["Kode"]        = rdr["kode_makul"];
                            datarow["Mata Kuliah"] = rdr["makul"];
                            datarow["SKS"]         = rdr["sks"];
                            datarow["NIDN"]        = rdr["nidn"];
                            datarow["Dosen"]       = rdr["nama"];
                            datarow["Kelas"]       = rdr["kelas"];
                            datarow["Hari"]        = rdr["hari"];
                            datarow["Mulai"]       = rdr["jm_awal_kuliah"];
                            datarow["Selesai"]     = rdr["jm_akhir_kuliah"];
                            datarow["Ruang"]       = rdr["nm_ruang"];
                            datarow["Jenis Kelas"] = rdr["jenis_kelas"];

                            TableMakul.Rows.Add(datarow);
                        }

                        //Fill Gridview
                        this.GVMakul.DataSource = TableMakul;
                        this.GVMakul.DataBind();
                    }
                    else
                    {
                        //clear Gridview
                        TableMakul.Rows.Clear();
                        TableMakul.Clear();
                        GVMakul.DataSource = TableMakul;
                        GVMakul.DataBind();

                        this.PanelMakul.Enabled = false;
                        this.PanelMakul.Visible = false;
                    }
                }

                this.LbDosen.Text   = "";
                this.LbIdProdi.Text = "";
                this.LbKdMakul.Text = "";
                this.LbKelas.Text   = "";
                this.LbMakul.Text   = "";
                this.LbNIDN.Text    = "";
                this.LBSKS.Text     = "";
            }
        }
Exemple #3
0
        protected void DLSemester_SelectedIndexChanged(object sender, EventArgs e)
        {
            //form validation
            if (this.DLTahun.SelectedValue == "Tahun")
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Pilih Tahun Akademik');", true);
                return;
            }
            if (this.DLSemester.SelectedValue == "Semester")
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Pilih Semester');", true);
                return;
            }

            string CS = ConfigurationManager.ConnectionStrings["MainDb"].ConnectionString;

            using (SqlConnection con = new SqlConnection(CS))
            {
                con.Open();
                SqlCommand CmdMakul = new SqlCommand(@"
	            SELECT     bak_jadwal.no_jadwal, bak_jadwal.id_prog_study, bak_makul.kode_makul, bak_makul.makul, bak_makul.sks, bak_jadwal.quota, bak_dosen.nama, bak_jadwal.kelas, bak_jadwal.hari, 
						              bak_jadwal.jenis_kelas, bak_dosen.nidn, bak_jadwal.jm_awal_kuliah, bak_jadwal.jm_akhir_kuliah, bak_ruang.nm_ruang
	            FROM         bak_jadwal INNER JOIN
						              bak_dosen ON bak_jadwal.nidn = bak_dosen.nidn INNER JOIN
						              bak_makul ON bak_jadwal.kode_makul = bak_makul.kode_makul INNER JOIN
						              bak_prog_study ON bak_jadwal.id_prog_study = bak_prog_study.id_prog_study INNER JOIN
						              bak_ruang ON bak_jadwal.id_rng_kuliah = bak_ruang.no
	            WHERE     (bak_jadwal.id_prog_study = @id_prodi) AND (bak_jadwal.semester = @semester) 
	            ORDER BY bak_jadwal.no_jadwal "    , con);

                CmdMakul.CommandType = System.Data.CommandType.Text;

                CmdMakul.Parameters.AddWithValue("@id_prodi", this.Session["level"].ToString());
                CmdMakul.Parameters.AddWithValue("@semester", this.DLTahun.SelectedItem.Text + this.DLSemester.SelectedItem.Text);

                DataTable TableMakul = new DataTable();
                TableMakul.Columns.Add("Kode");
                TableMakul.Columns.Add("Mata Kuliah");
                TableMakul.Columns.Add("SKS");
                TableMakul.Columns.Add("NIDN");
                TableMakul.Columns.Add("Dosen");
                TableMakul.Columns.Add("Kelas");
                TableMakul.Columns.Add("Hari");
                TableMakul.Columns.Add("Mulai");
                TableMakul.Columns.Add("Selesai");
                TableMakul.Columns.Add("Ruang");
                TableMakul.Columns.Add("Jenis Kelas");

                using (SqlDataReader rdr = CmdMakul.ExecuteReader())
                {
                    if (rdr.HasRows)
                    {
                        this.PanelMakul.Enabled = true;
                        this.PanelMakul.Visible = true;

                        this.PanelPeserta.Enabled = false;
                        this.PanelPeserta.Visible = false;

                        while (rdr.Read())
                        {
                            DataRow datarow = TableMakul.NewRow();
                            datarow["Kode"]        = rdr["kode_makul"];
                            datarow["Mata Kuliah"] = rdr["makul"];
                            datarow["SKS"]         = rdr["sks"];
                            datarow["NIDN"]        = rdr["nidn"];
                            datarow["Dosen"]       = rdr["nama"];
                            datarow["Kelas"]       = rdr["kelas"];
                            datarow["Hari"]        = rdr["hari"];
                            datarow["Mulai"]       = rdr["jm_awal_kuliah"];
                            datarow["Selesai"]     = rdr["jm_akhir_kuliah"];
                            datarow["Ruang"]       = rdr["nm_ruang"];
                            datarow["Jenis Kelas"] = rdr["jenis_kelas"];

                            TableMakul.Rows.Add(datarow);
                        }

                        //Fill Gridview
                        this.GVMakul.DataSource = TableMakul;
                        this.GVMakul.DataBind();
                    }
                    else
                    {
                        //clear Gridview
                        TableMakul.Rows.Clear();
                        TableMakul.Clear();
                        GVMakul.DataSource = TableMakul;
                        GVMakul.DataBind();

                        this.PanelMakul.Enabled = false;
                        this.PanelMakul.Visible = false;

                        this.PanelPeserta.Enabled = false;
                        this.PanelPeserta.Visible = false;

                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Jawal Belum Ada');", true);
                        return;
                    }
                }
            }
        }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    //1. ----- set keterangan mahasiswa from last page
                    // ------- Read Mahasiswa ----------
                    //Server.UrlDecode(Request.QueryString["PID"]);
                    mhs.ReadMahasiswa(Convert.ToString(Request.QueryString["nim"]));

                    LbMhsName.Text    = mhs.nama.ToString();
                    LbNama.Text       = mhs.nama.ToString();
                    LbJenisKelas.Text = mhs.kelas.ToString();
                    LbProdi.Text      = mhs.Prodi.ToString();
                    LbNpm.Text        = mhs.npm.ToString();
                    LbSemester.Text   = Server.UrlDecode(Request.QueryString["semester"]); //Convert.ToString(Request.QueryString["semester"])

                    //------ Semester ------//
                    string smstr = Server.UrlDecode(Request.QueryString["semester"]);
                    LbTahun.Text    = smstr.Substring(0, 4);
                    LbSemester.Text = smstr.Substring(4, 1);


                    //2. ---------- Gridview SKS ------------------
                    string CS = ConfigurationManager.ConnectionStrings["MainDb"].ConnectionString;
                    using (SqlConnection con = new SqlConnection(CS))
                    {
                        con.Open();
                        // --------------------- Fill Gridview  ------------------------
                        SqlCommand CmdListKRS = new SqlCommand("SpListKrsMhs2", con);
                        CmdListKRS.CommandType = System.Data.CommandType.StoredProcedure;

                        CmdListKRS.Parameters.AddWithValue("@npm", LbNpm.Text);
                        CmdListKRS.Parameters.AddWithValue("@semester", Server.UrlDecode(Request.QueryString["semester"]));

                        DataTable TableKRS = new DataTable();
                        TableKRS.Columns.Add("Kode");
                        TableKRS.Columns.Add("Mata Kuliah");
                        TableKRS.Columns.Add("SKS");
                        TableKRS.Columns.Add("Dosen");
                        TableKRS.Columns.Add("Kelas");
                        TableKRS.Columns.Add("Hari");
                        TableKRS.Columns.Add("Mulai");
                        TableKRS.Columns.Add("Selesai");
                        TableKRS.Columns.Add("Ruang");

                        using (SqlDataReader rdr = CmdListKRS.ExecuteReader())
                        {
                            if (rdr.HasRows)
                            {
                                while (rdr.Read())
                                {
                                    DataRow datarow = TableKRS.NewRow();
                                    datarow["Kode"]        = rdr["kode_makul"];
                                    datarow["Mata Kuliah"] = rdr["makul"];
                                    datarow["SKS"]         = rdr["sks"];
                                    datarow["Dosen"]       = rdr["nama"];
                                    datarow["Kelas"]       = rdr["kelas"];
                                    datarow["Hari"]        = rdr["hari"];
                                    datarow["Mulai"]       = rdr["jm_awal_kuliah"];
                                    datarow["Selesai"]     = rdr["jm_akhir_kuliah"];
                                    datarow["Ruang"]       = rdr["nm_ruang"];

                                    TableKRS.Rows.Add(datarow);
                                }

                                //Fill Gridview
                                this.GVMakul.DataSource = TableKRS;
                                this.GVMakul.DataBind();
                            }
                            else
                            {
                                //clear Gridview
                                TableKRS.Rows.Clear();
                                TableKRS.Clear();
                                GVMakul.DataSource = TableKRS;
                                GVMakul.DataBind();
                            }
                        }
                    }

                    //Page.ClientScript.RegisterStartupScript(this.GetType(), "Print", "javascript:window.print();", true);
                }
                catch (Exception ex)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('" + ex.Message.ToString() + "');", true);
                    return;
                }
            }
        }
Exemple #5
0
        protected void Load_Makul()
        {
            try
            {
                string CS = ConfigurationManager.ConnectionStrings["MainDb"].ConnectionString;
                using (SqlConnection con = new SqlConnection(CS))
                {
                    con.Open();
                    SqlCommand CmdMakul = new SqlCommand("SpGetMakulByProdi", con);
                    CmdMakul.CommandType = System.Data.CommandType.StoredProcedure;

                    CmdMakul.Parameters.AddWithValue("@idprodi", this.Session["level"].ToString());

                    DataTable TableMakul = new DataTable();
                    //TableMakul.Columns.Add("No");
                    TableMakul.Columns.Add("Kode");
                    TableMakul.Columns.Add("Mata Kuliah");
                    //TableMakul.Columns.Add("SKS Tatap Muka");
                    //TableMakul.Columns.Add("SKS Praktikum");
                    //TableMakul.Columns.Add("SKS Praktikum Lap");
                    TableMakul.Columns.Add("Total SKS");
                    TableMakul.Columns.Add("Semester");
                    TableMakul.Columns.Add("KURIKULUM");
                    //TableMakul.Columns.Add("Jenis");

                    using (SqlDataReader rdr = CmdMakul.ExecuteReader())
                    {
                        if (rdr.HasRows)
                        {
                            while (rdr.Read())
                            {
                                DataRow datarow = TableMakul.NewRow();
                                // datarow["No"] = rdr["nomor"].ToString();
                                datarow["Kode"]        = rdr["kode_makul"].ToString();
                                datarow["Mata Kuliah"] = rdr["makul"].ToString();

                                //if (rdr["tmuka"] != DBNull.Value)
                                //{
                                //    datarow["SKS Tatap Muka"] = rdr["tmuka"].ToString();
                                //}

                                //if (rdr["prak"] != DBNull.Value)
                                //{
                                //    datarow["SKS Praktikum"] = rdr["prak"].ToString();
                                //}

                                //if (rdr["lap"] != DBNull.Value)
                                //{
                                //    datarow["SKS Praktikum Lap"] = rdr["lap"].ToString();
                                //}

                                datarow["Total SKS"] = rdr["sks"].ToString();

                                //if (rdr["jenis"] != DBNull.Value)
                                //{
                                //    //datarow["Jenis"] = rdr["jenis"].ToString();
                                //    if (rdr["jenis"].ToString() == "A")
                                //    {
                                //        datarow["Jenis"] = "Wajib";
                                //    }
                                //    else if (rdr["jenis"].ToString() == "B")
                                //    {
                                //        datarow["Jenis"] = "Pilihan";
                                //    }
                                //    else if (rdr["jenis"].ToString() == "S")
                                //    {
                                //        datarow["Jenis"] = "TA/Skripsi/Tesis/Disertasi";
                                //    }
                                //}

                                datarow["Semester"]  = rdr["semester"].ToString();
                                datarow["KURIKULUM"] = rdr["kurikulum"].ToString();

                                TableMakul.Rows.Add(datarow);
                            }

                            //Fill Gridview
                            this.GVMakul.DataSource = TableMakul;
                            this.GVMakul.DataBind();
                        }
                        else
                        {
                            //clear Gridview
                            TableMakul.Rows.Clear();
                            TableMakul.Clear();
                            GVMakul.DataSource = TableMakul;
                            GVMakul.DataBind();

                            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Data Mata Kuliah Tidak Ditemukan');", true);
                            return;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('" + ex.Message.ToString() + "');", true);
            }
        }
Exemple #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Page lastpage = (Page)Context.Handler;
                if (lastpage is WebForm11)
                {
                    try
                    {
                        //1. ----- set keterangan mahasiswa from last page
                        this.LbMhsName.Text    = ((WebForm11)lastpage).Name;
                        this.LbNpm.Text        = ((WebForm11)lastpage).NPM;
                        this.LbJenisKelas.Text = ((WebForm11)lastpage).JenisKelas;
                        this.LbTahun.Text      = ((WebForm11)lastpage).Tahun;
                        this.LbSemester.Text   = ((WebForm11)lastpage).Semester;
                        this.LbProdi.Text      = ((WebForm11)lastpage).Prodi;
                        this.LbNama.Text       = ((WebForm11)lastpage).Name;

                        //2. ---------- Gridview SKS ------------------
                        string CS = ConfigurationManager.ConnectionStrings["MainDb"].ConnectionString;
                        using (SqlConnection con = new SqlConnection(CS))
                        {
                            con.Open();
                            // --------------------- Fill Gridview  ------------------------
                            SqlCommand CmdListKRS = new SqlCommand("SpListKrsMhs2", con);
                            CmdListKRS.CommandType = System.Data.CommandType.StoredProcedure;


                            CmdListKRS.Parameters.AddWithValue("@npm", ((WebForm11)lastpage).NPM);
                            CmdListKRS.Parameters.AddWithValue("@semester", ((WebForm11)lastpage).Tahun + ((WebForm11)lastpage).Semester);

                            DataTable TableKRS = new DataTable();
                            TableKRS.Columns.Add("Kode");
                            TableKRS.Columns.Add("Mata Kuliah");
                            TableKRS.Columns.Add("SKS");
                            TableKRS.Columns.Add("Dosen");
                            TableKRS.Columns.Add("Kelas");
                            TableKRS.Columns.Add("Hari");
                            TableKRS.Columns.Add("Mulai");
                            TableKRS.Columns.Add("Selesai");
                            TableKRS.Columns.Add("Ruang");

                            using (SqlDataReader rdr = CmdListKRS.ExecuteReader())
                            {
                                if (rdr.HasRows)
                                {
                                    while (rdr.Read())
                                    {
                                        DataRow datarow = TableKRS.NewRow();
                                        datarow["Kode"]        = rdr["kode_makul"];
                                        datarow["Mata Kuliah"] = rdr["makul"];
                                        datarow["SKS"]         = rdr["sks"];
                                        datarow["Dosen"]       = rdr["nama"];
                                        datarow["Kelas"]       = rdr["kelas"];
                                        datarow["Hari"]        = rdr["hari"];
                                        datarow["Mulai"]       = rdr["jm_awal_kuliah"];
                                        datarow["Selesai"]     = rdr["jm_akhir_kuliah"];
                                        datarow["Ruang"]       = rdr["nm_ruang"];

                                        TableKRS.Rows.Add(datarow);
                                    }

                                    //Fill Gridview
                                    this.GVMakul.DataSource = TableKRS;
                                    this.GVMakul.DataBind();
                                }
                                else
                                {
                                    //clear Gridview
                                    TableKRS.Rows.Clear();
                                    TableKRS.Clear();
                                    GVMakul.DataSource = TableKRS;
                                    GVMakul.DataBind();
                                }
                            }
                        }

                        Page.ClientScript.RegisterStartupScript(this.GetType(), "Print", "javascript:window.print();", true);
                    }
                    catch (Exception ex)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('" + ex.Message.ToString() + "');", true);
                        return;
                    }
                }
            }
        }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Page lastpage = (Page)Context.Handler;
                if (lastpage is akademik.am.WebForm11)
                {
                    try
                    {
                        //1. ----- set keterangan mahasiswa from last page
                        this.LbNpm.Text        = ((akademik.am.WebForm11)lastpage).NPM;
                        this.LbJenisKelas.Text = ((akademik.am.WebForm11)lastpage).JenisKelas;
                        this.LbTahun.Text      = ((akademik.am.WebForm11)lastpage).Tahun;
                        this.LbSemester.Text   = ((akademik.am.WebForm11)lastpage).Semester;
                        this.LbProdi.Text      = ((akademik.am.WebForm11)lastpage).Prodi;
                        this.LbNama.Text       = ((akademik.am.WebForm11)lastpage).Name;
                        this.id_prodi          = ((akademik.am.WebForm11)lastpage).Id_Prodi;

                        //2. ---------- Gridview SKS ------------------
                        string CS = ConfigurationManager.ConnectionStrings["MainDb"].ConnectionString;
                        using (SqlConnection con = new SqlConnection(CS))
                        {
                            con.Open();
                            // --------------------- Fill Gridview  ------------------------
                            SqlCommand CmdListKRS = new SqlCommand("SpGetKHS", con);
                            CmdListKRS.CommandType = System.Data.CommandType.StoredProcedure;


                            CmdListKRS.Parameters.AddWithValue("@npm", ((akademik.am.WebForm11)lastpage).NPM);
                            CmdListKRS.Parameters.AddWithValue("@semester", ((akademik.am.WebForm11)lastpage).Tahun + ((akademik.am.WebForm11)lastpage).Semester);

                            DataTable TableKRS = new DataTable();
                            TableKRS.Columns.Add("Kode");
                            TableKRS.Columns.Add("Mata Kuliah");
                            TableKRS.Columns.Add("SKS");
                            TableKRS.Columns.Add("Nilai");
                            TableKRS.Columns.Add("Jumlah");

                            using (SqlDataReader rdr = CmdListKRS.ExecuteReader())
                            {
                                if (rdr.HasRows)
                                {
                                    while (rdr.Read())
                                    {
                                        DataRow datarow = TableKRS.NewRow();
                                        datarow["Kode"]        = rdr["kode_makul"];
                                        datarow["Mata Kuliah"] = rdr["makul"];
                                        datarow["SKS"]         = rdr["sks"];

                                        if (rdr["Nilai"] == DBNull.Value)
                                        {
                                            //datarow["Nilai"] = "";
                                        }
                                        else
                                        {
                                            datarow["Nilai"] = rdr["nilai"];
                                        }
                                        datarow["Jumlah"] = rdr["jumlah"];

                                        TableKRS.Rows.Add(datarow);
                                    }

                                    //Fill Gridview
                                    this.GVMakul.DataSource = TableKRS;
                                    this.GVMakul.DataBind();

                                    //Set Label
                                    this.LBSks.Text = _TotalSKS.ToString();
                                    decimal IPS = _TotalNilai / _TotalSKS;
                                    this.LbIPS.Text = String.Format("{0:0.##}", IPS);
                                }
                                else
                                {
                                    //clear Gridview
                                    TableKRS.Rows.Clear();
                                    TableKRS.Clear();
                                    GVMakul.DataSource = TableKRS;
                                    GVMakul.DataBind();
                                }
                            }
                        }

                        Page.ClientScript.RegisterStartupScript(this.GetType(), "Print", "javascript:window.print();", true);
                    }
                    catch (Exception ex)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('" + ex.Message.ToString() + "');", true);
                        return;
                    }
                }
            }
        }
Exemple #8
0
        protected void BtnCari_Click(object sender, EventArgs e)
        {
            //------ 1. form validation ----- //
            if (this.TBNpm.Text == "")
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Isi NPM');", true);
                return;
            }
            if (this.DLTahun.SelectedItem.Text == "Tahun" || this.DLTahun.SelectedItem.Text == "")
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Pilih Tahun');", true);
                return;
            }
            if (this.DLSemester.SelectedItem.Text == "Semester")
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Pilih Semester');", true);
                return;
            }

            // ------- 2. Read Mahasiswa ---------- //
            try
            {
                mhs.ReadMahasiswa(this.TBNpm.Text);

                LbNama.Text     = mhs.nama.ToString();
                LbKelas.Text    = mhs.kelas.ToString();
                LbProdi.Text    = mhs.Prodi.ToString();
                LbNpm.Text      = mhs.npm.ToString();
                _NPM            = mhs.npm.ToString();
                LbIdProdi.Text  = mhs.id_prodi.ToString();
                LbAngkatan.Text = mhs.thn_angkatan.ToString();
            }
            catch (Exception)
            {
                LbNama.Text  = "Nama";
                LbKelas.Text = "Jenis Kelas";
                LbProdi.Text = "Program Studi";
                LbNpm.Text   = "NPM";

                this.PanelMataKuliah.Visible = false;

                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Mahasiswa Tidak Ditemukan');", true);
                return;
            }

            // ---------- Cek Tahun ------------ //
            _NPM      = TBNpm.Text;
            _Semester = this.DLSemester.SelectedValue;
            _Tahun    = DLTahun.SelectedValue;

            if (_Tahun != "2014/2015")
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Hanya Untuk Tahun Akademik 2014/2015');", true);
                return;
            }
            if (LbAngkatan.Text != "2014/2015")
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Input Hanya Untuk Mahasiswa Tahun Angkatan 2014/2015');", true);
                return;
            }

            // ----------- 3. Display Mata Kuliah -------------//
            string CS = ConfigurationManager.ConnectionStrings["MainDb"].ConnectionString;

            using (SqlConnection con = new SqlConnection(CS))
            {
                con.Open();
                SqlCommand CmdMakul = new SqlCommand("SpGetMakul", con);
                CmdMakul.CommandType = System.Data.CommandType.StoredProcedure;

                CmdMakul.Parameters.AddWithValue("@id_prodi", this.LbIdProdi.Text);

                DataTable TableMakul = new DataTable();
                TableMakul.Columns.Add("Kode");
                TableMakul.Columns.Add("Mata Kuliah");
                TableMakul.Columns.Add("SKS");

                using (SqlDataReader rdr = CmdMakul.ExecuteReader())
                {
                    if (rdr.HasRows)
                    {
                        this.PanelMataKuliah.Enabled = true;
                        this.PanelMataKuliah.Visible = true;

                        while (rdr.Read())
                        {
                            DataRow datarow = TableMakul.NewRow();
                            datarow["Kode"]        = rdr["kode_makul"];
                            datarow["Mata Kuliah"] = rdr["makul"];
                            datarow["SKS"]         = rdr["sks"];

                            TableMakul.Rows.Add(datarow);
                        }

                        //Fill Gridview
                        this.GVMakul.DataSource = TableMakul;
                        this.GVMakul.DataBind();
                    }
                    else
                    {
                        //clear Gridview
                        TableMakul.Rows.Clear();
                        TableMakul.Clear();
                        GVMakul.DataSource = TableMakul;
                        GVMakul.DataBind();

                        this.PanelMataKuliah.Enabled = false;
                        this.PanelMataKuliah.Visible = false;
                    }
                }


                // ----------------- 4. Loop Nilai ------------------
                //-- loop Nilai yg sudah diambil berdasarkan npm, makul, semester
                for (int i = 0; i < this.GVMakul.Rows.Count; i++)
                {
                    SqlCommand CmdChecked = new SqlCommand("SpGetNilai", con);
                    CmdChecked.CommandType = System.Data.CommandType.StoredProcedure;

                    CmdChecked.Parameters.AddWithValue("@npm", LbNpm.Text);
                    CmdChecked.Parameters.AddWithValue("@kode_makul", this.GVMakul.Rows[i].Cells[0].Text);
                    CmdChecked.Parameters.AddWithValue("@semester", this.DLTahun.SelectedItem.Text + this.DLSemester.SelectedItem.Text);

                    using (SqlDataReader rdrchecked = CmdChecked.ExecuteReader())
                    {
                        if (rdrchecked.HasRows)
                        {
                            while (rdrchecked.Read())
                            {
                                DropDownList DLNilai = (DropDownList)this.GVMakul.Rows[i].FindControl("DLNilai");

                                if (rdrchecked["nilai"] == DBNull.Value)
                                {
                                    DLNilai.SelectedItem.Text = "Nilai";
                                }
                                else
                                {
                                    DLNilai.SelectedItem.Text = rdrchecked["nilai"].ToString();
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //Page lastpage = (Page)Context.Handler;
                //if (lastpage is Padu.account.WebForm5)
                //{
                try
                {
                    ////1. ----- set keterangan mahasiswa from last page
                    //this.LbNpm.Text = ((Padu.account.WebForm5)lastpage).NPM;
                    //this.LbJenisKelas.Text = ((Padu.account.WebForm5)lastpage).JenisKelas;
                    //this.LbTahun.Text = ((Padu.account.WebForm5)lastpage).Tahun;
                    //this.LbSemester.Text = ((Padu.account.WebForm5)lastpage).Semester;
                    //this.LbProdi.Text = ((Padu.account.WebForm5)lastpage).Prodi;
                    //this.LbNama.Text = ((Padu.account.WebForm5)lastpage).Name;
                    ////this.LbProdi.Text = ((Padu.account.WebForm5)lastpage).Id_Prodi;

                    //2. ---------- Gridview SKS ------------------
                    string CS = ConfigurationManager.ConnectionStrings["MainDb"].ConnectionString;
                    using (SqlConnection con = new SqlConnection(CS))
                    {
                        con.Open();

                        //Read Data Mahasiswa
                        SqlCommand CmdDtMhs = new SqlCommand("SELECT bak_mahasiswa.npm, bak_mahasiswa.nama, bak_mahasiswa.id_prog_study,bak_prog_study.prog_study, bak_mahasiswa.thn_angkatan,bak_mahasiswa.kelas " +
                                                             "FROM bak_mahasiswa INNER JOIN " +
                                                             "bak_prog_study ON bak_mahasiswa.id_prog_study = bak_prog_study.id_prog_study " +
                                                             "WHERE (bak_mahasiswa.npm=@npm)", con);
                        CmdDtMhs.CommandType = System.Data.CommandType.Text;

                        CmdDtMhs.Parameters.AddWithValue("@npm", Decrypt(HttpUtility.UrlDecode(Request.QueryString["Npm"])));

                        using (SqlDataReader reader = CmdDtMhs.ExecuteReader())
                        {
                            if (reader.HasRows)
                            {
                                while (reader.Read())
                                {
                                    this.LbNpm.Text        = reader["npm"].ToString();
                                    this.LbJenisKelas.Text = reader["kelas"].ToString();
                                    this.LbTahun.Text      = Decrypt(HttpUtility.UrlDecode(Request.QueryString["Tahun"]));
                                    this.LbSemester.Text   = Decrypt(HttpUtility.UrlDecode(Request.QueryString["Semester"]));
                                    this.LbProdi.Text      = reader["prog_study"].ToString();
                                    this.LbNama.Text       = reader["nama"].ToString();
                                }
                            }
                        }


                        // --------------------- Fill Gridview  ------------------------
                        SqlCommand CmdListKRS = new SqlCommand("SpGetKHS", con);
                        CmdListKRS.CommandType = System.Data.CommandType.StoredProcedure;

                        CmdListKRS.Parameters.AddWithValue("@npm", Decrypt(HttpUtility.UrlDecode(Request.QueryString["Npm"])));
                        CmdListKRS.Parameters.AddWithValue("@semester", Decrypt(HttpUtility.UrlDecode(Request.QueryString["Semester"])));

                        DataTable TableKRS = new DataTable();
                        TableKRS.Columns.Add("Kode");
                        TableKRS.Columns.Add("Mata Kuliah");
                        TableKRS.Columns.Add("SKS");
                        TableKRS.Columns.Add("Nilai");
                        TableKRS.Columns.Add("Jumlah");

                        using (SqlDataReader rdr = CmdListKRS.ExecuteReader())
                        {
                            if (rdr.HasRows)
                            {
                                while (rdr.Read())
                                {
                                    DataRow datarow = TableKRS.NewRow();
                                    datarow["Kode"]        = rdr["kode_makul"];
                                    datarow["Mata Kuliah"] = rdr["makul"];
                                    datarow["SKS"]         = rdr["sks"];

                                    if (rdr["Nilai"] == DBNull.Value)
                                    {
                                        //datarow["Nilai"] = "";
                                    }
                                    else
                                    {
                                        datarow["Nilai"] = rdr["nilai"];
                                    }
                                    datarow["Jumlah"] = rdr["jumlah"];

                                    TableKRS.Rows.Add(datarow);
                                }

                                //Fill Gridview
                                this.GVMakul.DataSource = TableKRS;
                                this.GVMakul.DataBind();

                                //Set Label
                                this.LBSks.Text = _TotalSKS.ToString();
                                decimal IPS = _TotalNilai / _TotalSKS;
                                this.LbIPS.Text = String.Format("{0:0.##}", IPS);
                            }
                            else
                            {
                                //clear Gridview
                                TableKRS.Rows.Clear();
                                TableKRS.Clear();
                                GVMakul.DataSource = TableKRS;
                                GVMakul.DataBind();
                            }
                        }
                    }

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "Print", "javascript:window.print();", true);
                }
                catch (Exception ex)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('" + ex.Message.ToString() + "');", true);
                    return;
                }
                //}
            }
        }