Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var x = Int32.Parse("" + Session["role"]);


            if (x == 0)
            {
                user = Session["user"] as tb_mahasiswa;
            }
            else
            {
                user = Session["user"];
            }

            /*for (int i = 0; i < Session.Count; i++)
             * {
             *  string value = "Key: " + Session.Keys[i] + ", Value: " + Session[Session.Keys[i]].ToString();
             *
             *  Response.Write(value);
             * }*/

            if (user == null)
            {
                Response.Redirect("default.aspx");
                return;
            }
            using (dbDataContext db = new dbDataContext())
            {
                s1.InnerText = db.tb_proposals.Count() + "";
                s2.InnerText = db.tb_mahasiswas.Count() + "";
                s3.InnerText = db.tb_dosens.Count() + "";
                s4.InnerText = db.tb_kaprodis.Count() + "";

                int tipe = Int32.Parse("" + Session["role"]);
                if (tipe == 0)
                {
                    tb_mahasiswa user = Session["user"] as tb_mahasiswa;
                    t1.Text = user.nim;
                    t2.Text = user.nama;
                    t3.Text = (from c in db.tb_fakultas where c.id_fakultas == user.id_fakultas select c.nama_fakultas).FirstOrDefault();
                    t4.Text = (from c in db.tb_jurusans where c.id_jurusan == user.id_jurusan select c.nama_jurusan).FirstOrDefault();
                }
                else if (tipe == 2)
                {
                    tb_dosen user = Session["user"] as tb_dosen;
                    t1.Text = user.nid;
                    t2.Text = user.nama;
                    t3.Text = (from c in db.tb_fakultas where c.id_fakultas == user.id_fakultas select c.nama_fakultas).FirstOrDefault();
                    t4.Text = (from c in db.tb_jurusans where c.id_jurusan == user.id_jurusan select c.nama_jurusan).FirstOrDefault();
                }
                else
                {
                    tb_kaprodi user = Session["user"] as tb_kaprodi;
                    t1.Text = user.username;
                    t2.Text = user.nama;
                    t3.Text = (from c in db.tb_fakultas where c.id_fakultas == user.id_fakultas select c.nama_fakultas).FirstOrDefault();
                    t4.Text = (from c in db.tb_jurusans where c.id_jurusan == user.id_jurusan select c.nama_jurusan).FirstOrDefault();
                }
            }
        }
Esempio n. 2
0
        private void LoadData()
        {
            tb_dosen      user = Session["user"] as tb_dosen;
            dbDataContext db   = new dbDataContext();

            this.GridView1.DataSource = (from c in db.tb_dosens
                                         orderby c.nid descending
                                         select c).ToList();
            this.GridView1.DataBind();
        }
Esempio n. 3
0
        private void LoadData()
        {
            tb_dosen      user = Session["user"] as tb_dosen;
            dbDataContext db   = new dbDataContext();

            this.GridView1.DataSource = (from c in db.v_rooms
                                         where c.id_pembimbing == user.id_dosen
                                         orderby c.tgl_room descending
                                         select c).ToList();
            this.GridView1.DataBind();
        }
        private void LoadData()
        {
            tb_dosen      user = Session["user"] as tb_dosen;
            dbDataContext db   = new dbDataContext();
            int           id   = Int32.Parse(Request.QueryString["id"]);

            this.GridView1.DataSource = (from c in db.v_chats
                                         where c.id_room == id
                                         orderby c.id_chat descending
                                         select c).ToList();
            this.GridView1.DataBind();
        }
        protected void Unnamed_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                using (dbDataContext db = new dbDataContext())
                {
                    tb_dosen user  = Session["user"] as tb_dosen;
                    tb_room  model = new tb_room();
                    model.tgl_room      = DateTime.Parse(t2.Text.Trim());
                    model.id_proposal   = Int32.Parse(t1.SelectedValue);
                    model.id_mahasiswa  = (from c in db.tb_proposals where c.id_proposal == model.id_proposal select c.id_mahasiswa).FirstOrDefault();
                    model.id_pembimbing = user.id_dosen;

                    db.tb_rooms.InsertOnSubmit(model);
                    db.SubmitChanges();
                    Response.Redirect("bimbingan.aspx");
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack) // fungsi untuk cek postback kala
     {
         using (dbDataContext db = new dbDataContext())
         {
             tb_dosen user = Session["user"] as tb_dosen;
             var      data = (from c in db.v_proposals
                              where c.status_proposal == "Disetujui" && c.id_pembimbing_1 == user.id_dosen ||
                              c.id_pembimbing_2 == user.id_dosen
                              select new
             {
                 c.id_proposal,
                 judul_skripsi = c.judul_skripsi + " - " + c.nama + " - " + c.nim
             }).ToList();
             t1.DataSource     = data;
             t1.DataTextField  = "judul_skripsi";
             t1.DataValueField = "id_proposal";
             t1.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());
                }
            }
        }