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

            using (SqlConnection con = new SqlConnection(CS))
            {
                //----------------------------------------- Read Jadwal -------------------------------------------
                con.Open();
                SqlCommand CmdJadwal = new SqlCommand("SpJadwalUTS", con);
                CmdJadwal.CommandType = System.Data.CommandType.StoredProcedure;

                CmdJadwal.Parameters.AddWithValue("@id_prodi", this.DLProdi.SelectedValue);
                CmdJadwal.Parameters.AddWithValue("@semester", this.DLTahun.SelectedValue.ToString() + this.DlSemester.SelectedItem.Text);

                DataTable TableJadwal = new DataTable();
                TableJadwal.Columns.Add("Key");
                TableJadwal.Columns.Add("Kode");
                TableJadwal.Columns.Add("Mata Kuliah");
                TableJadwal.Columns.Add("Dosen");
                TableJadwal.Columns.Add("Kelas");
                TableJadwal.Columns.Add("Hari");
                TableJadwal.Columns.Add("Tanggal");
                TableJadwal.Columns.Add("Mulai");
                TableJadwal.Columns.Add("Selesai");
                TableJadwal.Columns.Add("Ruang");
                TableJadwal.Columns.Add("Jenis Kelas");

                using (SqlDataReader rdr = CmdJadwal.ExecuteReader())
                {
                    if (rdr.HasRows)
                    {
                        this.LbJadwalResult.Text = "";

                        this.PanelJadwal.Enabled = true;
                        this.PanelJadwal.Visible = true;

                        while (rdr.Read())
                        {
                            DataRow datarow = TableJadwal.NewRow();
                            datarow["Key"]         = rdr["no_jadwal"];
                            datarow["Kode"]        = rdr["kode_makul"];
                            datarow["Mata Kuliah"] = rdr["makul"];
                            datarow["Dosen"]       = rdr["nama"];
                            datarow["Kelas"]       = rdr["kelas"];
                            datarow["Hari"]        = rdr["hari_uts"];
                            if (rdr["tgl_uts"] == DBNull.Value)
                            {
                            }
                            else
                            {
                                DateTime TglUjian = Convert.ToDateTime(rdr["tgl_uts"]);
                                datarow["Tanggal"] = TglUjian.ToString("yyyy-MM-dd");
                            }
                            datarow["Mulai"]       = rdr["jam_mulai_uts"];
                            datarow["Selesai"]     = rdr["jam_sls_uts"];
                            datarow["Ruang"]       = rdr["ruang_uts"];
                            datarow["Jenis Kelas"] = rdr["jenis_kelas"];

                            TableJadwal.Rows.Add(datarow);
                        }

                        //Fill Gridview
                        this.GVJadwalUTS.DataSource = TableJadwal;
                        this.GVJadwalUTS.DataBind();
                    }
                    else
                    {
                        this.LbJadwalResult.Text      = "Jadwal UTS Belum Ada ";
                        this.LbJadwalResult.ForeColor = System.Drawing.Color.Blue;

                        //hide panel Jadwal
                        this.PanelJadwal.Enabled = false;
                        this.PanelJadwal.Visible = false;


                        //clear Gridview
                        TableJadwal.Rows.Clear();
                        TableJadwal.Clear();
                        GVJadwalUTS.DataSource = TableJadwal;
                        GVJadwalUTS.DataBind();
                    }
                }
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //1. ----- set keterangan mahasiswa from last page
                // ------- Read Mahasiswa ----------
                //Server.UrlDecode(Request.QueryString["PID"]);
                mhs.ReadMahasiswa(Convert.ToString(Request.QueryString["nim"]));

                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);

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

                    //Convert.ToString(Request.QueryString["Name"]);
                    CmdListUTS.Parameters.AddWithValue("@npm", Convert.ToString(Request.QueryString["nim"]));
                    CmdListUTS.Parameters.AddWithValue("@semester", Server.UrlDecode(Request.QueryString["semester"]));

                    DataTable TableUTSMakul = new DataTable();
                    TableUTSMakul.Columns.Add("Kode");
                    TableUTSMakul.Columns.Add("Mata kuliah");
                    TableUTSMakul.Columns.Add("SKS");
                    TableUTSMakul.Columns.Add("Tanggal Ujian");
                    TableUTSMakul.Columns.Add("Tanda Tangan");

                    using (SqlDataReader rdr = CmdListUTS.ExecuteReader())
                    {
                        if (rdr.HasRows)
                        {
                            while (rdr.Read())
                            {
                                DataRow datarow = TableUTSMakul.NewRow();
                                datarow["Kode"]        = rdr["kode_makul"];
                                datarow["Mata Kuliah"] = rdr["makul"];
                                datarow["SKS"]         = rdr["sks"];
                                //--- format tanggal ---
                                if (rdr["tgl_uts"] == DBNull.Value)
                                {
                                }
                                else
                                {
                                    DateTime TglUjian = Convert.ToDateTime(rdr["tgl_uts"]);
                                    datarow["Tanggal Ujian"] = TglUjian.ToString("dd-MMMM-yyyy");
                                }
                                TableUTSMakul.Rows.Add(datarow);
                            }

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

                    //------------------------- GV UTS JADWAL ---------------------
                    SqlCommand CmdUTSJadwal = new SqlCommand("SpListUTS", con);
                    CmdUTSJadwal.CommandType = System.Data.CommandType.StoredProcedure;

                    CmdUTSJadwal.Parameters.AddWithValue("@npm", Convert.ToString(Request.QueryString["nim"]));
                    CmdUTSJadwal.Parameters.AddWithValue("@semester", Server.UrlDecode(Request.QueryString["semester"]));

                    DataTable TableUTSJadwal = new DataTable();
                    TableUTSJadwal.Columns.Add("Hari");
                    TableUTSJadwal.Columns.Add("Mata Kuliah");
                    TableUTSJadwal.Columns.Add("Dosen");
                    TableUTSJadwal.Columns.Add("Mulai");
                    TableUTSJadwal.Columns.Add("Selesai");
                    TableUTSJadwal.Columns.Add("Ruang");

                    using (SqlDataReader rdr = CmdUTSJadwal.ExecuteReader())
                    {
                        if (rdr.HasRows)
                        {
                            while (rdr.Read())
                            {
                                DataRow datarow2 = TableUTSJadwal.NewRow();
                                datarow2["Hari"]        = rdr["hari_uts"];
                                datarow2["Mata Kuliah"] = rdr["makul"];
                                datarow2["Mulai"]       = rdr["jam_mulai_uts"];
                                datarow2["Selesai"]     = rdr["jam_sls_uts"];
                                datarow2["Ruang"]       = rdr["ruang_uts"];
                                datarow2["Dosen"]       = rdr["nama"];

                                TableUTSJadwal.Rows.Add(datarow2);
                            }

                            //Fill Gridview
                            this.GVUTSDetail.DataSource = TableUTSJadwal;
                            this.GVUTSDetail.DataBind();
                        }
                        else
                        {
                            //clear Gridview
                            TableUTSJadwal.Rows.Clear();
                            TableUTSJadwal.Clear();
                            GVUTSDetail.DataSource = TableUTSJadwal;
                            GVUTSDetail.DataBind();
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Page lastpage = (Page)Context.Handler;
                if (lastpage is akademik.am.WebForm2)
                {
                    //1. ----- set mahasiswa identity from last page
                    this.LbNama.Text       = ((akademik.am.WebForm2)lastpage).Name;
                    this.LbNpm.Text        = ((akademik.am.WebForm2)lastpage).NPM;
                    this.LbJenisKelas.Text = ((akademik.am.WebForm2)lastpage).JenisKelas;
                    this.LbTahun.Text      = ((akademik.am.WebForm2)lastpage).Tahun;
                    this.LbSemester.Text   = ((akademik.am.WebForm2)lastpage).Semester;
                    this.LbProdi.Text      = ((akademik.am.WebForm2)lastpage).Prodi;
                    this.LbNama.Text       = ((akademik.am.WebForm2)lastpage).Name;

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


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

                        DataTable TableUTSMakul = new DataTable();
                        TableUTSMakul.Columns.Add("Kode");
                        TableUTSMakul.Columns.Add("Mata kuliah");
                        TableUTSMakul.Columns.Add("SKS");
                        TableUTSMakul.Columns.Add("Tanggal Ujian");
                        TableUTSMakul.Columns.Add("Tanda Tangan");

                        using (SqlDataReader rdr = CmdListUTS.ExecuteReader())
                        {
                            if (rdr.HasRows)
                            {
                                while (rdr.Read())
                                {
                                    DataRow datarow = TableUTSMakul.NewRow();
                                    datarow["Kode"]        = rdr["kode_makul"];
                                    datarow["Mata Kuliah"] = rdr["makul"];
                                    datarow["SKS"]         = rdr["sks"];
                                    //--- format tanggal ---
                                    if (rdr["tgl_uts"] == DBNull.Value)
                                    {
                                    }
                                    else
                                    {
                                        DateTime TglUjian = Convert.ToDateTime(rdr["tgl_uts"]);
                                        datarow["Tanggal Ujian"] = TglUjian.ToString("dd-MMMM-yyyy");
                                    }
                                    TableUTSMakul.Rows.Add(datarow);
                                }

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

                        //------------------------- GV UTS JADWAL ---------------------
                        SqlCommand CmdUTSJadwal = new SqlCommand("SpListUTS", con);
                        CmdUTSJadwal.CommandType = System.Data.CommandType.StoredProcedure;

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

                        DataTable TableUTSJadwal = new DataTable();
                        TableUTSJadwal.Columns.Add("Hari");
                        TableUTSJadwal.Columns.Add("Mata Kuliah");
                        TableUTSJadwal.Columns.Add("Dosen");
                        TableUTSJadwal.Columns.Add("Mulai");
                        TableUTSJadwal.Columns.Add("Selesai");
                        TableUTSJadwal.Columns.Add("Ruang");

                        using (SqlDataReader rdr = CmdUTSJadwal.ExecuteReader())
                        {
                            if (rdr.HasRows)
                            {
                                while (rdr.Read())
                                {
                                    DataRow datarow2 = TableUTSJadwal.NewRow();
                                    datarow2["Hari"]        = rdr["hari_uts"];
                                    datarow2["Mata Kuliah"] = rdr["makul"];
                                    datarow2["Mulai"]       = rdr["jam_mulai_uts"];
                                    datarow2["Selesai"]     = rdr["jam_sls_uts"];
                                    datarow2["Ruang"]       = rdr["ruang_uts"];
                                    datarow2["Dosen"]       = rdr["nama"];

                                    TableUTSJadwal.Rows.Add(datarow2);
                                }

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