public ActionResult QLNganh() { Nganh ng = new Nganh(); ViewBag.Nganh = ng.listnganh(); return(View()); }
private void txtNganh_SelectionChanged(object sender, SelectionChangedEventArgs e) { db = new MyDbContext(); Nganh obj = db.Nganh.Find(txtNganh.SelectedValue); txtDiemChuan.Text = obj.DiemChuan.ToString(); }
private void btnLamLaiNganh_Click(object sender, EventArgs e) { txtMaNganh.Text = ""; txtTenNganh.Text = ""; txtYNghia.Text = ""; currentNganh = null; }
public ActionResult SuaNganh(string manganh, string tennganh) { Nganh ngh = new Nganh(); ngh.suanganh(manganh, tennganh); return(Redirect("~/QLSV/QLNganh")); }
public ActionResult Create([Bind(Include = "NganhId,TenNganh,KhoaId")] Nganh nganh) { if (ModelState.IsValid) { db.Nganhs.Add(nganh); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nganh)); }
private void btnLuu_Click(object sender, EventArgs e) { if (!txtMaNganh.Text.Trim().Equals("")) { if (them) { try { XepThoiKhoaBieuDataContext dbs = new XepThoiKhoaBieuDataContext(); Nganh nganh = new Nganh(); nganh.MaNganh = Convert.ToInt32(txtMaNganh.Text); nganh.TenNganh = txtTenNganh.Text; dbs.Nganhs.InsertOnSubmit(nganh); dbs.SubmitChanges(); LoadData(); MessageBox.Show("Đã thêm xong"); } catch (Exception) { MessageBox.Show("Không thêm được,Lỗi rồi!!"); } } else { try { int r = dgvNganh.CurrentCell.RowIndex; string ma = dgvNganh.Rows[r].Cells[0].Value.ToString(); XepThoiKhoaBieuDataContext dbs = new XepThoiKhoaBieuDataContext(); var ng = (from p in dbs.Nganhs where p.MaNganh.ToString() == ma select p).SingleOrDefault(); if (ng != null) { ng.TenNganh = txtTenNganh.Text; dbs.SubmitChanges(); LoadData(); } LoadData(); MessageBox.Show("Đã sửa xong!"); } catch (Exception) { MessageBox.Show("Không sửa được,Lỗi rồi!!"); } } } else { MessageBox.Show("Ngành chưa có,Lỗi rồi!!"); txtMaNganh.Focus(); } LoadData(); }
// GET: QLSV public ActionResult Index() { Lop lop = new Lop(); Nganh nganh = new Nganh(); SinhVien sinhvien = new SinhVien(); ViewBag.ListLop = lop.listlop(); ViewBag.ListNganh = nganh.listnganh(); ViewBag.SinhVien = sinhvien.listSinhVien(); return(View()); }
public ActionResult Edit([Bind(Include = "NganhId,TenNganh,KhoaId")] Nganh nganh) { if (ModelState.IsValid) { db.Entry(nganh).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.KhoaId = new SelectList(db.Khoas, "KhoaId", "TenKhoa", nganh.KhoaId); return(View(nganh)); }
public ActionResult QLDiem() { Mon m = new Mon(); Nganh ngh = new Nganh(); SinhVien sv = new SinhVien(); Diem d = new Diem(); ViewBag.ListMon = m.listmon(); ViewBag.ListNganh = ngh.listnganh(); ViewBag.SinhVien = sv.listSinhVien(); ViewBag.Diem = d.listdiem(); return(View()); }
public ActionResult TimSinhVien(string hotentim) { SinhVien sv = new SinhVien(); var timkiem = sv.timsinhvien1(hotentim); //var timkiem = db.Sach.Where(s => ConvertToUnSign(s.tensach).StartsWith(tensach)).ToList(); Lop l = new Lop(); ViewBag.ListLop = l.listlop(); Nganh ngh = new Nganh(); ViewBag.ListNganh = ngh.listnganh(); ViewBag.TimKiem = timkiem; return(View()); }
private void Nganh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Nganh n = new Nganh(); if (Application.OpenForms[n.Name] == null) { n.MdiParent = this; n.Show(); } else { Application.OpenForms[n.Name].Focus(); } }
public static List <Nganh> DSNganh() { var lqq = new List <Nganh>(); var cm = CreateCommand(); cm.CommandText = @"Select MANGANH,TENNGANH,TONGSV,SOLUONGCDHT from Nganh"; var reader = cm.ExecuteReader(); while (reader.Read()) { lqq.Add(Nganh.ReadNganh(reader)); } cn.Close(); return(lqq); }
public bool edit(int id, Nganh nganh) { try { var model = _context.Nganh.Find(id); model.name = nganh.name; _context.Nganh.Update(model); _context.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public ActionResult ThemNganh(string manganh, string tennganh) { Nganh ng = new Nganh(); Nganh ng1 = new Nganh(manganh, tennganh); if (ng.timnganh(manganh) == null) { ng.themnganh(ng1); return(Redirect("~/QLSV/QLNganh")); } else { TempData["DaCoNG"] = "Mã ngành này đã tồn tại"; return(Redirect("~/QLSV/QLNganh")); } }
public ActionResult XoaNganh(string manganh) { Nganh ngh = new Nganh(); SinhVien sv = new SinhVien(); if (sv.timsinhvien3(manganh) == null) { ngh.xoanganh(manganh); return(Redirect("~/QLSV/QLNganh")); } else { TempData["ErrorNGH"] = "Vẫn còn tồn tại sinh viên"; return(Redirect("~/QLSV/QLNganh")); } }
public ActionResult TimDiem(double diemtim) { Diem d = new Diem(); var timkiem = d.timdiem2(diemtim); //var timkiem = db.Sach.Where(s => ConvertToUnSign(s.tensach).StartsWith(tensach)).ToList(); Mon m = new Mon(); ViewBag.ListMon = m.listmon(); Nganh ngh = new Nganh(); ViewBag.ListNganh = ngh.listnganh(); SinhVien sv = new SinhVien(); ViewBag.SinhVien = sv.listSinhVien(); ViewBag.TimKiem = timkiem; return(View()); }
public ActionResult SuaSinhVien(string mssv) { SinhVien sv = new SinhVien(); var a = sv.timsinhvien(mssv); ViewBag.NgaySinh = (a.ngaysinh).ToString("yyyy-MM-dd"); Lop l = new Lop(); var lop = l.timlop(a.malop); ViewBag.Lop = lop; Nganh ngh = new Nganh(); var nganh = ngh.timnganh(a.manganh); ViewBag.Nganh = nganh; ViewBag.Lop1 = l.timlop2(a.malop); ViewBag.Nganh1 = ngh.timnganh2(a.manganh); ViewBag.SuaSinhVien = a; return(View()); }
// GET: Nganh/Details/5 public ActionResult Details(decimal id) { if (!UserManager.Authenticated) { return(RedirectToAction("Login", "Admin")); } else { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Nganh nganh = db.Nganhs.Find(id); if (nganh == null) { return(HttpNotFound()); } return(View(nganh)); } }
// GET: Nganh/Edit/5 public ActionResult Edit(decimal id) { if (!UserManager.Authenticated) { return(RedirectToAction("Login", "Admin")); } else { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Nganh nganh = db.Nganhs.Find(id); if (nganh == null) { return(HttpNotFound()); } ViewBag.KhoaId = new SelectList(db.Khoas, "KhoaId", "TenKhoa", nganh.KhoaId); return(View(nganh)); } }
public static bool InitializedNganh() { db = new MyDbContext(); try { Nganh CN = new Nganh() { MaNganh = "CN", TenNganh = "Công nghệ thông tin", DiemChuan = 20 }; Nganh QTKD = new Nganh() { MaNganh = "QT", TenNganh = "Quản trị kinh doanh", DiemChuan = 19 }; Nganh NN = new Nganh() { MaNganh = "NN", TenNganh = "Ngoại ngữ", DiemChuan = 19 }; Nganh DL = new Nganh() { MaNganh = "DL", TenNganh = "Du lịch", DiemChuan = 19 }; db.Nganh.Add(CN); db.Nganh.Add(QTKD); db.Nganh.Add(NN); db.Nganh.Add(DL); db.SaveChanges(); return(true); } catch (Exception e) { return(false); } }