protected void btnCreate_Click(object sender, EventArgs e) { try { string shelfCode = this.tbShelfCode.Text.Trim(); string itemCode = this.tbItem.Text.Trim(); if (!this.rfvItem.IsValid) { return; } ShelfItem shelfItem = new ShelfItem(); if (shelfItem != null) { shelfItem.Shelf = TheShelfMgr.LoadShelf(shelfCode); shelfItem.Item = TheItemMgr.LoadItem(itemCode); } TheShelfItemMgr.CreateShelfItem(shelfItem); ShowSuccessMessage("Mes.ShelfItem.Insert.Successfully"); if (CreateEvent != null) { CreateEvent(sender, e); } } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
protected void lbtnDelete_Click(object sender, EventArgs e) { string id = ((LinkButton)sender).CommandArgument; try { TheShelfItemMgr.DeleteShelfItem(Int32.Parse(id)); ShowSuccessMessage("Common.Business.Result.Delete.Successfully"); UpdateView(); } catch (Castle.Facilities.NHibernateIntegration.DataException ex) { ShowErrorMessage("Common.Business.Result.Delete.Failed"); } }