Exemplo n.º 1
0
        private void txtRate_KeyPress(object sender, KeyPressEventArgs e)
        {
            TextBoxValidation val = new TextBoxValidation();

            val.onlyNumber(sender, e);
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != '.'))
            {
                e.Handled = true;
            }
        }
Exemplo n.º 2
0
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     if (NameTextBox.Text == string.Empty || NameTextBox.Text == spaces)
     {
         TextBoxValidation.Exception(NameTextBox);
     }
     else
     {
         TextBoxValidation.ReturnNormal(NameTextBox);
     }
 }
Exemplo n.º 3
0
        public static void GetSingleCtrlAutoBindingData(Control ctrl, object obj)
        {
            string ObjectName  = obj.GetType().Name;
            string bindingname = "";

            if (ctrl is AutoTextBox)
            {
                AutoTextBox textbox = ctrl as AutoTextBox;
                if (textbox.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        bindingname = textbox.BindingName;
                        SetProperty(bindingname, obj, textbox.Text);
                    }
                }
            }
            else
            if (ctrl is TextBoxValidation)
            {
                TextBoxValidation textbox = ctrl as TextBoxValidation;
                if (textbox.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        bindingname = textbox.BindingName;
                        SetProperty(bindingname, obj, textbox.Text);
                    }
                }
            }
            else
            if (ctrl is StatusTextbox)
            {
                StatusTextbox textbox = ctrl as StatusTextbox;
                if (textbox.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        bindingname = textbox.BindingName;
                        SetProperty(bindingname, obj, textbox.Text);
                    }
                }
            }
            else
            if (ctrl is AutoMetroTextBox)
            {
                AutoMetroTextBox textbox = ctrl as AutoMetroTextBox;
                if (textbox.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        bindingname = textbox.BindingName;
                        SetProperty(bindingname, obj, textbox.Text);
                    }
                }
            }
            else
            if (ctrl is AutoFileTextBox)
            {
                AutoFileTextBox textbox = ctrl as AutoFileTextBox;
                if (textbox.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        bindingname = textbox.BindingName;
                        SetProperty(bindingname, obj, textbox.FileName);
                    }
                }
            }
            else
            if (ctrl is AutoCombobox)
            {
                AutoCombobox combobox = ctrl as AutoCombobox;
                if (combobox.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(combobox.BindingName))
                    {
                        bindingname = combobox.BindingName;
                        SetProperty(bindingname, obj, combobox.SelectedValue);
                    }
                }
            }
            else
            if (ctrl is AutoSearchCombobox)
            {
                AutoSearchCombobox combobox = ctrl as AutoSearchCombobox;
                if (combobox.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(combobox.BindingName))
                    {
                        bindingname = combobox.BindingName;
                        if (combobox.GetSelectedText == true)
                        {
                            SetProperty(bindingname, obj, combobox.Text);
                        }
                        else
                        {
                            SetProperty(bindingname, obj, combobox.SelectedValue);
                        }
                    }
                }
            }

            else
            if (ctrl is AutoDatetime)
            {
                AutoDatetime dtp = ctrl as AutoDatetime;
                if (dtp.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(dtp.BindingName))
                    {
                        bindingname = dtp.BindingName;
                        SetProperty(bindingname, obj, dtp.Value);
                    }
                }
            }
            else
            if (ctrl is AutoXDatetime)
            {
                AutoXDatetime dtp = ctrl as AutoXDatetime;
                if (dtp.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(dtp.BindingName))
                    {
                        bindingname = dtp.BindingName;
                        SetProperty(bindingname, obj, dtp.DateTime);
                    }
                }
            }
            else
            if (ctrl is AutoPictureBox)
            {
                AutoPictureBox ptb = ctrl as AutoPictureBox;
                if (ptb.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(ptb.BindingName))
                    {
                        bindingname = ptb.BindingName;
                        SetProperty(bindingname, obj, ptb.PictureName);
                        if (!string.IsNullOrWhiteSpace(ptb.PictureOriginPath))
                        {
                            PictureUtility.SaveImg(ptb.PictureOriginPath);
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
        public static void GetAutoBindingData(Control controls, object obj)
        {
            string ObjectName  = obj.GetType().Name;
            string bindingname = "";

            foreach (Control ctrl in controls.Controls)
            {
                if (ctrl is AutoTextBox)
                {
                    AutoTextBox textbox = ctrl as AutoTextBox;
                    if (textbox.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        continue;
                    }
                    bindingname = textbox.BindingName;
                    SetProperty(bindingname, obj, textbox.Text);
                }
                else
                if (ctrl is TextBoxValidation)
                {
                    TextBoxValidation textbox = ctrl as TextBoxValidation;
                    if (textbox.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        continue;
                    }
                    bindingname = textbox.BindingName;
                    SetProperty(bindingname, obj, textbox.Text);
                }
                else
                if (ctrl is StatusTextbox)
                {
                    StatusTextbox textbox = ctrl as StatusTextbox;
                    if (textbox.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        continue;
                    }
                    bindingname = textbox.BindingName;
                    SetProperty(bindingname, obj, textbox.Text);
                }
                else
                if (ctrl is AutoMetroTextBox)
                {
                    AutoMetroTextBox textbox = ctrl as AutoMetroTextBox;
                    if (textbox.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        continue;
                    }
                    bindingname = textbox.BindingName;
                    SetProperty(bindingname, obj, textbox.Text);
                }
                else
                if (ctrl is AutoFileTextBox)
                {
                    AutoFileTextBox textbox = ctrl as AutoFileTextBox;
                    if (textbox.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        continue;
                    }
                    bindingname = textbox.BindingName;
                    string text = string.IsNullOrWhiteSpace(textbox.FileName) == true ? textbox.Text : textbox.FileName;
                    SetProperty(bindingname, obj, text);
                }
                else
                if (ctrl is AutoCombobox)
                {
                    AutoCombobox combobox = ctrl as AutoCombobox;
                    if (combobox.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(combobox.BindingName))
                    {
                        continue;
                    }
                    bindingname = combobox.BindingName;
                    SetProperty(bindingname, obj, combobox.SelectedValue);
                }
                else
                if (ctrl is AutoSearchCombobox)
                {
                    AutoSearchCombobox combobox = ctrl as AutoSearchCombobox;
                    if (combobox.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(combobox.BindingName))
                    {
                        continue;
                    }
                    bindingname = combobox.BindingName;
                    if (combobox.GetSelectedText == true)
                    {
                        SetProperty(bindingname, obj, combobox.Text);
                    }
                    else
                    {
                        SetProperty(bindingname, obj, combobox.SelectedValue);
                    }
                }

                else
                if (ctrl is AutoDatetime)
                {
                    AutoDatetime dtp = ctrl as AutoDatetime;
                    if (dtp.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(dtp.BindingName))
                    {
                        continue;
                    }
                    bindingname = dtp.BindingName;
                    SetProperty(bindingname, obj, dtp.Value);
                }
                else
                if (ctrl is AutoXDatetime)
                {
                    AutoXDatetime dtp = ctrl as AutoXDatetime;
                    if (dtp.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(dtp.BindingName))
                    {
                        continue;
                    }
                    bindingname = dtp.BindingName;
                    SetProperty(bindingname, obj, dtp.DateTime);
                }
                else
                if (ctrl is AutoPictureBox)
                {
                    AutoPictureBox ptb = ctrl as AutoPictureBox;
                    if (ptb.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(ptb.BindingName))
                    {
                        continue;
                    }
                    bindingname = ptb.BindingName;
                    SetProperty(bindingname, obj, ptb.PictureName);
                    if (!string.IsNullOrWhiteSpace(ptb.PictureOriginPath))
                    {
                        PictureUtility.SaveImg(ptb.PictureOriginPath);
                    }
                }
                if (ctrl is AutoMaterialCheckBox)
                {
                    AutoMaterialCheckBox cb = ctrl as AutoMaterialCheckBox;
                    if (cb.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(cb.BindingName))
                    {
                        continue;
                    }
                    bindingname = cb.BindingName;
                    SetProperty(bindingname, obj, cb.Checked);
                }
                if (ctrl.Controls.Count > 0)
                {
                    GetAutoBindingData(ctrl, obj);
                }
            }
        }
Exemplo n.º 5
0
        public static void SetSingleCtrlAutoBindingData(Control ctrl, object obj)
        {
            if (obj == null)
            {
                return;
            }
            string ObjectName  = obj.GetType().Name;
            string bindingname = "";
            object val         = null;

            if (ctrl is AutoTextBox)
            {
                AutoTextBox textbox = ctrl as AutoTextBox;
                if (textbox.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        bindingname  = textbox.BindingName;
                        val          = GetPropertyValue(bindingname, obj);
                        textbox.Text = val != null?val.ToString() : "";
                    }
                }
            }
            else
            if (ctrl is TextBoxValidation)
            {
                TextBoxValidation textbox = ctrl as TextBoxValidation;
                if (textbox.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        bindingname  = textbox.BindingName;
                        val          = GetPropertyValue(bindingname, obj);
                        textbox.Text = val != null?val.ToString() : "";
                    }
                }
            }
            else
            if (ctrl is StatusTextbox)
            {
                StatusTextbox textbox = ctrl as StatusTextbox;
                if (textbox.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        bindingname  = textbox.BindingName;
                        val          = GetPropertyValue(bindingname, obj);
                        textbox.Text = val != null?val.ToString() : "";
                    }
                }
            }
            else
            if (ctrl is AutoMetroTextBox)
            {
                AutoMetroTextBox textbox = ctrl as AutoMetroTextBox;
                if (textbox.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        bindingname  = textbox.BindingName;
                        val          = GetPropertyValue(bindingname, obj);
                        textbox.Text = val != null?val.ToString() : "";
                    }
                }
            }
            else
            if (ctrl is AutoFileTextBox)
            {
                AutoFileTextBox textbox = ctrl as AutoFileTextBox;
                if (textbox.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        bindingname  = textbox.BindingName;
                        val          = GetPropertyValue(bindingname, obj);
                        textbox.Text = val != null?val.ToString() : "";

                        textbox.FileName = textbox.Text;
                    }
                }
            }
            else
            if (ctrl is AutoDatetime)
            {
                AutoDatetime dtp = ctrl as AutoDatetime;
                if (dtp.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(dtp.BindingName))
                    {
                        bindingname = dtp.BindingName;
                        val         = GetPropertyValue(bindingname, obj);
                        dtp.Value   = val != null?Convert.ToDateTime(val) : UtilityFunction.minDate;
                    }
                }
            }
            else
            if (ctrl is AutoXDatetime)
            {
                AutoXDatetime dtp = ctrl as AutoXDatetime;
                if (dtp.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(dtp.BindingName))
                    {
                        bindingname  = dtp.BindingName;
                        val          = GetPropertyValue(bindingname, obj);
                        dtp.DateTime = val != null?Convert.ToDateTime(val) : UtilityFunction.minDate;
                    }
                }
            }
            else
            if (ctrl is AutoPictureBox)
            {
                AutoPictureBox ptb = ctrl as AutoPictureBox;
                if (ptb.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(ptb.BindingName))
                    {
                        bindingname     = ptb.BindingName;
                        val             = GetPropertyValue(bindingname, obj);
                        ptb.PictureName = val != null?val.ToString() : "";

                        ptb.Image = PictureUtility.GetImg(ptb.PictureName);
                        if (ptb.Image == null)
                        {
                            ptb.Image = TmTech_v1.Properties.Resources.unknow;
                        }
                        ptb.SizeMode = PictureBoxSizeMode.StretchImage;
                    }
                }
            }
            else
            if (ctrl is AutoCombobox)
            {
                AutoCombobox cbb = ctrl as AutoCombobox;
                if (cbb.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(cbb.BindingName))
                    {
                        bindingname       = cbb.BindingName;
                        val               = GetPropertyValue(bindingname, obj);
                        cbb.SelectedValue = val != null?Convert.ToInt32(val) : 0;
                    }
                }
            }
            else
            if (ctrl is AutoSearchCombobox)
            {
                AutoSearchCombobox cbb = ctrl as AutoSearchCombobox;
                if (cbb.BindingFor == ObjectName)
                {
                    if (!string.IsNullOrWhiteSpace(cbb.BindingName))
                    {
                        bindingname = cbb.BindingName;
                        val         = GetPropertyValue(bindingname, obj);
                        if (cbb.GetSelectedText == true)
                        {
                            cbb.Text = val != null?val.ToString() : "";
                        }
                        else
                        {
                            cbb.SelectedValue = val != null?Convert.ToInt32(val) : 0;
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        public static void SetAutoBindingData(Control controls, object obj)
        {
            if (obj == null)
            {
                return;
            }
            string ObjectName  = obj.GetType().Name;
            string bindingname = "";
            object val         = null;

            foreach (Control ctrl in controls.Controls)
            {
                if (ctrl is TextBoxValidation)
                {
                    TextBoxValidation textbox = ctrl as TextBoxValidation;
                    if (textbox.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        continue;
                    }
                    bindingname  = textbox.BindingName;
                    val          = GetPropertyValue(bindingname, obj);
                    textbox.Text = val != null?val.ToString() : "";
                }
                else if (ctrl is StatusTextbox)
                {
                    StatusTextbox textbox = ctrl as StatusTextbox;
                    if (textbox.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        continue;
                    }
                    bindingname  = textbox.BindingName;
                    val          = GetPropertyValue(bindingname, obj);
                    textbox.Text = val != null?val.ToString() : "";

                    if (!string.IsNullOrWhiteSpace(textbox.StatusFieldName))
                    {
                        var statusValue = GetPropertyValue(textbox.StatusFieldName, obj);
                        int status      = statusValue != null?Convert.ToInt32(statusValue) : 0;

                        textbox.Display(status);
                    }
                }
                else if (ctrl is AutoTextBox)
                {
                    AutoTextBox textbox = ctrl as AutoTextBox;
                    if (textbox.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        continue;
                    }
                    bindingname  = textbox.BindingName;
                    val          = GetPropertyValue(bindingname, obj);
                    textbox.Text = val != null?val.ToString() : "";
                }

                else if (ctrl is AutoMetroTextBox)
                {
                    AutoMetroTextBox textbox = ctrl as AutoMetroTextBox;
                    if (textbox.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        continue;
                    }
                    bindingname  = textbox.BindingName;
                    val          = GetPropertyValue(bindingname, obj);
                    textbox.Text = val != null?val.ToString() : "";
                }
                else if (ctrl is AutoFileTextBox)
                {
                    AutoFileTextBox textbox = ctrl as AutoFileTextBox;
                    if (textbox.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(textbox.BindingName))
                    {
                        continue;
                    }
                    bindingname  = textbox.BindingName;
                    val          = GetPropertyValue(bindingname, obj);
                    textbox.Text = val != null?val.ToString() : "";

                    if (FileUtility.PathIsImage(textbox.Text))
                    {
                        textbox.FilePath = PictureUtility.getImgLocation(textbox.Text);
                    }
                    textbox.FileName = textbox.Text;
                }
                else if (ctrl is AutoDatetime)
                {
                    AutoDatetime dtp = ctrl as AutoDatetime;
                    if (dtp.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(dtp.BindingName))
                    {
                        continue;
                    }
                    bindingname = dtp.BindingName;
                    val         = GetPropertyValue(bindingname, obj);
                    dtp.Value   = val != null?Convert.ToDateTime(val) : UtilityFunction.minDate;
                }
                else if (ctrl is AutoXDatetime)
                {
                    AutoXDatetime dtp = ctrl as AutoXDatetime;
                    if (dtp.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(dtp.BindingName))
                    {
                        continue;
                    }
                    bindingname  = dtp.BindingName;
                    val          = GetPropertyValue(bindingname, obj);
                    dtp.DateTime = val != null?Convert.ToDateTime(val) : UtilityFunction.minDate;
                }
                else if (ctrl is AutoPictureBox)
                {
                    AutoPictureBox ptb = ctrl as AutoPictureBox;
                    if (ptb.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(ptb.BindingName))
                    {
                        continue;
                    }
                    bindingname     = ptb.BindingName;
                    val             = GetPropertyValue(bindingname, obj);
                    ptb.PictureName = val != null?val.ToString() : "";

                    ptb.Image = PictureUtility.GetImg(ptb.PictureName);
                    if (ptb.Image == null)
                    {
                        ptb.Image = TmTech_v1.Properties.Resources.unknow;
                    }
                    ptb.SizeMode = PictureBoxSizeMode.StretchImage;
                }
                else if (ctrl is AutoCombobox)
                {
                    AutoCombobox cbb = ctrl as AutoCombobox;
                    if (cbb.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(cbb.BindingName))
                    {
                        continue;
                    }
                    bindingname       = cbb.BindingName;
                    val               = GetPropertyValue(bindingname, obj);
                    cbb.SelectedValue = val != null?Convert.ToInt32(val) : 0;
                }
                else if (ctrl is AutoSearchCombobox)
                {
                    AutoSearchCombobox cbb = ctrl as AutoSearchCombobox;
                    if (cbb.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(cbb.BindingName))
                    {
                        continue;
                    }
                    bindingname = cbb.BindingName;
                    val         = GetPropertyValue(bindingname, obj);
                    if (cbb.GetSelectedText == true)
                    {
                        cbb.Text = val != null?val.ToString() : "";
                    }
                    else
                    {
                        cbb.SelectedValue = val != null?Convert.ToInt32(val) : 0;
                    }
                }
                else if (ctrl is AutoMaterialCheckBox)
                {
                    AutoMaterialCheckBox cb = ctrl as AutoMaterialCheckBox;
                    if (cb.BindingFor != ObjectName)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(cb.BindingName))
                    {
                        continue;
                    }
                    bindingname = cb.BindingName;
                    val         = GetPropertyValue(bindingname, obj);
                    cb.Checked  = val == null ? false : Convert.ToBoolean(val);
                }
                if (ctrl.Controls.Count > 0)
                {
                    SetAutoBindingData(ctrl, obj);
                }
            }
        }
Exemplo n.º 7
0
        private void txtAmt_KeyPress(object sender, KeyPressEventArgs e)
        {
            TextBoxValidation val = new TextBoxValidation();

            val.onlyNumber(sender, e);
        }
Exemplo n.º 8
0
        private void cmbLedgerDR_KeyPress(object sender, KeyPressEventArgs e)
        {
            TextBoxValidation val = new TextBoxValidation();

            val.textOnly(sender, e);
        }
Exemplo n.º 9
0
        private void txtGroupName_KeyPress(object sender, KeyPressEventArgs e)
        {
            TextBoxValidation val = new TextBoxValidation();

            val.textOnly(sender, e);
        }
Exemplo n.º 10
0
        private static bool FieldNotAllowNull2(Control control)
        {
            if (control is TextBoxPassword)
            {
                if (control.Name.ToLower().Contains("txtrepassword"))
                {
                    TextBoxPassword objPassword  = control.FindForm().Controls.Find("txtPassword", true).FirstOrDefault() as TextBoxPassword;
                    TextBoxPassword objRPassword = (TextBoxPassword)control;
                    if (!objPassword.Text.Equals(objRPassword.Text))
                    {
                        objRPassword.Text      = "password not match";
                        objPassword.ForeColor  = Color.Red;
                        objRPassword.ForeColor = Color.Red;
                        isvalid = false;
                    }
                    else
                    {
                        objPassword.ForeColor  = Color.Black;
                        objRPassword.ForeColor = Color.Black;
                    }
                }
            }
            else if (control is TextboxPhone)
            {
                var txtTextboxPhone = (TextboxPhone)control;

                if (!IsPhoneNumber(txtTextboxPhone.Text))
                {
                    txtTextboxPhone.Text      = Validation.PhoneNotFormat;
                    txtTextboxPhone.ForeColor = Color.Red;
                }
                else
                {
                    txtTextboxPhone.ForeColor = Color.Black;
                }
            }
            else if (control is TextBoxValidation)
            {
                TextBoxValidation txtBoxValidation = (TextBoxValidation)control;

                if (txtBoxValidation.AllowNull == false)
                {
                    if (string.IsNullOrWhiteSpace(txtBoxValidation.Text) && txtBoxValidation.ForeColor != Color.Black)
                    {
                        txtBoxValidation.Text      = "null";
                        txtBoxValidation.ForeColor = Color.Red;
                        isvalid = false;
                    }
                    else
                    {
                        txtBoxValidation.ForeColor = Color.Black;
                    }
                }
            }



            else if (control is TextboxEmail)
            {
                TextboxEmail obj = (TextboxEmail)control;
                if (obj.Text.Length > 0)
                {
                    if (UtilityFunction.IsValidEmailAddress(obj.Text))
                    {
                        obj.ForeColor = Color.Black;
                    }
                    else
                    {
                        obj.ForeColor = Color.Red;
                        isvalid       = false;
                    }
                }
            }

            if (control.HasChildren)
            {
                foreach (Control child in control.Controls)
                {
                    FieldNotAllowNull2(child);
                }
            }
            return(isvalid);
        }