/// <summary> /// bind combobox cho diem tiep nhan va thong tin bao /// </summary> /// <param name="BDieuChinhPhanHuongUnit"></param> /// <param name="check">check == 1 chi load dientiepnhan</param> private void bindComboboxDieuChinhPHNC(int check = 0, BDieuChinhPhanHuongUnit BDieuChinhPhanHuongUnit = null) { if (BDieuChinhPhanHuongUnit != null) { ViewBag.DiemTiepNhanId = new SelectList(dbDieuChinhPHNC.getAllDiemTiepNhan(), "Id", "Name", BDieuChinhPhanHuongUnit.DiemTiepNhanId); if (check != 0) { ViewBag.ThongTinBaoId = new SelectList(dbDieuChinhPHNC.getAllThongTinBao(), "Id", "TenBao", BDieuChinhPhanHuongUnit.ThongTinBaoId); } } else { ViewBag.DiemTiepNhanId = new SelectList(dbDieuChinhPHNC.getAllDiemTiepNhan(), "Id", "Name"); if (check != 0) { ViewBag.ThongTinBaoId = new SelectList(dbDieuChinhPHNC.getAllThongTinBao(), "Id", "TenBao"); } } }
public ActionResult DeleteDieuChinhPHNC([Bind(Include = "Id,UnitCode,ThongTinBaoId,DiemTiepNhanId")] BDieuChinhPhanHuongUnitModel BDieuChinhPhanHuongUnit, string Units) { string DieuChinhKHXBDetailId = null; DieuChinhKHXBDetailId = BDieuChinhPhanHuongUnit.ThongTinBaoId; // lấy thông tin mã báo if (ModelState.IsValid) { //object temp để lưu dữ liệu PHNC BDieuChinhPhanHuongUnit temp = new BDieuChinhPhanHuongUnit(); string[] lstids = Units.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); foreach (var item in lstids) { //lấy thông tin đổ vào temp param : UnitCode và ThongTinBaoId temp = dbDieuChinhPHNC.getByUnit(item, BDieuChinhPhanHuongUnit.ThongTinBaoId); dbDieuChinhPHNC.Delete(temp.Id); } return RedirectToAction("Index" + subAction, new { DieuChinhKHXBDetailId = BDieuChinhPhanHuongUnit.ThongTinBaoId }); } //Viewbag chung để return ra view input ViewBag.DTNBC = dbDieuChinhPHNC.getAllData(userInfo.UnitCode, DieuChinhKHXBDetailId); //left tree data ViewBag.DiemTiepNhanId = new SelectList(dbDieuChinhPHNC.getAllDiemTiepNhan(), "Id", "Name", BDieuChinhPhanHuongUnit.DiemTiepNhanId); ViewBag.ThongTinBaoId = new SelectList(dbDieuChinhPHNC.getAllThongTinBao(), "Id", "DieuChinhKHXBDetailId", BDieuChinhPhanHuongUnit.ThongTinBaoId); ViewBag.UnitCode = dbDieuChinhPHNC.getAllUnitByDTNId(userInfo.UnitCode, BDieuChinhPhanHuongUnit.DiemTiepNhanId, DieuChinhKHXBDetailId); ViewBag.DieuChinhKHXBDetailId = DieuChinhKHXBDetailId; return View(BDieuChinhPhanHuongUnit); }