Example #1
0
        protected void TBNpm_TextChanged(object sender, EventArgs e)
        {
            // ------- Read Mahasiswa ----------
            try
            {
                mhs.ReadMahasiswa(this.TBNpm.Text);

                LbNama.Text        = mhs.nama.ToString();
                LbClass.Text       = mhs.kelas.ToString();
                LbProdi.Text       = mhs.Prodi.ToString();
                LbThnAngkatan.Text = mhs.thn_angkatan.ToString();
                LbNPM.Text         = mhs.npm.ToString();
                LbIdProdi.Text     = mhs.id_prodi.ToString();
            }
            catch (Exception)
            {
                LbNama.Text        = "Nama";
                LbClass.Text       = "Jenis Kelas";
                LbProdi.Text       = "Program Studi";
                LbThnAngkatan.Text = "Tahun Angkatan";
                LbNPM.Text         = "NPM";

                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Mahasiswa tidak ditemukan');", true);
                return;
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    // ------- Read Mahasiswa ----------
                    mhs.ReadMahasiswa(Request.QueryString["nim"]);

                    LbNama.Text       = mhs.nama.ToString();
                    LbJenisKelas.Text = mhs.kelas.ToString();
                    LbProdi.Text      = mhs.Prodi.ToString();
                    LbNpm.Text        = mhs.npm.ToString();
                    LbMhsName.Text    = mhs.nama.ToString();

                    //------ Semester ------//
                    string smstr = Request.QueryString["semester"].ToString();
                    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", Request.QueryString["nim"]);
                        CmdListKRS.Parameters.AddWithValue("@semester", 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)
                {
                    LbNama.Text       = "Nama";
                    LbJenisKelas.Text = "Jenis Kelas";
                    LbProdi.Text      = "Program Studi";
                    LbTahun.Text      = "Tahun Angkatan";
                    LbNpm.Text        = "NPM";

                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('" + ex.Message.ToString() + "');", true);
                    return;
                }
            }
        }
Example #3
0
        protected void BtnFilterMhs_Click(object sender, EventArgs e)
        {
            // Set Null Total Bobot dan SKS
            _TotalBobot = 0;
            _TotalSKS   = 0;

            //form validation
            if (this.TBNpm.Text == "")
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Isi NPM Atau Sebagian Nama Mahasiswa');", true);
                return;
            }

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

                LbNama.Text        = mhs.nama.ToString();
                LbClass.Text       = mhs.kelas.ToString();
                LbProdi.Text       = mhs.Prodi.ToString();
                LbThnAngkatan.Text = mhs.thn_angkatan.ToString();
                LbNPM.Text         = mhs.npm.ToString();
                LbIdProdi.Text     = mhs.id_prodi.ToString();
            }
            catch (Exception)
            {
                LbNama.Text        = "Nama";
                LbClass.Text       = "Jenis Kelas";
                LbProdi.Text       = "Program Studi";
                LbThnAngkatan.Text = "Tahun Angkatan";
                LbNPM.Text         = "NPM";

                this.PanelTranskrip.Visible = false;

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

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

            using (SqlConnection con = new SqlConnection(CS))
            {
                con.Open();
                // --------------------- Fill Gridview  ------------------------
                SqlCommand CmdKRS = new SqlCommand("SpGetTranskrip", con);
                CmdKRS.CommandType = System.Data.CommandType.StoredProcedure;

                CmdKRS.Parameters.AddWithValue("@npm", this.TBNpm.Text);

                DataTable TableKRS = new DataTable();
                TableKRS.Columns.Add("KODE");
                TableKRS.Columns.Add("MATA KULIAH");
                TableKRS.Columns.Add("SKS");
                TableKRS.Columns.Add("NILAI");
                TableKRS.Columns.Add("BOBOT");

                using (SqlDataReader rdr = CmdKRS.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["BOBOT"] = rdr["jumlah"];
                            TableKRS.Rows.Add(datarow);
                        }

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

                        //Set Label
                        decimal Trans = (_TotalBobot / _TotalSKS);
                        this.LbIPK.Text = String.Format("{0:0.##}", Trans);

                        this.BtnPrint.Enabled = true;
                        this.BtnPrint.Visible = true;

                        this.PanelTranskrip.Visible = true;
                    }
                    else
                    {
                        //clear Gridview
                        TableKRS.Rows.Clear();
                        TableKRS.Clear();
                        GVTrans.DataSource = TableKRS;
                        GVTrans.DataBind();

                        this.BtnPrint.Enabled = false;
                        this.BtnPrint.Visible = false;

                        this.PanelTranskrip.Visible = false;

                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Data Nilai Tidak Ditemukan');", true);
                        this.TBNpm.Text = "";
                        return;
                    }
                }
            }
        }
Example #4
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();
                                }
                            }
                        }
                    }
                }
            }
        }