public ActionResult Details(int?id, int page = 1, int pageSize = 10, string search = null) { if (id == null) { putErrorMessage("Đường dẫn không chính xác"); return(RedirectToAction("TheoDoi")); } ViewBag.cultureInfo = CultureInfo; var nxb = NhaXuatBanManager.find((int)id); if (nxb == null) { putErrorMessage("Không tìm thấy Nhà xuất bản"); return(RedirectToAction("TheoDoi")); } ViewBag.currentNXB = nxb; var DMCongNo = nxb.CongNo; if (!String.IsNullOrEmpty(search)) { DMCongNo = CongNoNXBManager.filter(search, DMCongNo); ViewBag.SearchKey = search; } ViewBag.tongSoLuongNo = DMCongNo.Sum(cn => cn.SoLuong); ViewBag.tongTienNo = DMCongNo.Sum(cn => cn.ThanhTien); var models = DMCongNo.ToPagedList(page, pageSize); setAlertMessage(); return(View(models)); }
public ActionResult Delete(int id, FormCollection collection) { try { var model = NhaXuatBanManager.find((int)id); if (model == null) { putErrorMessage("Không tìm thấy"); return(RedirectToAction("Index")); } if (model.delete()) { putSuccessMessage("Xóa thành công"); return(RedirectToAction("Index")); } else { putErrorMessage("Xóa không thành công"); } return(RedirectToAction("Delete", new { id })); } catch (Exception ex) { putErrorMessage(ex.Message); return(RedirectToAction("Delete", new { id })); } }
// GET: PhieuNhap/Create public ActionResult Create(int?masonxb) { if (masonxb != null) { var nxb = NhaXuatBanManager.find((int)masonxb); if (nxb == null || nxb.TrangThai == 0) { putErrorMessage("Không tìm thấy Nhà xuát bản"); return(RedirectToAction("Create")); } ViewBag.cultureInfo = CultureInfo; ViewBag.currentNXB = nxb; ViewBag.DMSach = new SelectList(nxb.Sach, nameof(SachManager.Properties.MaSoSach), nameof(SachManager.Properties.TenSach), ""); if (_phieu == null) { _phieu = new PhieuNhap(); } _phieu.MaSoNXB = nxb.MaSoNXB; _phieu.NXB = nxb; _phieu.NgayLap = DateTime.Now; setAlertMessage(); return(View(_phieu)); } else { ViewBag.DMNXB = new SelectList(NhaXuatBanManager.getAllAlive(), nameof(NhaXuatBanManager.Properties.MaSoNXB), nameof(NhaXuatBanManager.Properties.TenNXB), ""); _phieu = new PhieuNhap(); setAlertMessage(); return(View()); } }
private void cmbNXB_SelectionChangeCommitted(object sender, EventArgs e) { _currentNXB = NhaXuatBanManager.find(int.Parse(cmbNXB.SelectedValue.ToString())); txbMaSoNXB.Text = _currentNXB.MaSoNXB + ""; loadSach(); cmbNXB.Enabled = false; }
private void cmbNhaXuatBan_SelectionChangeCommitted(object sender, EventArgs e) { if (cmbNhaXuatBan.SelectedIndex != -1) { NhaXuatBan nxb = NhaXuatBanManager.find(int.Parse(cmbNhaXuatBan.SelectedValue.ToString())); _DMSach = nxb.Sach; cmbNhaXuatBan.Enabled = false; } }
// GET: NhaXuatBan/Details/5 public ActionResult Details(int?id) { if (id == null) { putErrorMessage("Đường dẫn không chính xác"); return(RedirectToAction("Index")); } var model = NhaXuatBanManager.find((int)id); if (model == null) { putErrorMessage("Không tìm thấy"); return(RedirectToAction("Index")); } setAlertMessage(); return(View(model)); }
public ViewResult BlankEditorRow(int masonxb, int masosach = 0) { var nxb = NhaXuatBanManager.find((int)masonxb); var chitiet = new ChiTietHoaDonNXB(); if (masosach != 0) { chitiet.MaSoSach = (int)masosach; if (_hoadon.ChiTiet.Contains(chitiet)) { return(null); } } else { var founded = false; foreach (Sach s in nxb.Sach.Where(s => s.CongNoNXB.Count > 0).ToList()) { chitiet.MaSoSach = s.MaSoSach; chitiet.Sach = s; if (_hoadon.ChiTiet.Contains(chitiet)) { continue; } founded = true; break; } if (!founded) { return(null); } } ViewBag.currentNXB = nxb; ViewBag.cultureInfo = CultureInfo; ViewBag.DMSach = new SelectList(nxb.Sach, nameof(SachManager.Properties.MaSoSach), nameof(SachManager.Properties.TenSach), ""); chitiet.SoLuong = 1; chitiet.DonGia = chitiet.Sach.GiaNhap; _hoadon.addDetail(chitiet); return(View("ChiTietEditorRow", chitiet)); }
// GET: PhieuNhap/ThanhToan public ActionResult ThanhToan(int?masonxb) { if (masonxb != null) { var nxb = NhaXuatBanManager.find((int)masonxb); if (nxb == null || nxb.TrangThai == 0) { putErrorMessage("Không tìm thấy nhà xuất bản"); return(RedirectToAction("ThanhToan")); } ViewBag.cultureInfo = CultureInfo; ViewBag.currentNXB = nxb; ViewBag.DMSach = new SelectList(nxb.Sach.Where(s => s.CongNoNXB.Count > 0).ToList(), nameof(SachManager.Properties.MaSoSach), nameof(SachManager.Properties.TenSach), ""); if (_hoadon == null) { _hoadon = new HoaDonNXB(); } _hoadon.MaSoNXB = nxb.MaSoNXB; _hoadon.NXB = nxb; _hoadon.NgayLap = DateTime.Now; setAlertMessage(); return(View(_hoadon)); } else { ViewBag.DMNXB = new SelectList(NhaXuatBanManager.getAllAlive() .Where(nxb => nxb.TongTienNo > 0).ToList(), nameof(NhaXuatBanManager.Properties.MaSoNXB), nameof(NhaXuatBanManager.Properties.TenNXB), ""); _hoadon = new HoaDonNXB(); setAlertMessage(); return(View()); } }