protected void btnSave_Click(object sender, EventArgs e) { string childerItemCode = this.tbCode.Text.Trim(); decimal Qty = 0; try { Qty = Convert.ToDecimal(this.tbQty.Text.Trim()); } catch (Exception) { ShowErrorMessage("Common.Validator.Valid.Number"); return; } if (TheItemKitMgr.LoadItemKit(this.ParentItemCode, childerItemCode) == null) { ItemKit itemKit = new ItemKit(); itemKit.ChildItem = TheItemMgr.LoadItem(childerItemCode); itemKit.ParentItem = TheItemMgr.LoadItem(this.ParentItemCode); itemKit.IsActive = this.cbIsActive.Checked; itemKit.Qty = Qty; TheItemKitMgr.CreateItemKit(itemKit); ShowSuccessMessage("MasterData.Item.AddItem.Successfully", childerItemCode); } else { ShowErrorMessage("Common.Code.Exist", childerItemCode); return; } NewEvent(this, e); }
protected void btnSave_Click(object sender, EventArgs e) { decimal Qty = 0; try { Qty = Convert.ToDecimal(this.tbQty.Text.Trim()); } catch (Exception) { ShowErrorMessage("Common.Validator.Valid.Number"); return; } if (TheItemKitMgr.LoadItemKit(this.ParentItemCode, this.ChildItemCode) != null) { ItemKit itemKit = new ItemKit(); itemKit.ChildItem = TheItemMgr.LoadItem(this.ChildItemCode); itemKit.ParentItem = TheItemMgr.LoadItem(this.ParentItemCode); itemKit.IsActive = this.cbIsActive.Checked; itemKit.Qty = Qty; TheItemKitMgr.UpdateItemKit(itemKit); } else { ShowErrorMessage("Common.Code.Exist", ChildItemCode); } EditEvent(this, e); }
public void PageCleanup(string code) { ItemKit kit = TheItemKitMgr.LoadItemKit(this.ParentItemCode, code); this.ChildItemCode = code; this.tbCode.Text = code; this.tbQty.Text = kit.Qty.ToString("0.########"); this.cbIsActive.Checked = kit.IsActive; }
protected void btnDelete_Click(object sender, EventArgs e) { try { TheItemKitMgr.DeleteItemKit(this.ParentItemCode, this.ChildItemCode); ShowSuccessMessage("MasterData.Item.DeleteItem.Successfully", this.ChildItemCode); btnBack_Click(this, e); } catch (Castle.Facilities.NHibernateIntegration.DataException ex) { ShowErrorMessage("MasterData.Item.DeleteItem.Fail", this.ChildItemCode); } }
protected void lbtnDelete_Click(object sender, EventArgs e) { string code = ((LinkButton)sender).CommandArgument; try { TheItemKitMgr.DeleteItemKit(ParentItemCode, code); ShowSuccessMessage("MasterData.Item.DeleteItem.Successfully", code); UpdateView(); } catch (Castle.Facilities.NHibernateIntegration.DataException ex) { ShowErrorMessage("MasterData.Item.DeleteItem.Fail", code); } }
//检查零件是否存在 private bool CheckItemExists(IList <FlowDetail> flowDetailList) { int newRowId = flowDetailList != null ? flowDetailList.Count - 1 : 0; GridViewRow newRow = this.GV_List.Rows[newRowId]; Controls_TextBox tbItemCode = (Controls_TextBox)newRow.FindControl("tbItemCode"); Controls_TextBox tbUom = (Controls_TextBox)newRow.FindControl("tbUom"); TextBox tbUnitCount = (TextBox)newRow.FindControl("tbUnitCount"); if (flowDetailList != null) { Flow flow = flowDetailList[0].Flow; IList <Item> itemList = new List <Item>(); Item item = this.TheItemMgr.LoadItem(tbItemCode.Text.Trim()); item.Uom = this.TheUomMgr.LoadUom(tbUom.Text.Trim()); item.UnitCount = decimal.Parse(tbUnitCount.Text.Trim()); if (item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_K) { IList <ItemKit> itemKitList = TheItemKitMgr.GetChildItemKit(item); if (itemKitList != null && itemKitList.Count > 0) { foreach (ItemKit itemKit in itemKitList) { itemList.Add(itemKit.ChildItem); } } else { ShowErrorMessage("ItemKit.Error.NotFoundForParentItem", item.Code); return(true); } } else { itemList.Add(item); } for (int i = 0; i < flowDetailList.Count - 1; i++) { foreach (Item checkItem in itemList) { string oLocFrom = flow.LocationFrom == null ? null : flow.LocationFrom.Code; string oLocTo = flow.LocationTo == null ? null : flow.LocationTo.Code; string dLocFrom = flowDetailList[i].DefaultLocationFrom == null ? null : flowDetailList[i].DefaultLocationFrom.Code; string dLocTo = flowDetailList[i].DefaultLocationTo == null ? null : flowDetailList[i].DefaultLocationTo.Code; if (flowDetailList[i].Item.Code == checkItem.Code && flowDetailList[i].Item.Uom.Code == checkItem.Uom.Code && oLocFrom == dLocFrom && oLocTo == dLocTo && flowDetailList[i].UnitCount == checkItem.UnitCount) { if (checkItem.Code == item.Code && item.Uom.Code == checkItem.Uom.Code && oLocFrom == dLocFrom && oLocTo == dLocTo && checkItem.UnitCount == item.UnitCount) { ShowErrorMessage("MasterData.Order.OrderDetail.ItemCode.Exists"); } else { ShowErrorMessage("MasterData.Order.OrderDetail.ItemCode.Exists2", item.Code); } return(true); } } } } return(false); }