// GET: Admin/SanPham/Edit/5 public ActionResult Edit(int id) { var rs = SanPhamBus.ChiTiet(id); List <CustomDropDownList> BiXoa = new List <CustomDropDownList>() { new CustomDropDownList { Text = "Không Xóa", Value = 0 }, new CustomDropDownList { Text = "Xóa", Value = 1 } }; List <CustomDropDownList> TinhTrang = new List <CustomDropDownList>() { new CustomDropDownList { Text = "Còn Hàng", Value = 1 }, new CustomDropDownList { Text = "Hết Hàng", Value = 0 } }; ViewBag.TinhTrang = new SelectList(TinhTrang, "Value", "Text"); ViewBag.BiXoa = new SelectList(BiXoa, "Value", "Text"); ViewBag.MaHang = new SelectList(HangBus.DanhSach(), "MaHang", "TenHang", rs.MaHang); ViewBag.MaLoai = new SelectList(LoaiBus.DanhSach(), "MaLoai", "TenLoai", rs.MaLoai); return(View(rs)); }
public FrmHangHoa() { InitializeComponent(); data = HangBus.GetListHang(); dgvHang.DataSource = data; dataFilter = data; }
// GET: Admin/SanPham/Create public ActionResult Create() { List <CustomDropDownList> BiXoa = new List <CustomDropDownList>() { new CustomDropDownList { Text = "Không Xóa", Value = 0 }, new CustomDropDownList { Text = "Xóa", Value = 1 } }; List <CustomDropDownList> TinhTrang = new List <CustomDropDownList>() { new CustomDropDownList { Text = "Còn Hàng", Value = 1 }, new CustomDropDownList { Text = "Hết Hàng", Value = 0 } }; ViewBag.TinhTrang = new SelectList(TinhTrang, "Value", "Text"); ViewBag.BiXoa = new SelectList(BiXoa, "Value", "Text"); ViewBag.MaHang = new SelectList(HangBus.DanhSach(), "MaHang", "TenHang"); ViewBag.MaLoai = new SelectList(LoaiBus.DanhSach(), "MaLoai", "TenLoai"); return(View()); }
private void btnUpdate_Click(object sender, EventArgs e) { if (txtMaHang.Text.Length == 0) { errMaHang.SetError(txtMaHang, "Không được để trống"); } else { errMaHang.Clear(); } if (txtTenHang.Text.Length == 0) { errTenHang.SetError(txtTenHang, "Không được để trống"); } else { errTenHang.Clear(); } if (txtMaLH.Text.Length == 0) { errMaLH.SetError(lblMaLH, "Không được để trống"); } else { errMaLH.Clear(); } if (txtMaNCC.Text.Length == 0) { errMaNCC.SetError(lblMaNCC, "Không được để trống"); } else { errMaNCC.Clear(); } if (errMaHang.GetError(txtMaHang).Length == 0 && errTenHang.GetError(txtTenHang).Length == 0 && errMaNCC.GetError(lblMaNCC).Length == 0 && errMaLH.GetError(lblMaLH).Length == 0) { Hang hang = new Hang(); hang.MaHang = txtMaHang.Text; hang.DVT = txtDVT.Text; hang.GhiChu = txtGhiChu.Text; hang.MaLoaiHang = int.Parse(txtMaLH.Text); hang.MaNCC = int.Parse(txtMaNCC.Text); hang.TenHang = txtTenHang.Text; if (HangBus.UpdateHang(hang)) { MessageBox.Show("Cập nhật thánh công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); _frmHH.data = HangBus.GetListHang(); _frmHH.dgvHang.DataSource = _frmHH.data; this.Close(); } else { MessageBox.Show("Cập nhật thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
// GET: SanPham/Details/5 public ActionResult Details(int id) { var ChiTietSP = SanPhamBus.ChiTiet(id); var ChiTietLoaiSP = LoaiBus.ChiTietViewModel(ChiTietSP.MaLoai); var ChitTietHangSP = HangBus.ChiTietViewModel(ChiTietSP.MaLoai); return(View(new SanPhamViewModel() { LoaiSP = ChiTietLoaiSP, HangSP = ChitTietHangSP, SanPham = ChiTietSP })); }
public ActionResult Edit(int id, HangSP HangSP) { try { // TODO: Add update logic here HangBus.Sua(HangSP); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(HangSP HangSP) { try { // TODO: Add insert logic here HangBus.Them(HangSP); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Delete(int id, FormCollection collection) { try { // TODO: Add delete logic here HangBus.Xoa(id); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: Admin/HangSP/Edit/5 public ActionResult Edit(int id) { var rs = HangBus.ChiTiet(id); List <CustomDropDownList> BiXoa = new List <CustomDropDownList>() { new CustomDropDownList { Text = "Không Xóa", Value = 0 }, new CustomDropDownList { Text = "Xóa", Value = 1 } }; ViewBag.BiXoa = new SelectList(BiXoa, "Value", "Text"); return(View(rs)); }
private void btnDelete_Click(object sender, EventArgs e) { var nv = dgvHang.CurrentRow.DataBoundItem as Hang; DialogResult result = MessageBox.Show("Bạn có chắc chắn xóa", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { if (HangBus.DeleteHang(nv.MaHang)) { MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); data = HangBus.GetListHang(); dgvHang.DataSource = data; } else { MessageBox.Show("Xóa thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
// GET: Admin/HangSP/Delete/5 public ActionResult Delete(int id) { var rs = HangBus.ChiTiet(id); return(View(rs)); }
// GET: Admin/HangSP public ActionResult Index(int Page = 1) { var DsHangSP = HangBus.PageDanhSach(Page, 10); return(View(DsHangSP)); }
public ActionResult Restore(int id) { HangBus.KhoiPhuc(id); return(RedirectToAction("Deleted")); }
public ActionResult Deleted(int Page = 1) { var DsHangSP = HangBus.PageDanhSachDaXoa(Page, 10); return(View(DsHangSP)); }