protected void lnk_Delete_Click(object sender, System.EventArgs e) { if (!base.IsAuthorizedOp(ActionType.Delete.ToString())) { base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền"); } else { int @int = WebUtils.GetInt((sender as LinkButton).CommandArgument); StockoutInfo dataById = SinGooCMS.BLL.Stockout.GetDataById(@int); if (dataById == null) { base.ShowAjaxMsg(this.UpdatePanel1, "Những thông tin này không được tìm thấy, các dữ liệu không tồn tại hoặc đã bị xóa"); } else if (SinGooCMS.BLL.Stockout.Delete(@int)) { this.BindData(); PageBase.log.AddEvent(base.LoginAccount.AccountName, "删除商品[" + dataById.ProName + "]缺货登记成功"); base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thành công"); } else { base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thất bại"); } } }
public static int Add(StockoutInfo entity) { int result; if (entity == null) { result = 0; } else { result = BizBase.dbo.InsertModel <StockoutInfo>(entity); } return(result); }
private void AddStockout() { ProductInfo dataById = Product.GetDataById(WebUtils.GetFormInt("pid")); StockoutInfo last = Stockout.GetLast(WebUtils.GetFormInt("pid")); if (dataById == null) { base.WriteJsonTip(false, "商品不存在或者已删除", ""); } else if (base.UserID == -1) { base.WriteJsonTip(false, "会员没有登录", ""); } else if (last != null && System.DateTime.Now < last.AutoTimeStamp.AddDays(3.0)) { base.WriteJsonTip(false, "3天内已经登记过了", ""); } else { StockoutInfo entity = new StockoutInfo { ProID = dataById.AutoID, ProName = dataById.ProductName, UserName = base.UserName, CurrStock = dataById.Stock, AutoTimeStamp = System.DateTime.Now }; if (Stockout.Add(entity) > 0) { base.WriteJsonTip(true, "登记成功,我们将尽快处理!", ""); } else { base.WriteJsonTip(false, "Thao tác thất bại!", ""); } } }
public static bool Update(StockoutInfo entity) { return(entity != null && BizBase.dbo.UpdateModel <StockoutInfo>(entity)); }