public static void validate(PageErrors errors, string field, object v) { if (v == null || v.Equals("")) { return; } if (v.GetType() != typeof(string)) { return; } string s = (string)v; s = s.Trim(); double val = 0; if (double.TryParse(s, out val)) { if (val > Double.MaxValue) { errors.addError(field, "validate.toobig"); } if (val < Double.MinValue) { errors.addError(field, "validate.toosmall"); } } else { errors.addError(field, "validate.double"); } }
public override void validate(PageErrors errors, DBField field, Hashtable valueList) { string fieldName = field.name; bool isValidFail = false; if (valueList.ContainsKey(fieldName)) { object value = valueList[fieldName]; if (value == null) { isValidFail = true; } else { string stringValue = value.ToString().Trim(); if (stringValue.Length == 0 || stringValue.Equals(Common.NULL_STRING)) { isValidFail = true; } } } else { isValidFail = false; } if (isValidFail) { errors.addError(fieldName, "validate.required"); } }
public override void validate(PageErrors errors, DBField field, System.Collections.Hashtable valueList) { if (maxLength > 0) { object v = valueList[field.name]; if (v != null) { if (v is string) { string s = (string)v; if (s.Length > maxLength) { errors.addError(field.name, "validate.maxlength", maxLength); } } } } }
public override void validate(PageErrors errors, DBField field, Hashtable valueList) { object v = valueList[field.name]; if (v != null) { string s = v.ToString().Trim(); int vv = 0; if (Int32.TryParse(s, out vv)) { if (vv > max || vv < min) { errors.addError(field.name, "validate.intrange"); } } } }
protected void btnPostToESS_Click(object sender, EventArgs e) { HROne.DataAccess.PageErrors errors = HROne.DataAccess.PageErrors.getErrors(null, Page.Master); errors.clear(); foreach (RepeaterItem i in Repeater.Items) { CheckBox cb = (CheckBox)i.FindControl("ItemSelect"); ETaxEmp o = (ETaxEmp)ETaxEmp.db.createObject(); WebFormUtils.GetKeys(db, o, cb); if (cb.Checked) { o.TaxEmpIsReleasePrintoutToESS = true; } else { o.TaxEmpIsReleasePrintoutToESS = false; } ETaxEmp.db.update(dbConn, o); } errors.addError("Taxation Report is released to ESS."); }