Пример #1
0
	public MainForm ()
	{
		// 
		// _textBox
		// 
		_textBox = new TextBox ();
		_textBox.Location = new Point (8, 8);
		_textBox.Size = new Size (210, 20);
		// 
		// _errorProvider
		// 
		_errorProvider = new ErrorProvider ();
		_errorProvider.SetIconAlignment (_textBox, ErrorIconAlignment.MiddleRight);
		_errorProvider.SetIconPadding (_textBox, 2);
		_errorProvider.ContainerControl = this;
		Controls.Add (_textBox);
		// 
		// MainForm
		// 
		ClientSize = new Size (240, 50);
		Location = new Point (280, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #329714";
		Load += new EventHandler (MainForm_Load);
	}
Пример #2
0
        public static string validateTime(Control control, ErrorProvider eprWarning, ErrorProvider eprError)
        {
            Match match = Regex.Match(control.Text, @"\d\d:\d\d");

            eprWarning.SetIconPadding(control, 5);
            eprError.SetIconPadding(control, 5);

            //Run the validation
            if (validateEmptyField(control, eprWarning))
            {
                // Here we check the regex match
                if (!match.Success)
                {
                    eprError.SetIconAlignment(control, ErrorIconAlignment.MiddleRight);
                    eprError.SetError(control, "Time doesn't comform to the format hh:mm");
                    return("Error");
                }
                else
                {
                    eprError.SetError(control, "");
                    return("Valid");
                }
            }
            else
            {
                eprError.SetError(control, "");
                validateEmptyField(control, eprWarning);
                return("Blank");
            }
        }
Пример #3
0
        public static string validateMapSummary(Control control, ErrorProvider eprWarning, ErrorProvider eprError)
        {
            string layoutMapSummary = string.Empty;
            Dictionary <string, string> dictMapValues = MapAction.PageLayoutProperties.getLayoutTextElements(_pMxDoc, targetMapFrame);

            if (dictMapValues.ContainsKey("summary"))
            {
                layoutMapSummary = dictMapValues["summary"];
            }

            eprWarning.SetIconPadding(control, 5);
            eprError.SetIconPadding(control, 5);

            if (validateEmptyField(control, eprWarning))
            {
                if (control.Text.Trim() != layoutMapSummary && control.Text != string.Empty)
                {
                    eprError.SetIconAlignment(control, ErrorIconAlignment.MiddleRight);
                    eprError.SetError(control, "Text differs from page layout 'summary' element value");
                    return("Error");
                }
                else
                {
                    eprError.SetError(control, "");
                    return("Valid");
                }
            }
            else
            {
                eprError.Dispose();
                validateEmptyField(control, eprWarning);
                return("Blank");
            }
        }
Пример #4
0
        public static string validatePaperSize(Control control, ErrorProvider eprWarning, ErrorProvider eprError)
        {
            eprWarning.SetIconPadding(control, 5);
            eprError.SetIconPadding(control, 5);
            string automatedValue = MapAction.PageLayoutProperties.getPageSize(_pMxDoc, targetMapFrame);

            if (validateEmptyField(control, eprWarning))
            {
                if (control.Text.Trim() != automatedValue && control.Text != string.Empty)
                {
                    eprError.SetIconAlignment(control, ErrorIconAlignment.MiddleRight);
                    eprError.SetError(control, "Text differs from automated value");
                    return("Error");
                }
                else
                {
                    eprError.SetError(control, "");
                    return("Valid");
                }
            }
            else
            {
                eprError.SetError(control, "");
                validateEmptyField(control, eprWarning);
                return("Blank");
            }
        }
Пример #5
0
 private void SetErrorProvider(Control control, string p, bool isError)
 {
     if (_ErrorControls.Contains(control))
     {
         _ErrorControls.Remove(control);
     }
     if (!_errorProviderDictionary.ContainsKey(control))
     {
         ErrorProvider ep = new ErrorProvider();
         ep.BlinkStyle = ErrorBlinkStyle.NeverBlink;
         ep.SetIconAlignment(control, ErrorIconAlignment.MiddleRight);
         if (isError)
         {
             // 沒有 icon 先註解
             //ep.Icon = Properties.Resources.error;
         }
         else
         {
             // 沒有 icon 先註解
             //ep.Icon = Properties.Resources.warning;
         }
         ep.SetError(control, p);
         _errorProviderDictionary.Add(control, ep);
     }
     if (isError)
     {
         _ErrorControls.Add(control);
     }
 }
Пример #6
0
        public static string validateDate(Control control, ErrorProvider eprWarning, ErrorProvider eprError)
        {
            eprWarning.SetIconPadding(control, 5);
            eprError.SetIconPadding(control, 5);
            string automatedValue = System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");

            if (validateEmptyField(control, eprWarning))
            {
                if (control.Text.Trim() != automatedValue && control.Text != string.Empty)
                {
                    eprError.SetIconAlignment(control, ErrorIconAlignment.MiddleRight);
                    eprError.SetError(control, "Date shown is not formatted to the current date & time(yyyy-MM-dd hh:mm:ss).");
                    return("Error");
                }
                else
                {
                    eprError.SetError(control, "");
                    return("Valid");
                }
            }
            else
            {
                eprError.SetError(control, "");
                validateEmptyField(control, eprWarning);
                return("Blank");
            }
        }
Пример #7
0
        public void ErrorProvider_SetIconAlignment_InvalidValue_ThrowsInvalidEnumArgumentException(ErrorIconAlignment value)
        {
            var provider = new ErrorProvider();
            var control  = new Control();

            Assert.Throws <InvalidEnumArgumentException>("value", () => provider.SetIconAlignment(control, value));
        }
Пример #8
0
        public static void validateMapNumber(Control control, ErrorProvider eprWarning, ErrorProvider eprError)
        {
            Match match = Regex.Match(control.Text, @"MA\d\d\d");

            eprWarning.SetIconPadding(control, 3);
            eprError.SetIconPadding(control, 3);

            //Run the validation
            if (validateEmptyField(control, eprWarning))
            {
                // Here we check the regex match
                if (!match.Success)
                {
                    eprError.SetIconAlignment(control, ErrorIconAlignment.MiddleRight);
                    eprError.SetError(control, "Map number does not conform to naming standard. i.e. MA001");
                }
                else
                {
                    eprError.SetError(control, "");
                }
            }
            else
            {
                eprError.SetError(control, "");
                validateEmptyField(control, eprWarning);
            }
        }
Пример #9
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtModulo.Text == "")
            {
                ErrorProvider.SetError(txtModulo, "Campo necesario");
                ErrorProvider.SetIconAlignment(txtModulo, ErrorIconAlignment.MiddleRight);
                txtModulo.Focus();
            }
            else if (txtDescripcion.Text == "")
            {
                ErrorProvider.SetError(txtDescripcion, "Campo necesario");
                ErrorProvider.SetIconAlignment(txtDescripcion, ErrorIconAlignment.MiddleRight);
                txtDescripcion.Focus();
            }
            else
            {
                permisos nPermiso = new Modelo.permisos();
                nPermiso.pkPermiso    = frmMainPermisos.PKPERMISOS;
                nPermiso.sModulo      = txtModulo.Text;
                nPermiso.sDescripcion = txtDescripcion.Text;

                ControladorPermiso cPermiso = new Controlador.ControladorPermiso();
                cPermiso.Guardar(nPermiso);

                wMain.cargarPermisos();
                this.Close();
            }
        }
Пример #10
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public AimConfigurationComponentControl(AimConfigurationComponent component)
            : base(component)
        {
            InitializeComponent();

            _component = component;

            _chkSendToGrid.DataBindings.Add("Checked", _component, "SendNewXmlAnnotationsToGrid", false, DataSourceUpdateMode.OnPropertyChanged);

            _chkStoreAnnotationsLocally.DataBindings.Add("Checked", _component, "StoreXmlAnnotationsLocally", false, DataSourceUpdateMode.OnPropertyChanged);

            _radStoreInMyDocuments.DataBindings.Add("Checked", _component, "StoreXmlInMyDocuments", false, DataSourceUpdateMode.OnPropertyChanged);
            _radStoreInMyDocuments.DataBindings.Add("Enabled", _component, "StoreXmlAnnotationsLocally", false, DataSourceUpdateMode.OnPropertyChanged);

            _radStoreInFolder.DataBindings.Add("Checked", _component, "StoreXmlInSpecifiedFolder", false, DataSourceUpdateMode.OnPropertyChanged);
            _radStoreInFolder.DataBindings.Add("Enabled", _component, "StoreXmlAnnotationsLocally", false, DataSourceUpdateMode.OnPropertyChanged);

            _txtLocalAnnotationsFolderLocation.DataBindings.Add("Text", _component, "LocalAnnotationStoreFolder", true, DataSourceUpdateMode.OnPropertyChanged);
            _txtLocalAnnotationsFolderLocation.DataBindings.Add("Enabled", _component, "LocalAnnotationStoreFolderEnabled", false, DataSourceUpdateMode.OnPropertyChanged);

            _btnBrowseForAnnotationsFolder.DataBindings.Add("Enabled", _component, "LocalAnnotationStoreFolderEnabled", false, DataSourceUpdateMode.OnPropertyChanged);

            ErrorProvider.SetIconAlignment(_btnBrowseForAnnotationsFolder, ErrorIconAlignment.BottomRight);

            _chkRequireUserInfo.DataBindings.Add("Checked", _component, "RequireUserInfo", false, DataSourceUpdateMode.OnPropertyChanged);

            _chkRequireMarkupInAnnotation.DataBindings.Add("Checked", _component, "RequireMarkupInAnnotation", false, DataSourceUpdateMode.OnPropertyChanged);

            _txtLocalTemplatesFolderLocation.DataBindings.Add("Text", _component, "LocalTemplatesStoreFolder", true, DataSourceUpdateMode.OnPropertyChanged);
        }
Пример #11
0
        public static string validateGlideNumber(Control control, ErrorProvider eprWarning, ErrorProvider eprError)
        {
            eprWarning.SetIconPadding(control, 5);
            eprError.SetIconPadding(control, 5);
            string automatedValue = frmMain.getGlideNo();
            string mapValue       = string.Empty;

            //Get and set the map value
            var dict = new Dictionary <string, string>();

            dict = MapAction.PageLayoutProperties.getLayoutTextElements(_pMxDoc, targetMapFrame);
            //Update form text boxes with values from the map
            if (dict.ContainsKey("glide_no"))
            {
                mapValue = dict["glide_no"];
            }

            if (validateEmptyField(control, eprWarning))
            {
                if (control.Text.Trim() != mapValue && control.Text != string.Empty)
                {
                    eprError.SetIconAlignment(control, ErrorIconAlignment.MiddleRight);
                    eprError.SetError(control,
                                      "The value is different to the page layout.");
                    return("Error");
                }
                else if (control.Text.Trim() != automatedValue && control.Text != string.Empty)
                {
                    eprError.SetError(control, "");
                    eprError.SetIconAlignment(control, ErrorIconAlignment.MiddleRight);
                    eprError.SetError(control,
                                      "The page layout and the operation_config.xml value don't match. Use the Layout Tool to resolve this.");
                    return("Error");
                }
                else
                {
                    eprError.SetError(control, "");
                    return("Valid");
                }
            }
            else
            {
                eprError.Dispose();
                validateEmptyField(control, eprWarning);
                return("Blank");
            }
        }
Пример #12
0
 public static bool SetErrorProvidertoControl(ref ErrorProvider ep, ref NumericUpDown textBox, string errorMessage = "", bool validateFormat = false)
 {
     try
     {
         if (!string.IsNullOrEmpty(textBox.Value.ToString()) && validateFormat)
         {
             ep.SetError(textBox, errorMessage);
             ep.SetIconAlignment(textBox, ErrorIconAlignment.MiddleRight);
             ep.SetIconPadding(textBox, 2);
             ep.BlinkRate  = 1000;
             ep.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
             //  textBox.BackColor = System.Drawing.Color.Red;
             return(false);
         }
         else if (string.IsNullOrEmpty(textBox.Value.ToString()))
         {
             ep.SetError(textBox, errorMessage);
             ep.SetIconAlignment(textBox, ErrorIconAlignment.MiddleRight);
             ep.SetIconPadding(textBox, 2);
             ep.BlinkRate  = 1000;
             ep.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
             //textBox.BackColor = System.Drawing.Color.Red;
             return(false);
         }
         else if ((int)textBox.Value == 0)
         {
             ep.SetError(textBox, errorMessage);
             ep.SetIconAlignment(textBox, ErrorIconAlignment.MiddleRight);
             ep.SetIconPadding(textBox, 2);
             ep.BlinkRate  = 1000;
             ep.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
             //textBox.BackColor = System.Drawing.Color.Red;
             return(false);
         }
         else
         {
             ep.SetError(textBox, string.Empty);
             //  textBox.BackColor = DefaultBorderColor;
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #13
0
        public void GetandSetIconAlignmentTest()
        {
            TextBox       myTextBox       = new TextBox();
            ErrorProvider myErrorProvider = new ErrorProvider();

            myErrorProvider.SetIconAlignment(myTextBox, ErrorIconAlignment.MiddleRight);
            Assert.AreEqual(ErrorIconAlignment.MiddleRight, myErrorProvider.GetIconAlignment(myTextBox), "#getset2");
        }
Пример #14
0
 public void Clear(ErrorProvider errorProvider, Control control)
 {
     errorProvider.SetIconAlignment(control, ErrorIconAlignment.MiddleRight);
     // moves icon in from the right
     errorProvider.SetIconPadding(control, -10);
     // w/o this, icon never clears
     errorProvider.SetError(control, "");
 }
Пример #15
0
 /// <summary>
 /// Initialise un composant ErrorProvider avec le choix de l'icone
 /// </summary>
 /// <param name="err">Le composant ErrorProvider à initialiser</param>
 /// <param name="ctrl">Le controle sur lequel faire apparaitre l'erreur</param>
 /// <param name="icon">L'icone à afficher</param>
 private void initializeError(ErrorProvider err, Control ctrl, Icon icon)
 {
     err.SetIconAlignment(ctrl, ErrorIconAlignment.MiddleRight);
     err.SetIconPadding(ctrl, 2);
     err.Icon       = icon;
     err.BlinkRate  = 250;
     err.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.AlwaysBlink;
 }
Пример #16
0
 public static void SetupErrorProvider(out ErrorProvider errorProvider, Control control)
 {
     errorProvider = new ErrorProvider();
     errorProvider.SetIconAlignment(control, ErrorIconAlignment.MiddleRight);
     errorProvider.SetIconPadding(control, 2);
     errorProvider.BlinkRate  = 1000;
     errorProvider.BlinkStyle = ErrorBlinkStyle.AlwaysBlink;
 }
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            if (txtNombre.Text == "")
            {
                ErrorProvider.SetError(txtNombre, "Campo necesario");
                ErrorProvider.SetIconAlignment(txtNombre, ErrorIconAlignment.MiddleLeft);
                txtNombre.Focus();
            }
            else if (txtApellidos.Text == "")
            {
                ErrorProvider.SetError(txtApellidos, "Campo necesario");
                ErrorProvider.SetIconAlignment(txtApellidos, ErrorIconAlignment.MiddleRight);
                txtApellidos.Focus();
            }
            else if (txtDireccion.Text == "")
            {
                ErrorProvider.SetError(txtDireccion, "Campo necesario");
                ErrorProvider.SetIconAlignment(txtDireccion, ErrorIconAlignment.MiddleRight);
                txtDireccion.Focus();
            }
            else if (txtTelefono.Text == "")
            {
                ErrorProvider.SetError(txtTelefono, "Campo necesario");
                ErrorProvider.SetIconAlignment(txtTelefono, ErrorIconAlignment.MiddleLeft);
                txtTelefono.Focus();
            }
            else if (txtEmail.Text == "")
            {
                ErrorProvider.SetError(txtEmail, "Campo necesario");
                ErrorProvider.SetIconAlignment(txtEmail, ErrorIconAlignment.MiddleRight);
                txtEmail.Focus();
            }
            else if (txtIfe.Text == "")
            {
                ErrorProvider.SetError(txtIfe, "Campo necesario");
                ErrorProvider.SetIconAlignment(txtIfe, ErrorIconAlignment.MiddleRight);
                txtIfe.Focus();
            }
            else
            {
                propietarios npropietario = new Modelo.propietarios();
                npropietario.pkPropietario = frmMainPropietarios.PKPROPIETARIO;
                npropietario.sNombre       = txtNombre.Text;
                npropietario.sApellido     = txtApellidos.Text;
                npropietario.sDireccion    = txtDireccion.Text;
                npropietario.sTelefono     = txtTelefono.Text;
                npropietario.sEmail        = txtEmail.Text;
                npropietario.sIfe          = txtIfe.Text;
                this.guardarfoto();
                npropietario.sFoto = filename;

                ControladorPropietario cPermisos = new ControladorPropietario();
                cPermisos.Modificar(npropietario);

                wMain.CargarPropietarios();
                this.Close();
            }
        }
Пример #18
0
        /// <summary>
        /// Valida o campo como obrigatório ou não
        /// </summary>
        /// <returns>Valido true/false</returns>
        public bool ValidarCampos()
        {
            Funcoes func;

            if (bObrigatorio &&
                !string.IsNullOrEmpty(this.ControlSource) &&
                Propriedades.FormMain != null &&
                Propriedades.FormMain.ActiveMdiChild != null &&
                func.Check_Extension(Propriedades.FormMain.ActiveMdiChild.GetType(), typeof(FormSet)))
            {
                FormSet f_MdiActivate = ((FormSet)Propriedades.FormMain.ActiveMdiChild);

                //-- Caso o campo seja para validação execute o HelpProvider.
                //-- Verifica qual é o modo do formulário, permitindo apenas como Novo ou Modificando.
                if (f_MdiActivate.FormStatus == TipoFormStatus.Novo ||
                    f_MdiActivate.FormStatus == TipoFormStatus.Modificando)
                {
                    string sValor_Valida = string.Empty;

                    //-- Verifica o registro foi preenchido.
                    if (sTabela.Equals(f_MdiActivate.MainTabela.ToLower()))
                    {
                        if (!this.IsHandleCreated || !this.Parent.IsHandleCreated)
                        {
                            DataRowView row = (DataRowView)f_MdiActivate.BindingSource[sTabela].Current;
                            sValor_Valida = row[sControlSource].ToString();
                        }
                        else
                        {
                            sValor_Valida = this.Value;
                        }
                    }

                    //-- Verifica se o valor está OK.
                    if (string.IsNullOrEmpty(sValor_Valida))
                    {
                        ep.SetIconAlignment(this, ErrorIconAlignment.MiddleRight);
                        ep.SetIconPadding(this, -19);
                        ep.SetError(this, sMensagemObrigatorio);
                        return(false);
                    }
                    else
                    {
                        ep.SetError(this, "");
                        return(true);
                    }
                }
                else
                {
                    ep.SetError(this, "");
                    return(true);
                }
            }
            else
            {
                return(true);
            }
        }
Пример #19
0
 private void saveButton_Click(object sender, EventArgs e)
 {
     try
     {
         InvoiceDetail invoiceDetail = new InvoiceDetail {
             Quantity = Int16.Parse(quantityTextBox.Text), Sku = skuTextBox.Text, Description = descriptionTextBox.Text, Price = Decimal.Parse(priceTextBox.Text), Taxable = taxableCheckBox.Checked
         };
         int result = 0;
         if (String.IsNullOrWhiteSpace(invoiceIdTextBox.Text))
         {
             // int index = invoiceDetailListBox.SelectedIndex;
             // InvoiceDetail invoiceDetail = invoiceDetailVM.InvoiceDetails[index];
             result = Validator.CreateInvoiceDetail(invoiceDetail);
             if (result > 0)
             {
                 loadDataGridView();
             }
             if (result < 0)
             {
                 errorProvider.SetIconAlignment(saveButton, ErrorIconAlignment.MiddleLeft);
                 errorProvider.SetError(saveButton, Validator.GetMessages);
                 errorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink;
             }
         }
         else
         {
             invoiceDetail.DetailId = Int16.Parse(invoiceIdTextBox.Text);
             result = Validator.UpdateInvoiceDetail(invoiceDetail);
             if (result > 0)
             {
                 loadDataGridView();
             }
             if (result < 0)
             {
                 errorProvider.SetIconAlignment(saveButton, ErrorIconAlignment.MiddleLeft);
                 errorProvider.SetError(saveButton, Validator.GetMessages);
                 errorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink;
             }
         }
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message, "DB ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private static void ShowError(Control control, string message)
        {
            var errorProvider = new ErrorProvider();

            errorProvider.SetIconAlignment(control, ErrorIconAlignment.MiddleRight);
            errorProvider.SetIconPadding(control, 2);
            errorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink;
            errorProvider.SetError(control, message);
        }
Пример #21
0
 public frmEditUser(User user)
 {
     InitializeComponent();
     this.user      = user;
     err            = new ErrorProvider();
     err.BlinkStyle = ErrorBlinkStyle.NeverBlink;
     err.SetIconAlignment(cbRoles, ErrorIconAlignment.MiddleRight);
     err.SetIconPadding(cbRoles, 2);
 }
Пример #22
0
        public static void DisplayError(this ErrorProvider errProvider, Control ctrl, string error)
        {
            if (error != null)
            {
                if (ctrl is Button)
                {
                    errProvider.SetIconAlignment(ctrl, ErrorIconAlignment.MiddleRight);
                }
                else
                {
                    errProvider.SetIconAlignment(ctrl, ErrorIconAlignment.TopRight);
                }

                errProvider.SetIconPadding(ctrl, 1);
            }

            errProvider.SetError(ctrl, error);
        }
Пример #23
0
        /// <summary>
        /// Valida o campo como obrigatório ou não
        /// </summary>
        /// <returns>Valido true/false</returns>
        public bool ValidarCampos()
        {
            Funcoes func;

            if (bObrigatorio &&
                !string.IsNullOrEmpty(sControlSource) &&
                Propriedades.FormMain != null &&
                Propriedades.FormMain.ActiveMdiChild != null &&
                func.Check_Extension(Propriedades.FormMain.ActiveMdiChild.GetType(), typeof(FormSet)))
            {
                FormSet f_MdiActivate = ((FormSet)Propriedades.FormMain.ActiveMdiChild);

                //-- Caso o campo seja para validação execute o HelpProvider.
                //-- Verifica qual é o modo do formulário, permitindo apenas como Novo ou Modificando.
                if (f_MdiActivate.FormStatus == CompSoft.TipoFormStatus.Novo ||
                    f_MdiActivate.FormStatus == CompSoft.TipoFormStatus.Modificando)
                {
                    string sValor_Combo = string.Empty;

                    //-- Verifica se o controle já existe em memoria, caso exista captura o valor do controle.
                    if (!this.IsHandleCreated)
                    {
                        DataRowView row = (DataRowView)f_MdiActivate.BindingSource[sTabela].Current;
                        sValor_Combo = row[sControlSource].ToString();
                    }
                    else
                    {
                        if (this.Value != null)
                        {
                            sValor_Combo = this.Value.ToString();
                        }
                    }

                    if (string.IsNullOrEmpty(sValor_Combo))
                    {
                        ep.SetIconAlignment(this, ErrorIconAlignment.MiddleRight);
                        ep.SetIconPadding(this, -35);
                        ep.SetError(this, sMensagemObrigatorio);
                        return(false);
                    }
                    else
                    {
                        ep.SetError(this, "");
                        return(true);
                    }
                }
                else
                {
                    ep.SetError(this, "");
                    return(true);
                }
            }
            else
            {
                return(true);
            }
        }
        private void InitializeErrorProvider()
        {
            this.AutoValidate = AutoValidate.EnableAllowFocusChange;

            _errorProvider            = new ErrorProvider(this);
            _errorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink;

            // STF-only
            if (GlobalSettings.IsDistributedSystem)
            {
                if (dispatcher_Label != null)
                {
                    _errorProvider.SetIconAlignment(dispatcher_Label, ErrorIconAlignment.MiddleLeft);
                }
            }

            _errorProvider.SetIconAlignment(selectedScenario_TextBox, ErrorIconAlignment.MiddleLeft);
            _errorProvider.SetIconAlignment(sessionName_ComboBox, ErrorIconAlignment.MiddleLeft);
        }
Пример #25
0
        private void personDataGridView_DataError(object sender, DataGridViewDataErrorEventArgs e)
        {
            Control edit = personDataGridView.EditingControl;

            _errorProvider.SetError(edit, "Invalid Value");
            _errorProvider.SetIconAlignment(edit, ErrorIconAlignment.MiddleRight);
            _errorProvider.SetIconPadding(edit, -20); // icon displays on left side of cell

            personDataGridView[e.ColumnIndex, e.RowIndex].Value = "";
        }
Пример #26
0
        private ErrorProviderHelper()
        {
            TextBox textBox = new TextBox();

            errorProvider = new ErrorProvider();
            errorProvider.SetIconAlignment(textBox, ErrorIconAlignment.MiddleRight);
            errorProvider.SetIconPadding(textBox, 2);
            errorProvider.BlinkRate  = 1000;
            errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
        }
Пример #27
0
        }//------------------

        //###########################################END LABEL lblReceiptDate EVENTS#####################################################
        #endregion

        #region Programmers-Defined Functions
        //this fucntion will validate controls
        public Boolean ValidateControls()
        {
            Boolean isValid = true;

            _errProvider.SetError(this.lblReceiptNumber, String.Empty);

            if (String.IsNullOrEmpty(_canceldReceiptNoInfo.ReceiptNo))
            {
                _errProvider.SetError(this.lblReceiptNumber, "You must select a receipt information");
                _errProvider.SetIconAlignment(this.lblReceiptNumber, ErrorIconAlignment.MiddleRight);

                isValid = false;
            }

            if (_isFromReIssued)
            {
                using (RemoteClient.RemCntCashieringManager remClient = new RemoteClient.RemCntCashieringManager())
                {
                    if (remClient.IsExistsReceiptNoStudentPayments(_userInfo, _studentPaymentInfo.PaymentId, _studentPaymentInfo.ReceiptNo))
                    {
                        _errProvider.SetError(this.lblReceiptNumber, "The new receipt number is already exist [" + _studentPaymentInfo.ReceiptNo + "]");
                        _errProvider.SetIconAlignment(this.lblReceiptNumber, ErrorIconAlignment.MiddleRight);

                        isValid = false;
                    }
                }
            }
            else if (_isFromMiscellaneousIncome)
            {
                using (RemoteClient.RemCntCashieringManager remClient = new RemoteClient.RemCntCashieringManager())
                {
                    if (remClient.IsExistsReceiptNoStudentPayments(_userInfo, _miscellaneousIncomeInfo.PaymentId, _miscellaneousIncomeInfo.ReceiptNo))
                    {
                        _errProvider.SetError(this.lblReceiptNumber, "The new receipt number is already exist [" + _miscellaneousIncomeInfo.ReceiptNo + "]");
                        _errProvider.SetIconAlignment(this.lblReceiptNumber, ErrorIconAlignment.MiddleRight);

                        isValid = false;
                    }
                }
            }

            return(isValid);
        }//----------------------
Пример #28
0
        public frmMain()
        {
            InitializeComponent();

            classNameErrorProvider = new ErrorProvider();
            classNameErrorProvider.SetIconAlignment(txtAddNewClass, ErrorIconAlignment.MiddleRight);
            classNameErrorProvider.SetIconPadding(txtAddNewClass, 2);
            classNameErrorProvider.BlinkRate  = 1000;
            classNameErrorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.AlwaysBlink;
        }
Пример #29
0
 /// <summary>
 /// Handles the error default controls.
 /// </summary>
 /// <param name="errorCode">The error code.</param>
 /// <param name="message">The message.</param>
 private void HandleErrorDefaultControls(ErrorCode errorCode, string message)
 {
     if (ErrorDictonary.ContainsKey(errorCode))
     {
         TurnOnErrorHandledStatus();
         var control = ErrorDictonary[errorCode];
         ErrorProvider.SetError(control, message.ToUpper());
         ErrorProvider.SetIconAlignment(control, ErrorIconAlignment.MiddleRight);
     }
 }
Пример #30
0
        }//--------------------

        #endregion

        #region Programer-Defined Funtions
        //this function determines if the controls are validated
        protected Boolean ValidateControls()
        {
            Boolean isValid = true;

            _errProvider.SetError(this.cboYearSemester, "");
            _errProvider.SetError(this.btnSearchSubject, "");
            _errProvider.SetError(this.lnkAddDetails, "");
            _errProvider.SetError(this.chkIsTeamTeaching, "");

            if (cboYearSemester.SelectedIndex == -1)
            {
                _errProvider.SetIconAlignment(this.cboYearSemester, ErrorIconAlignment.MiddleRight);
                _errProvider.SetError(this.cboYearSemester, "Please select a school year / semester the schedule information is enrolled.");
                isValid = false;
            }

            if (String.IsNullOrEmpty(_schedInfo.SubjectInfo.SubjectSysId))
            {
                _errProvider.SetIconAlignment(this.btnSearchSubject, ErrorIconAlignment.MiddleLeft);
                _errProvider.SetError(this.btnSearchSubject, "Please select a subject for the schedule information.");
                isValid = false;
            }

            if (!_scheduleManager.HasValidCountOfScheduleDetails(_schedInfo.ScheduleSysId, _schedInfo.IsTeamTeaching))
            {
                if (_schedInfo.IsTeamTeaching)
                {
                    _errProvider.SetIconAlignment(this.chkIsTeamTeaching, ErrorIconAlignment.MiddleRight);
                    _errProvider.SetError(this.chkIsTeamTeaching, "Not a valid team teaching schedule.");
                }
                else
                {
                    _errProvider.SetIconAlignment(this.lnkAddDetails, ErrorIconAlignment.MiddleLeft);
                    _errProvider.SetError(this.lnkAddDetails, "There must be at least one schedule details.");
                }
                isValid = false;

                this.tabSchedule.SelectedIndex = 0;
            }

            return(isValid);
        } //------------------------
Пример #31
0
        }//---------------------

        //###############################################END TEXTBOX txtScholarship EVENTS##################################################
        #endregion

        #region Programer-Defined Fucntions
        //this fucntion will validate controls
        public Boolean ValidateControls()
        {
            Boolean isValid = true;

            _errProvider.SetError(this.cboCourseGroup, "");
            _errProvider.SetError(this.cboDepartment, "");
            _errProvider.SetError(this.txtScholarship, "");

            if (String.IsNullOrEmpty(_scholarshipInfo.CourseGroupInfo.CourseGroupId))
            {
                _errProvider.SetError(this.cboCourseGroup, "You must select a course group.");
                _errProvider.SetIconAlignment(this.cboCourseGroup, ErrorIconAlignment.MiddleRight);

                isValid = false;
            }

            if (String.IsNullOrEmpty(_scholarshipInfo.DepartmentInfo.DepartmentId))
            {
                _errProvider.SetError(this.cboDepartment, "You must select a department.");
                _errProvider.SetIconAlignment(this.cboDepartment, ErrorIconAlignment.MiddleRight);

                isValid = false;
            }

            if (String.IsNullOrEmpty(_scholarshipInfo.ScholarshipDescription))
            {
                _errProvider.SetError(this.txtScholarship, "You must select create a scholarship description.");
                _errProvider.SetIconAlignment(this.txtScholarship, ErrorIconAlignment.MiddleRight);

                isValid = false;
            }

            if (isValid && _scholarshipManager.IsExistsScholarshipDescriptionScholarshipInformation(_userInfo, _scholarshipInfo))
            {
                _errProvider.SetError(this.txtScholarship, "Scholarship description already exist.");
                _errProvider.SetIconAlignment(this.txtScholarship, ErrorIconAlignment.MiddleRight);

                isValid = false;
            }

            return(isValid);
        }//-----------------------