protected override object GetEditObject() { if (_facade == null) { _facade = new MOModel.ItemFacade(base.DataProvider); } BenQGuru.eMES.Domain.MOModel.Material merterial = this._facade.CreateNewMaterial(); merterial = _facade.GetMaterial(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMaterialNO.Text, 40))) as BenQGuru.eMES.Domain.MOModel.Material; merterial.MCONTROLTYPE = FormatHelper.CleanString(this.drpMaterialType.SelectedValue, 40); merterial.Validity = Int32.Parse(FormatHelper.CleanString(this.txtMaterialValidity.Text, 100)); merterial.MaintainUser = this.GetUserCode(); return(merterial); }
private bool checkItemCode() { bool result = true; this._ItemFacade = new ItemFacade(this.DataProvider); Domain.MOModel.Material material = (Domain.MOModel.Material)_ItemFacade.GetMaterial(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeEdit.Text)), int.Parse(this.DropDownListOrg.SelectedValue)); if (material == null) { result = false; } return(result); }
private void ValidateItems() { if (items == null || items.Length == 0) { return; } CultureInfo culture = new System.Globalization.CultureInfo("en-US"); for (int i = 0; i < items.Length; i++) { string result = string.Empty; object item = items[i]; this._ItemFacade = new ItemFacade(this.DataProvider); string itemCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(GetFieldValue(items[i], "ITEMCODE"))); Int32 orgID = GlobalVariables.CurrentOrganizations.First().OrganizationID; object obj = _ItemFacade.GetMaterial(itemCode, orgID); if (obj == null) { result = "物料代码不存在"; } else { this._Facade = new MaterialFacade(this.DataProvider); object objExit = _Facade.GetMaterialReqStd(itemCode, orgID); if (objExit == null) { result = "Insert"; } } string requestQty = GetFieldValue(items[i], "RequestQTY"); if (requestQty != string.Empty) { try { int numRequestQty = int.Parse(requestQty); } catch { result = string.Format("{0};数量必须是数字", result); } } if (result != string.Empty && result != null) { int j = result.IndexOf(";"); if (j == 0) { result = result.Substring(1, result.Length - 1); } } if (result == string.Empty) { result = "OK"; } SetFieldValue(item, "EAttribute1", result); } }