Beispiel #1
0
        /// <summary>
        /// Validate all defined criteria controls
        /// </summary>
        /// <returns>True when all controls is valid</returns>
        public bool ValidateControl()
        {
            bool isValid = true;

            if (controlsToValidate != null && controlsToValidate.Length > 0)
            {
                foreach (Control ctrl in controlsToValidate)
                {
                    if (ctrl is rSearchTextBox)
                    {
                        rSearchTextBox txt = ctrl as rSearchTextBox;
                        if (!txt.ValidateControl())
                        {
                            isValid = false;
                        }
                    }
                    else if (ctrl is rNumericTextBox)
                    {
                        rNumericTextBox txt = ctrl as rNumericTextBox;
                        if (!txt.ValidateControl())
                        {
                            isValid = false;
                        }
                    }
                    else if (ctrl is rTextBox)
                    {
                        rTextBox txt = ctrl as rTextBox;
                        if (!txt.ValidateControl())
                        {
                            isValid = false;
                        }
                    }
                    else if (ctrl is rComboBox)
                    {
                        rComboBox cbo = ctrl as rComboBox;
                        if (!cbo.ValidateControl())
                        {
                            isValid = false;
                        }
                    }
                    else if (ctrl is rMaskedTextBox)
                    {
                        rMaskedTextBox txt = ctrl as rMaskedTextBox;
                        if (!txt.ValidateControl())
                        {
                            isValid = false;
                        }
                    }
                    else
                    {
                        isValid = false;
                    }
                }
            }
            return(isValid);
        }
Beispiel #2
0
 public void ClearControls(params Control[] Ctrls)
 {
     try
     {
         if (Ctrls != null && Ctrls.Length > 0)
         {
             foreach (Control ctrl in Ctrls)
             {
                 if (ctrl is rSearchTextBox)
                 {
                     rSearchTextBox txt = ctrl as rSearchTextBox;
                     txt.IntValue    = null;
                     txt.StringValue = null;
                     txt.Text        = null;
                 }
                 else if (ctrl is rNumericTextBox)
                 {
                     rNumericTextBox txt = ctrl as rNumericTextBox;
                     txt.NullableIntValue = null;
                     txt.DecimalValue     = null;
                 }
                 else if (ctrl is rDateTextBox)
                 {
                     rDateTextBox txt = ctrl as rDateTextBox;
                     txt.DateValue = null;
                 }
                 else if (ctrl is rTimeTextBox)
                 {
                     rTimeTextBox txt = ctrl as rTimeTextBox;
                     txt.TimeValue = null;
                 }
                 else if (ctrl is rTextBox)
                 {
                     rTextBox txt = ctrl as rTextBox;
                     txt.Text = null;
                 }
                 else if (ctrl is rComboBox)
                 {
                     rComboBox cbo = ctrl as rComboBox;
                     cbo.NullableIntValue = null;
                     cbo.StringValue      = null;
                 }
                 else if (ctrl is rMaskedTextBox)
                 {
                     rMaskedTextBox txt = ctrl as rMaskedTextBox;
                     txt.Text = null;
                 }
                 else if (ctrl is rDataGridView)
                 {
                     rDataGridView gv = ctrl as rDataGridView;
                     gv.DataSource = null;
                     gv.Rows.Clear();
                 }
                 else if (ctrl is CheckBox)
                 {
                     CheckBox chk = ctrl as CheckBox;
                     chk.Checked = false;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }