public ActionResult Read([DataSourceRequest] DataSourceRequest request) { if (asset.View) { var data = new Product_Price_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_Price_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_Price_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" })); } }
//chua biet dung lam gi public ActionResult Upsert(Product_Price item) { if (accessDetail != null && (accessDetail.access["all"] || accessDetail.access["create"]) || accessDetail != null && (accessDetail.access["all"] || accessDetail.access["update"])) { string result = ""; try { List <Product_Price> lstProdPrice = new List <Product_Price>(); lstProdPrice.Add(item); result = new Product_Price_DAO().UpSert(lstProdPrice, currentUser.name, AppConfigs.MCCConnectionString); 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." })); } }
public ActionResult Upsert(Product_Price item) { if (asset.Create || asset.Update) { string result = ""; try { List <Product_Price> lstProdPrice = new List <Product_Price>(); lstProdPrice.Add(item); result = new Product_Price_DAO().UpSert(lstProdPrice, 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." })); } }