public string ValidateSumAssuredMaxMin(Guid? planPK, decimal? sumAssured) >>>> { >>>> // Get the Plan for the specified PlanPK >>>> Plan oPlan = new Plan(); >>>> oPlan.GetPlanByPlanPK((Guid)planPK); >>>> >>>> // Call the validate method in the Rules object >>>> return this.Rules.ValidateSumAssuredMaxMin(sumAssured, oPlan.Entity.MinSumAssured, oPlan.Entity.MaxSumAssured); >>>> >>>> }>>>>
public string ValidateSumAssuredMaxMin(Decimal? sumAssured, Decimal? min, Decimal? max) >>>> { >>>> string message = null; >>>> // check that the sum assured meets the min and max sum assured requirements >>>> if (min > (Decimal)sumAssured >>>> || max < (Decimal)sumAssured) >>>> { >>>> message = "Rider Sum Assured must be between " + min.ToString() + " and " + max.ToString(); >>>> this.AddErrorProviderBrokenRule("SumAssured", message); >>>> } >>>> return message; >>>> }>>>>
protected void txtRiderSumAssured_TextChanged(object sender, EventArgs e) >>>> { >>>> TextBox thisTextBox = (TextBox)sender; >>>> this.oPolicyRider.Rules.ClearAll(); >>>> GridViewRow gvr = (GridViewRow)thisTextBox.Parent.Parent; >>>> if (this.oPolicyRider.ValidateSumAssuredMaxMin((Guid)this.oPolicyRider.DataSet.Tables[0].Rows[gvr.RowIndex]["RiderFK"], decimal.Parse(thisTextBox.Text)) != null) >>>> { >>>> // show the message somehow >>>> } >>>> >>>> this.CalculateRiderPremium(true, gvr); >>>> this.SetFocus(gvr.Cells[3].Controls[1]); >>>> }