// GET: Admin/LinhVucs/Delete/5 public ActionResult Delete(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LinhVuc linhVuc = _linhVucService.SelectById(id); if (linhVuc == null) { return(HttpNotFound()); } return(View(linhVuc)); }
// GET: AdminLinhVuc/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LinhVuc linhVuc = await db.LinhVucs.FindAsync(id); if (linhVuc == null) { return(HttpNotFound()); } return(View(linhVuc)); }
public ActionResult XacNhanXoaLV(int?id) { LinhVuc linhvuc = db.LinhVucs.SingleOrDefault(n => n.MaLinhVuc == id); ViewBag.MaLinhVuc = linhvuc.MaLinhVuc; if (linhvuc == null) { Response.StatusCode = 404; return(null); } db.LinhVucs.DeleteOnSubmit(linhvuc); db.SubmitChanges(); return(RedirectToAction("LinhVuc")); }
// GET: AdminLinhVuc/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LinhVuc linhVuc = await db.LinhVucs.FindAsync(id); if (linhVuc == null) { return(HttpNotFound()); } ViewBag.MaNhomLinhVuc = new SelectList(db.NhomLinhVucs, "MaNhomLinhVuc", "TenNhomLinhVuc", linhVuc.MaNhomLinhVuc); return(View(linhVuc)); }
public List <LinhVuc> DSLV() { SqlDataReader d = DALHelper.ExecuteReader(DALHelper.ConnectionString, CommandType.StoredProcedure, "tblLinhVuc_DS", null); List <LinhVuc> mylist = new List <LinhVuc>(); while (d.Read()) { LinhVuc lv = new LinhVuc(); lv.MaLinhVuc = d[0].ToString(); lv.TenLinhVuc = d[1].ToString(); lv.GhiChu = d[2].ToString(); mylist.Add(lv); } d.Dispose(); return(mylist); }
public LinhVuc LayLV(string Ma) { SqlParameter[] parm = new SqlParameter[] { new SqlParameter(PARM_MALINHVUC, SqlDbType.NVarChar, 30) }; parm[0].Value = Ma; SqlDataReader d = DALHelper.ExecuteReader(DALHelper.ConnectionString, CommandType.StoredProcedure, "tblLinhVuc_Lay1", parm); LinhVuc dv = new LinhVuc(); if (d.Read()) { dv.MaLinhVuc = d[0].ToString(); dv.TenLinhVuc = d[1].ToString(); dv.GhiChu = d[2].ToString(); } return(dv); }
public void loadDataFromDoc(XmlDocument doc, string fileName, List <LinhVuc> list) { doc = new XmlDocument(); //Tao moi mot doi tuong XmlDocumnent doc.Load(fileName); //Load file theo duong dan XmlNodeList lvNode = doc.GetElementsByTagName("LinhVuc"); //Lay ra cac nut co the ten la nhanvien foreach (XmlNode node in lvNode) //Duyet tung nut { //Khai bao cac bien luu tri thong tin cua nhan vien string maLV, tenLV; maLV = node.ChildNodes[0].InnerText; //Lay ra gia tri nut con cua nut LinhVuc co index = 0 tenLV = node.ChildNodes[1].InnerText; LinhVuc e = new LinhVuc(maLV, tenLV); list.Add(e);// them vao danh sach LinhVuc } }
public static bool edit(LinhVuc linhvuc) { using (EntitiesDataContext db = new EntitiesDataContext()) { //Kiểm tra lĩnh vực có tồn tại không LINHVUC lv; lv = (from b in db.LINHVUCs where b.masolinhvuc.Equals(linhvuc.MaSoLinhVuc) select b).SingleOrDefault(); if (lv == null) { return(false); } lv.ten = linhvuc.TenLinhVuc; lv.trangthai = linhvuc.TrangThai; db.SubmitChanges(); return(true); } }
public async Task <ActionResult> DeleteLinhVucBaiBao(int?id, int?idBaiBao) { if (id == null || idBaiBao == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BaiBao baibao = await db.BaiBaos.Where(p => p.MaBaiBao == idBaiBao).FirstOrDefaultAsync(); LinhVuc linhvuc = await db.LinhVucs.Where(p => p.MaLinhVuc == id).FirstOrDefaultAsync(); if (baibao == null || linhvuc == null) { return(HttpNotFound()); } baibao.LinhVucs.Remove(linhvuc); await db.SaveChangesAsync(); return(RedirectToAction("LinhVucBaiBao")); }
public async Task <ActionResult> CreateLinhVucBaiBao(int id, int MaLinhVuc) { if (ModelState.IsValid) { BaiBao baiBao = await db.BaiBaos.FindAsync(id); LinhVuc lv = await db.LinhVucs.FindAsync(MaLinhVuc); baiBao.LinhVucs.Add(lv); await db.SaveChangesAsync(); return(RedirectToAction("LinhVucBaiBao")); } BaiBao baibao = await db.BaiBaos.FindAsync(id); ViewBag.MaLinhVuc = new SelectList(db.LinhVucs, "MaLinhVuc", "TenLinhVuc"); return(View(baibao)); }
//Khi chọn Thêm Lĩnh vực private void btnThem_Click(object sender, EventArgs e) { string tensach = Prompt.showDialog("Tên Lĩnh vực :", "Nhập tên lĩnh vực muốn thêm.", this); if (!String.IsNullOrEmpty(tensach)) { LinhVuc lv = new LinhVuc() { TenLinhVuc = tensach }; var result = LinhVucManager.add(lv); if (result != 0) { MessageBox.Show("Đã thêm."); reload(); return; } MessageBox.Show("Không thêm được"); } }
public List <LinhVuc> DSLV_Sach(string maSach) { SqlParameter[] parm = new SqlParameter[] { new SqlParameter(PARM_MASACH, SqlDbType.NVarChar, 30) }; parm[0].Value = maSach; SqlDataReader d = DALHelper.ExecuteReader(DALHelper.ConnectionString, CommandType.StoredProcedure, "tblLinhVuc_LayTheoSach", parm); List <LinhVuc> mylist = new List <LinhVuc>(); while (d.Read()) { LinhVuc lv = new LinhVuc(); lv.MaLinhVuc = d[0].ToString(); lv.TenLinhVuc = d[1].ToString(); lv.GhiChu = d[2].ToString(); mylist.Add(lv); } d.Dispose(); return(mylist); }
private void LoadDB() { List <LinhVuc> listlv = lvbll.DSLV(); LinhVuc.DataSource = listlv; LinhVuc.DataTextField = "TenLinhVuc"; LinhVuc.DataValueField = "MaLinhVuc"; LinhVuc.DataBind(); List <TheLoai> listtl = tlbll.DSTL(); TheLoai.DataSource = listtl; TheLoai.DataTextField = "TenTheLoai"; TheLoai.DataValueField = "MaTheLoai"; TheLoai.DataBind(); List <NgonNgu> listnn = ngvbll.DSNgonNgu(); NgonNgu.DataSource = listnn; NgonNgu.DataTextField = "TenNgonNgu"; NgonNgu.DataValueField = "MaNgonNgu"; NgonNgu.DataBind(); List <TacGia> listtg = tgbll.DSTacGia(); tacgia.DataTextField = "HoTenTacGia"; tacgia.DataValueField = "MaTacGia"; tacgia.DataSource = listtg; tacgia.DataBind(); List <NhaXuatBan> listnxb = nxbbll.DSNXB(); NhaXB.DataSource = listnxb; NhaXB.DataTextField = "TenNXB"; NhaXB.DataValueField = "MaNXB"; NhaXB.DataBind(); List <Sach> mylist = sbll.DSSach(); grvSach.DataSource = mylist; grvSach.DataBind(); }
public LinhVuc Insert(LinhVuc loaiVanBan) { return(_linhVucRepository.Add(loaiVanBan)); }
public int Them(LinhVuc lv) { return(lvdal.Them(lv)); }
public int Sua(LinhVuc lv) { return(lvdal.Sua(lv)); }
public void Update(LinhVuc loaiVanBan) { _linhVucRepository.Update(loaiVanBan); }
protected void btnSave_Click(object sender, EventArgs e) { if (typemodal.Value == "TG") { TacGia tg = new TacGia(); tg.HoTenTacGia = txtTen.Text; tg.MoTa = txtMoTa.Text; if (editType.Value == "add") { tg.MaTacGia = Tool.SinhMa(); int t = tgbll.Them(tg); LoadTG(); typemodal.Value = "hide"; } else { tg.MaTacGia = hdId.Value; tgbll.Sua(tg); LoadTG(); typemodal.Value = "hide"; } } if (typemodal.Value == "TL") { TheLoai tl = new TheLoai(); tl.TenTheLoai = txtTen.Text; tl.MoTa = txtMoTa.Text; if (editType.Value == "add") { tl.MaTheLoai = Tool.SinhMa(); int t = tlbll.Them(tl); LoadTL(); typemodal.Value = "hide"; } else { tl.MaTheLoai = hdId.Value; tlbll.Sua(tl); LoadTL(); typemodal.Value = "hide"; } } if (typemodal.Value == "LV") { LinhVuc lv = new LinhVuc(); lv.TenLinhVuc = txtTen.Text; lv.GhiChu = txtGhichu.Text; if (editType.Value == "add") { lv.MaLinhVuc = Tool.SinhMa(); int t = lvbll.Them(lv); LoadLV(); typemodal.Value = "hide"; } else { lv.MaLinhVuc = hdId.Value; lvbll.Sua(lv); LoadLV(); typemodal.Value = "hide"; } } if (typemodal.Value == "NN") { NgonNgu ng = new NgonNgu(); ng.TenNgonNgu = txtTen.Text; if (editType.Value == "add") { ng.MaNgonNgu = Tool.SinhMa(); int t = ngbll.Them(ng); LoadNN(); typemodal.Value = "hide"; } else { ng.MaNgonNgu = hdId.Value; ngbll.Sua(ng); LoadNN(); typemodal.Value = "hide"; } } if (typemodal.Value == "NXB") { NhaXuatBan nxb = new NhaXuatBan(); nxb.TenNXB = txtTen.Text; nxb.GhiChu = txtGhichu.Text; if (editType.Value == "add") { nxb.MaNXB = Tool.SinhMa(); int t = nxbbll.Them(nxb); LoadNXB(); typemodal.Value = "hide"; //nxb.UrlLogo = Up(fileAnh); } else { nxb.MaNXB = hdId.Value; nxbbll.Sua(nxb); LoadNXB(); typemodal.Value = "hide"; } } }