protected override void UpdateDomainObject(object domainObject) { if (_facade == null) { _facade = new FacadeFactory(base.DataProvider).CreateItemFacade(); } MOFacade moFacade = new MOFacade(base.DataProvider); if (moFacade.CheckItemCodeUsed(ItemCode)) { WebInfoPublish.Publish(this, "$ERROR_ITEM_USE", this.languageComponent1); return; } this._facade.UpdateItemLocation((ItemLocation)domainObject); }
protected override void DeleteDomainObjects(ArrayList domainObjects) { if (_facade == null) { _facade = new FacadeFactory(base.DataProvider).CreateItemFacade(); } MOFacade moFacade = new MOFacade(base.DataProvider); if (moFacade.CheckItemCodeUsed(ItemCode)) { WebInfoPublish.Publish(this, "$ERROR_ITEM_USE", this.languageComponent1); return; } this._facade.DeleteItemLoaction((ItemLocation[])domainObjects.ToArray(typeof(ItemLocation))); }
private void SetEditObject(object obj) { if (_modelFacade == null) { _modelFacade = new FacadeFactory(base.DataProvider).CreateModelFacade(); } if (obj == null) { this.txtItemCodeEdit.Text = string.Empty; this.txtItemDescEdit.Text = string.Empty; this.drpItemTypeEdit.SelectedIndex = 0; this.txtItemNameEdit.Text = string.Empty; // this.txtItemVersionEdit.Text=string.Empty; this.txtItemUOMEdit.Text = string.Empty; this.txtConfig.Text = string.Empty; this.txtVolumnEdit.Text = String.Empty; this.txtCartonQty.Text = String.Empty; this.txtMaxElectricCurrent.Text = "0"; this.txtMinElectricCurrent.Text = "0"; txtVolumnEdit.Text = "0"; this.DropDownListOrg.SelectedIndex = 0; this.txtOPCodeEdit.Text = ""; this.txtLotSizeEdit.Text = ""; this.txtPcbAcountEdit.Text = ""; this.TextboxItemProductCodeEdit.Text = ""; this.CheckboxNeedCheckCartonEdit.Checked = false; this.CheckboxNeedCheckComApp.Checked = false; txtPcbAcountEdit.Text = "1"; this.txtBurnUseMinutesEdit.Text = "0"; return; } this.txtItemCodeEdit.Text = ((Item)obj).ItemCode.ToString(); this.txtItemDescEdit.Text = ((Item)obj).ItemDescription.ToString(); try { this.drpItemTypeEdit.SelectedValue = ((Item)obj).ItemType.ToString(); } catch { this.drpItemTypeEdit.SelectedIndex = 0; } this.txtItemNameEdit.Text = ((Item)obj).ItemName.ToString(); // this.txtItemVersionEdit.Text = ((Item)obj).ItemVersion.ToString(); this.txtItemUOMEdit.Text = ((Item)obj).ItemUOM.ToString(); this.txtVolumnEdit.Text = ((Item)obj).ItemBurnInQty.ToString("##.##"); this.txtCartonQty.Text = ((Item)obj).ItemCartonQty.ToString("##.##"); this.txtConfig.Text = ((Item)obj).ItemConfigration; this.TextboxItemProductCodeEdit.Text = ((Item)obj).ItemProductCode; this.CheckboxNeedCheckCartonEdit.Checked = (((Item)obj).NeedCheckCarton == FormatHelper.TRUE_STRING); this.CheckboxNeedCheckComApp.Checked = (((Item)obj).NeedCheckAccessory == FormatHelper.TRUE_STRING); this.txtMaxElectricCurrent.Text = ((Item)obj).ElectricCurrentMaxValue.ToString(); this.txtMinElectricCurrent.Text = ((Item)obj).ElectricCurrentMinValue.ToString(); //Add by Terry 2010-10-29 this.txtPcbAcountEdit.Text = ((Item)obj).PcbaCount.ToString(); try { this.DropDownListOrg.SelectedValue = ((Item)obj).OrganizationID.ToString(); } catch { this.DropDownListOrg.SelectedIndex = 0; } object[] oldItems = this._modelFacade.GetModel2ItemByItemCode(this.txtItemCodeEdit.Text); if (oldItems != null && oldItems.Length > 0) { this.drpModelEdit.SelectedValue = ((Model2Item)oldItems[0]).ModelCode; } MOFacade moFacade = new MOFacade(base.DataProvider); if (moFacade.CheckItemCodeUsed(((Item)obj).ItemCode)) { setDropDownListEnabled(false); } else { setDropDownListEnabled(true); } this.txtOPCodeEdit.Text = ((Item)obj).CheckItemOP; this.txtLotSizeEdit.Text = ((Item)obj).LotSize.ToString(); this.txtBurnUseMinutesEdit.Text = ((Item)obj).BurnUseMinutes.ToString(); }
protected void cmdSave_ServerClick(object sender, System.EventArgs e) { PageCheckManager checkManager = new PageCheckManager(); checkManager.Add(new LengthCheck(lblItemModelCodeEdit, drpModelEdit, Int32.MaxValue, true)); checkManager.Add(new LengthCheck(lblOrgEdit, DropDownListOrg, 8, true)); //修改可以输入0 Terry 2010-10-29 if (txtOPCodeEdit.Text.Trim() == string.Empty) { checkManager.Add(new NumberCheck(this.lblLotSizeEdit, this.txtLotSizeEdit, 0, int.MaxValue, true)); } else { checkManager.Add(new NumberCheck(this.lblLotSizeEdit, this.txtLotSizeEdit, 1, int.MaxValue, true)); } //可以为空 Terry 2010-10-29 checkManager.Add(new LengthCheck(this.lblCheckOPCodeEdit, this.txtOPCodeEdit, 40, false)); checkManager.Add(new LengthCheck(this.lblItemProductCodeEdit, this.TextboxItemProductCodeEdit, 100, false)); checkManager.Add(new NumberCheck(this.lblPcbAcountEdit, this.txtPcbAcountEdit, 1, int.MaxValue, true)); if (!checkManager.Check()) { WebInfoPublish.Publish(this, checkManager.CheckMessage, this.languageComponent1); return; } if (_itemFacade == null) { _itemFacade = new FacadeFactory(base.DataProvider).CreateItemFacade(); } object item = this.GetEditObject(); if (item != null) { //Added by hi1/venus.feng on 20080717 for Hisense Version //Check OP //Modify by Terry 2010-10-29 (not check op) if (this.txtOPCodeEdit.Text.Trim() != string.Empty) { BaseModelFacade baseModel = new BaseModelFacade(this.DataProvider); object op = baseModel.GetOperation(FormatHelper.PKCapitalFormat(this.txtOPCodeEdit.Text.Trim())); if (op == null) { throw new Exception("$Error_CS_Current_OP_Not_Exist"); } //Check OP is in ItemRoute2OP ItemFacade itemFacade = new ItemFacade(this.DataProvider); if (itemFacade.IsOPInItemOP(((Item)item).ItemCode, ((Item)item).OrganizationID, ((Item)item).CheckItemOP) == false) { throw new Exception("$Error_OPIsNotInItemOPList"); } } //Check Item MO in processing MOFacade moFacade = new MOFacade(this.DataProvider); if (moFacade.CheckItemCodeUsed(((Item)item).ItemCode) == true) { throw new Exception("$ERROR_ITEM_USE"); } // End added this._itemFacade.UpdateItem((Item)item, this.drpModelEdit.SelectedValue.ToUpper()); this.gridHelper.GridBind(this.pagerToolBar.PageIndex, this.pagerToolBar.PageSize); this.RequestData(); this.buttonHelper.PageActionStatusHandle(PageActionType.Save); this.drpModelEdit.SelectedIndex = 0; } }