Exemplo n.º 1
0
        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");
            }
        }
Exemplo n.º 2
0
        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");
            }
        }
Exemplo n.º 3
0
 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);
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
        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");
                    }
                }
            }
        }
Exemplo n.º 5
0
    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.");
    }