//[HttpPost] public JsonResult LoaiSanPham_show() { var dao = new LoaiSanPhamDAO(); var result = dao.GetLoaiSanPham(); return(Json(result, JsonRequestBehavior.AllowGet)); }
// GET: Admin/LoaiSanPham public ActionResult Index() { LoaiSanPhamDAO db = new LoaiSanPhamDAO(); List <LoaiSP> listsp = db.GetListLoaiSP(); return(View(listsp)); }
public static int ThemLoaiSP(LoaiSanPhamDTO dto) { if (LoaiSanPhamDAO.KiemTraTonTai(dto.MaLoaiSP)) { return(-1); } return(LoaiSanPhamDAO.ThemLoaiSP(dto)); }
public static Boolean Update(LoaiSanPhamDTO loaiSanPhamDTO) { if (LoaiSanPhamDAO.IsExist(loaiSanPhamDTO.MaLoaiSP)) { return(LoaiSanPhamDAO.Update(loaiSanPhamDTO)); } return(false); }
public static Boolean Delete(String maLoaiSP) { if (LoaiSanPhamDAO.IsExist(maLoaiSP)) { return(LoaiSanPhamDAO.Delete(maLoaiSP)); } return(false); }
public void SetUp() { GetLSP = new List <LoaiSanPhamDTO>(); lspDAO = new LoaiSanPhamDAO(); lsp1 = new LoaiSanPhamDTO("1TCCM", "Thờ cúng chó mèo"); lsp2 = new LoaiSanPhamDTO("2PTCM", "Phẫu thuật chó mèo"); lsp3 = new LoaiSanPhamDTO("3LCM", "Lẩu chó mèo"); }
private void btDeleteCategory_Click(object sender, EventArgs e) { if (tvProduct.SelectedNode.Text != null && tvProduct.SelectedNode.Parent == null) { LoaiSanPhamDAO.DeleteLoaiSP(tvProduct.SelectedNode.Tag.ToString()); DisplayProductTreeView(); DisplayCategory(); } }
public static bool XoaLoaiSP(string maLoaiSP) { if (!LoaiSanPhamDAO.KTMaLoaiSPTonTai(maLoaiSP)) { return(false); } else { return(LoaiSanPhamDAO.XoaLoaiSP(maLoaiSP)); } }
public static bool SuaLoaiSP(LoaiSanPhamDTO loaisp) { if (!LoaiSanPhamDAO.KTMaLoaiSPTonTai(loaisp.MaLoaiSP)) { return(false); } else { return(LoaiSanPhamDAO.SuaLoaiSP(loaisp)); } }
public static LoaiSanPhamDTO LayThongTinLoaiSanPham(string maLoaiSP) { if (LoaiSanPhamDAO.KTMaLoaiSPTonTai(maLoaiSP)) { return(LoaiSanPhamDAO.LayThongTinLoaiSanPham(maLoaiSP)); } else { return(null); } }
// Hiển thị tree view loại sản phẩm private void DisplayProductTreeView() { tvProduct.Nodes.Clear(); DataTable data = LoaiSanPhamDAO.GetLoaiSP(); TreeNode parentNode = new TreeNode(); foreach (DataRow row in data.Rows) { parentNode = tvProduct.Nodes.Add(row["TenLoai"].ToString()); parentNode.Tag = row["id"].ToString(); PopulateTreeView(row["id"].ToString(), parentNode); } }
private void btUpdateCategory_Click(object sender, EventArgs e) { if (tvProduct.SelectedNode.Text != null && tvProduct.SelectedNode.Parent == null) { DTO.Category loaisp = new DTO.Category(); loaisp.Id = Convert.ToInt32(tvProduct.SelectedNode.Tag.ToString()); loaisp.TenLoai = tbCategory.Text; LoaiSanPhamDAO.UpdateLoaiSP(loaisp); DisplayProductTreeView(); DisplayCategory(); } else { MessageBox.Show("Vui lòng chọn loại sản phẩm cần update"); } }
public ActionResult Create(LoaiSP sp) { if (ModelState.IsValid) { var dao = new LoaiSanPhamDAO(); bool id = dao.Insert(sp); if (id) { return(RedirectToAction("Index", "LoaiSanPham")); } else { ModelState.AddModelError("", "Tạo mới Loại sp thất bại!"); } } return(View("Index")); }
public PartialViewResult _LoaiSanPham_ChiTiet(int ID) { LoaiSanPhamDAO productType; try { List <LoaiSanPhamDAO> productTypes = (List <LoaiSanPhamDAO>)TempData["productType"]; TempData.Keep(); productType = productTypes.Where(x => x.MaLoaiSanPham.Equals(ID)).FirstOrDefault(); if (productType == null) { productType = new LoaiSanPhamDAO(); } } catch (Exception e) { throw e; } return(PartialView(productType)); }
private void btSaveCategory_Click(object sender, EventArgs e) { if (tbCategory.Text != "") { try { LoaiSanPhamDAO.InsertLoaiSP(tbCategory.Text); DisplayProductTreeView(); DisplayCategory(); } catch (Exception ex) { MessageBox.Show("Insert error, " + ex); } } else { MessageBox.Show("vui lòng nhập ít nhất 2 kí tự"); } }
public JsonResult addOrUpdateProductType(LoaiSanPhamDAO obj, bool isUpdate) { AjaxResultModel Result = new AjaxResultModel(); bool check = true; try { if (isUpdate) { check = LoaiSanPham_Service.Update(obj); } else { check = LoaiSanPham_Service.Insert(obj); } if (check) { Result.Code = 0; Result.Message = "Thành công"; } else { Result.Code = 1; Result.Message = "Đã có lỗi xảy ra. Vui lòng thử lại."; } } catch (Exception e) { Result.Code = 1; Result.Message = e.Message; //throw; } return(Json(new JsonResult() { Data = Result })); }
public ActionResult Edit(LoaiSP sp) { try { if (ModelState.IsValid) { var dao = new LoaiSanPhamDAO(); var result = dao.Update(sp); if (result) { return(RedirectToAction("Index", "LoaiSanPham")); } else { ModelState.AddModelError("", "Cập nhật thất bại!"); } } return(View("Index")); } catch { return(View()); } }
public static List <LoaiSanPhamDTO> LayDSLoaiSanPham() { return(LoaiSanPhamDAO.LayDSLoaiSanPham()); }
public List <LoaiSanPhamDTO> DSLSanPham() { return(LoaiSanPhamDAO.DanhSachLoaiSanPham()); }
public static List <LOAISANPHAM> LayDanhSachMaLoai() { return(LoaiSanPhamDAO.LayDanhSachMaLoai()); }
public static LoaiSanPhamDTO GetObjectByPrimaryKey(String maLoaiSP) { return(LoaiSanPhamDAO.GetObjectByPrimaryKey(maLoaiSP)); }
public static List <LoaiSanPhamDTO> Get(Boolean trangThai) { return(LoaiSanPhamDAO.Get(trangThai)); }
public static List <LoaiSanPhamDTO> Get() { return(LoaiSanPhamDAO.Get()); }
public static int XoaLoaiSP(string malsp) { return(LoaiSanPhamDAO.XoaLoaiSP(malsp)); }
public static int CapNhatLoaiSP(LoaiSanPhamDTO dto) { return(LoaiSanPhamDAO.CapNhatLoaiSP(dto)); }
public static bool KiemTraMaLoaiTonTai(string maloai) { return(LoaiSanPhamDAO.KiemTraMaLoaiTonTai(maloai)); }
public static LoaiSanPhamDTO LayLoaiSP(string malsp) { return(LoaiSanPhamDAO.LayLoaiSP(malsp)); }
// GET: Admin/LoaiSanPham/Edit/5 public ActionResult Edit(string id) { var sp = new LoaiSanPhamDAO().ViewDetail(id); return(View(sp)); }
public static bool SuaLoaiSanPham(LOAISANPHAM loaisp) { return(LoaiSanPhamDAO.SuaLoaiSanPham(loaisp)); }
public static bool XoaLoaiSanPham(string maloai) { return(LoaiSanPhamDAO.XoaLoaiSanPham(maloai)); }