/// <summary> /// Custom validation method to validate the quantity /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="T:ValidationFramework.CustomValidationEventArgs"/> instance containing the event data.</param> public void ValidateQuantity(object sender, CustomValidationEventArgs e) { // Seed the message e.ErrorMessage = string.Format("The line quantity cannot be greater than the original quantity of {0}.", OriginalQuantity); // Specify if valid, ensure that the current quantity if less than or equal to the original opco quantity e.IsValid = (Null.IsNull(OriginalQuantity) || (!Null.IsNull(OriginalQuantity) && Quantity <= OriginalQuantity)); }
/// <summary> /// 查询按钮按下 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ruleInquiry_CustomValidationMethod(object sender, CustomValidationEventArgs e) { this.Cursor = Cursors.WaitCursor; CardVo cardvo = new CardVo(); cardvo.IFacCd = this.atxtFactoryCd.Text; cardvo.IDispItemCd = this.atxtDispItemCd.Text; cardvo.IDispItemRev = this.atxtDispItemRev.Text; cardvo.IDlCd = this.atxtCustomerCd.Text; cardvo.IDrwNo = this.txtDrwNo.Text; cardvo.IItemCls = this.clsddlItemCls.Selectedvalue; cardvo.IItemType = this.atxtItemType.Text; cardvo.IMakerCd = this.atxtMakerCd.Text; cardvo.IMntCls = this.clsddlMntCls.Selectedvalue; cardvo.IModel = this.txtModel.Text; cardvo.IQryMtrl = this.txtQryMtrl.Text; cardvo.ISeiban = this.txtSeiban.Text; cardvo.ISpec = this.txtSpec.Text; IAction_MaterialSearch action = ComponentLocator.Instance().Resolve <IAction_MaterialSearch>(); int count = action.GetPmMsDetail(this.FrmMaterialSearch_pagerGridView1, cardvo); if (count == 0) { e.IsValid = false; } else { e.IsValid = true; } this.Cursor = Cursors.Default; }
/// <summary> /// Custom validation method to validate sales branch location /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="T:ValidationFramework.CustomValidationEventArgs"/> instance containing the event data.</param> public void ValidLoadCategoryCode(object sender, CustomValidationEventArgs e) { // Seed the message e.ErrorMessage = string.Format("Load Category Code '{0}' is not a valid Load Category Code.", this.LoadCategoryCode); // If a sales branch code was specified see if it's valid e.IsValid = (null != this.loadCategory && -1 != this.loadCategory.Id); }
/// <summary> /// Group2各种Check /// </summary> private void CheckG2(object sender, CustomValidationEventArgs e) { e.IsValid = true; if (pgvRateMs.RowCount == 0 || pgvRateMs.SelectedRowIndex < 0) { e.IsValid = false; } }
/// <summary> /// 工厂代码存在Check /// </summary> private void ruleFactoryExist_CustomValidationMethod(object sender, CustomValidationEventArgs e) { CheckFactory check = new CheckFactory(); this.lblFactoryNm.Text = ""; TFactoryMs vo = check.Check01Vo(this.atxtFactoryCd.Text); if (vo != null && !String.IsNullOrEmpty(vo.IFacCd)) { e.IsValid = true; this.lblFactoryNm.Text = vo.IFacArgDesc; } else { e.IsValid = false; } }
/// <summary> /// 部门代码存在Check /// </summary> private void ruleDepartExit_CustomValidationMethod(object sender, CustomValidationEventArgs e) { CheckSection check = new CheckSection(); e.IsValid = false; this.lblDepartNM.Text = ""; if (!String.IsNullOrEmpty(this.txtDepart.Text)) { TSectionMs vo = check.Check01Vo(this.txtCompany.Text, this.txtDepart.Text); if (vo != null && !String.IsNullOrEmpty(vo.Id.ISectionCd)) { e.IsValid = true; this.lblDepartNM.Text = vo.ISectionDesc; } } else { e.IsValid = true; } }
/// <summary> /// 制造商Check "72" /// </summary> private void ruleMakerExist_CustomValidationMethod(object sender, CustomValidationEventArgs e) { if (string.IsNullOrEmpty(this.atxtMakerCd.Text)) { return; } CheckCls check = new CheckCls(); this.lblMakerNm.Text = ""; CClsDetailNoAR vo = check.Check01Vo(LangUtils.GetCurrentLanguage(), "72", this.atxtMakerCd.Text); if (vo != null && !String.IsNullOrEmpty(vo.IClsDetailCd)) { e.IsValid = true; this.lblMakerNm.Text = vo.IClsDetailDesc; } else { e.IsValid = false; } }
/// <summary> /// 客户Check /// </summary> private void ruleCustomerExist_CustomValidationMethod(object sender, CustomValidationEventArgs e) { if (string.IsNullOrEmpty(this.atxtCustomerCd.Text)) { return; } CheckTrade check = new CheckTrade(); this.lblCustomer.Text = ""; TTradeMs vo = check.Check01Vo(this.uservo.CompanyCondition.ICompanyCd, this.atxtCustomerCd.Text); if (vo != null && vo.Id != null) { e.IsValid = true; this.lblItemType.Text = vo.IDlArgDesc; } else { e.IsValid = false; } }
/// <summary> /// State ComboBox I've manually setup the validation rule while all other /// controls I setup validation directly in the control property window. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void vr_CustomValidationMethod(object sender, CustomValidationEventArgs e) { e.IsValid = !e.Value.ToString().Equals("Select"); e.ErrorMessage = "Needs a valid state"; }
/// <summary> /// Custom validation method to compare the warehouses and check they are not the same /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="T:ValidationFramework.CustomValidationEventArgs"/> instance containing the event data.</param> public void CompareWarehouses(object sender, CustomValidationEventArgs e) { e.IsValid = (SourceWarehouseId != DestinationWarehouseId); e.ErrorMessage = "The Source and Destination Warehouses cannot be the same."; }
/// <summary> /// 工厂代码存在Check /// </summary> private void ruleFactoryExit_CustomValidationMethod(object sender, CustomValidationEventArgs e) { CheckFactory check = new CheckFactory(); e.IsValid = check.Check01Bool(this.txtFactory.Text); }
/// <summary> /// 企业代码存在Check /// </summary> private void ruleCompanyExit_CustomValidationMethod(object sender, CustomValidationEventArgs e) { }