private void LoadData() { tb_mahasiswa user = Session["user"] as tb_mahasiswa; dbDataContext db = new dbDataContext(); this.GridView1.DataSource = (from c in db.tb_mahasiswas orderby c.nim descending select c).ToList(); this.GridView1.DataBind(); }
private void LoadData() { tb_mahasiswa user = Session["user"] as tb_mahasiswa; dbDataContext db = new dbDataContext(); this.GridView1.DataSource = (from c in db.v_proposals where c.id_mahasiswa == user.id_mahasiswa orderby c.tgl_submit descending select c).ToList(); this.GridView1.DataBind(); }
protected void Unnamed_Click(object sender, EventArgs e) { if (Page.IsValid) { using (dbDataContext db = new dbDataContext()) { int id = Int32.Parse(Request.QueryString["id"]); var model = (from c in db.v_rooms where c.id_room == id select c).FirstOrDefault(); tb_mahasiswa user = Session["user"] as tb_mahasiswa; if (user != null) { tb_chat c = new tb_chat(); c.id_room = id; c.id_sender = user.id_mahasiswa; c.isi = t4.Text.Trim(); c.status = 0; c.id_recipient = model.id_pembimbing; db.tb_chats.InsertOnSubmit(c); } else { tb_dosen user2 = Session["user"] as tb_dosen; if (user2 != null) { tb_chat c = new tb_chat(); c.id_room = id; c.status = 1; c.id_sender = user2.id_dosen; c.isi = t4.Text.Trim(); c.id_recipient = model.id_mahasiswa; db.tb_chats.InsertOnSubmit(c); } } db.SubmitChanges(); Response.Redirect(Request.UrlReferrer.ToString()); } } }
protected void Unnamed_Click(object sender, EventArgs e) { if (Page.IsValid) { using (dbDataContext db = new dbDataContext()) { int id = Int32.Parse(Request.QueryString["id"]); tb_mahasiswa user = Session["user"] as tb_mahasiswa; tb_proposal model = (from c in db.tb_proposals where c.id_proposal == id select c).FirstOrDefault(); model.tgl_submit = DateTime.Now; model.id_mahasiswa = user.id_mahasiswa; model.judul_skripsi = t1.Text.Trim(); string dir = Server.MapPath("file_pengajuan"); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } if (Request.Files != null) { int i = 1; bool isValidFile = false; foreach (var file in f1.PostedFiles) { string[] validFileTypes = { "pdf", "docx", "PDF", "DOCX" }; string ext = System.IO.Path.GetExtension(f1.PostedFile.FileName); for (int x = 0; x < validFileTypes.Length; x++) { if (ext == "." + validFileTypes[x]) { isValidFile = true; break; } } } if (!isValidFile) { error_tipe.Visible = true; } else { foreach (var file in f1.PostedFiles) { string fn = i + "_" + file.FileName; //file.SaveAs(dir + "/temp_laporan/" + fn); string path = Server.MapPath(@"jangan_buang\" + model.id_proposal + "\\"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } file.SaveAs(path + fn); i++; } model.status_proposal = "Pending"; db.SubmitChanges(); Response.Redirect("pengajuan.aspx"); } } else { model.status_proposal = "Pending"; db.SubmitChanges(); Response.Redirect("pengajuan.aspx"); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { show_error.Visible = false; int id = Int32.Parse(Request.QueryString["id"]); tb_kaprodi us = Session["user"] as tb_kaprodi; using (dbDataContext db = new dbDataContext()) { tb_proposal model = (from c in db.tb_proposals where c.id_proposal == id select c).FirstOrDefault(); if (model != null) { t1.Text = model.judul_skripsi; catatan_kaprodi.Text = model.catatan_kaprodi; tb_mahasiswa tm = (from c in db.tb_mahasiswas where c.id_mahasiswa == model.id_mahasiswa select c).FirstOrDefault(); nama_mhs.Text = tm.nama; ipk_mhs.Text = tm.ipk + ""; nim_mhs.Text = tm.nim; alamat.Text = tm.alamat; telp.Text = tm.telp; fakultas.Text = (from c in db.tb_fakultas where c.id_fakultas == tm.id_fakultas select c.nama_fakultas).FirstOrDefault(); jurusan.Text = (from c in db.tb_jurusans where c.id_jurusan == tm.id_jurusan select c.nama_jurusan).FirstOrDefault(); List <file_info> fi = new List <file_info>(); string path = Server.MapPath(@"jangan_buang\" + model.id_proposal + "\\"); foreach (string fileName in Directory.GetFiles(path)) { // fileName is the file name file_info fi_i = new file_info(); fi_i.nama_file = fileName; fi_i.lokasi_file = @"jangan_buang\" + model.id_proposal + "\\" + Path.GetFileName(fileName); fi.Add(fi_i); } RptDownload.DataSource = fi; RptDownload.DataBind(); var data = (from c in db.tb_dosens where c.id_jurusan == us.id_jurusan orderby c.nama select c).ToList(); data.Insert(0, new tb_dosen() { nama = "-", nid = "", }); d3.DataSource = data; d3.DataTextField = "nama"; d3.DataValueField = "id_dosen"; d3.DataBind(); d2.DataSource = data; d2.DataTextField = "nama"; d2.DataValueField = "id_dosen"; d2.DataBind(); } else { Response.Redirect("list_pengajuan.aspx"); } } } }