public ActionResult Read([DataSourceRequest] DataSourceRequest request) { if (asset.View) { var data = new Product_Promotion_DAO().ReadAll(); return(Json(data.ToDataSourceResult(request))); } else { return(RedirectToAction("NoAccessRights", "Error")); } }
public string GetAll(string key) { try { if (AllConstant.KeyAPI == key) { DataTable dt = new Product_Promotion_DAO().ReadAll(AllConstant.ERPConnectionString); string st = JsonConvert.SerializeObject(dt); return(st); } return(""); } catch (Exception ex) { return(ex.ToString()); } }
public ActionResult Delete(string data) { if (asset.Delete) { string result = ""; string[] st = new string[1]; st[0] = data; result = new Product_Promotion_DAO().Delete(st).ToString(); if (result == "true") { return(Json(new { success = true, message = "Thành công" })); } else { return(Json(new { success = false, message = result })); } } else { return(Json(new { success = false, message = "Bạn không có quyền xóa" })); } }
public ActionResult Upsert(Product_Promotion item) { if (asset.Create || asset.Update) { string result = ""; try { List <Product_Promotion> lstProdPromotion = new List <Product_Promotion>(); lstProdPromotion.Add(item); result = new Product_Promotion_DAO().UpSert(lstProdPromotion, currentUser.UserName, "Insert"); if (result == "true") { if (item.id == 0)// 0 insert, 1 update { return(Json(new { success = true, type = 0 })); } else { return(Json(new { success = true, type = 1 })); } } else { return(Json(new { success = false, message = result })); } } catch (Exception e) { return(Json(new { success = false, message = "Có lỗi file upload" + e.Message })); } } else { return(Json(new { success = false, message = "Bạn không có quyền." })); } }