Example #1
0
        private string GetFormatFromDefaults()
        {
            var item = DefaultFormats.FirstOrDefault(i => i.CType == GetCoordinateType());

            if (item == null)
            {
                return(Properties.Resources.StringNoFormatFound);
            }

            return(item.DefaultNameFormatDictionary[FormatSelection]);
        }
Example #2
0
        /// <summary>
        ///  Executes the action related to the CloseUp event.
        /// </summary>
        /// <param name="sender">Object sender.</param>
        /// <param name="e">EventArgs.</param>
        private void HandleDateTimePickerCloseUp(object sender, EventArgs e)
        {
            oldPickerText = mMaskedTextBoxIT.Text;

            if (!string.IsNullOrEmpty(Mask))
            {
                mMaskedTextBoxIT.Text = DefaultFormats.ApplyInputFormat(this.mDateTimePickerIT.Value, mDataType, Mask);
            }
            else
            {
                mMaskedTextBoxIT.Text = DefaultFormats.ApplyInputFormat(this.mDateTimePickerIT.Value, mDataType);
            }
        }
Example #3
0
        private string GetInfoFromOid(Oid oid, DisplaySetInformation supplementaryInfo)
        {
            if (oid == null)
            {
                return("");
            }

            // If no Supplementary information is requested, return the Oid values
            if (supplementaryInfo == null)
            {
                return(UtilFunctions.OidFieldsToString(oid, ' '));
            }

            // Query to obtain the supplementary information values
            string    displaySet = supplementaryInfo.DisplaySetItemsAsString();
            DataTable lDataTable = null;

            try
            {
                lDataTable = Logic.ExecuteQueryInstance(Logic.Agent, oid, displaySet);
            }
            catch
            {
                return(UtilFunctions.OidFieldsToString(oid, ' '));;
            }

            // No data, return empty string
            if (lDataTable == null || lDataTable.Rows.Count == 0)
            {
                return(UtilFunctions.OidFieldsToString(oid, ' '));
            }
            ;

            string lResult = "";

            foreach (DisplaySetItem lItem in supplementaryInfo.DisplaySetItems)
            {
                if (!lResult.Equals(""))
                {
                    lResult += " ";
                }

                lResult += DefaultFormats.ApplyDisplayFormat(lDataTable.Rows[0][lItem.Name], lItem.ModelType);
            }

            return(lResult);
        }
Example #4
0
        /// <summary>
        /// Validates the control value.
        /// </summary>
        /// <param name="defaultErrorMessage">Default validation message.</param>
        /// <returns>Boolean value indicating if the validation was ok or not.</returns>
        public bool Validate(string defaultErrorMessage)
        {
            if ((this.mErrorProvider != null) && (this.mTextBoxIT != null))
            {
                mErrorProvider.SetIconPadding(this.mTextBoxIT, -20);

                // Null validation.
                if ((!this.NullAllowed) && (this.mTextBoxIT.Text == string.Empty))
                {
                    mErrorProvider.SetError(this.mTextBoxIT, defaultErrorMessage);
                    // Validation error.
                    return(false);
                }

                // Format validation.
                if (this.mTextBoxIT.Text != string.Empty)
                {
                    if (!DefaultFormats.CheckDataType(this.mTextBoxIT.Text, mDataType, mNullAllowed))
                    {
                        string lMask = DefaultFormats.GetHelpMask(mDataType, string.Empty);
                        mErrorProvider.SetError(this.mTextBoxIT, CultureManager.TranslateString(LanguageConstantKeys.L_VALIDATION_INVALID_FORMAT_MASK, LanguageConstantValues.L_VALIDATION_INVALID_FORMAT_MASK));

                        // Validation error.
                        return(false);
                    }
                }
                else
                {
                    // Size Validation
                    if ((mMaxLength != 0) && (mTextBoxIT.Text.Length > mMaxLength))
                    {
                        mErrorProvider.SetError(this.mTextBoxIT, CultureManager.TranslateString(LanguageConstantKeys.L_VALIDATION_SIZE_WITHOUT_ARGUMENT, LanguageConstantValues.L_VALIDATION_SIZE_WITHOUT_ARGUMENT) + mMaxLength);
                        return(false);
                    }
                }
            }

            // Set the value with the correct format.
            this.Value = Logics.Logic.StringToModel(mDataType, mTextBoxIT.Text);

            // Validation OK.
            return(true);
        }
        private string GetFormatSample(string format)
        {
            var cType = GetCoordinateType();
            var def   = DefaultFormats.FirstOrDefault(i => i.CType == cType);

            if (def == null)
            {
                return(string.Empty);
            }

            foreach (var item in def.DefaultNameFormatDictionary)
            {
                if (item.Value == format)
                {
                    return(item.Key);
                }
            }

            return(CoordinateConversionLibrary.Properties.Resources.CustomString);
        }
Example #6
0
        private string GetFormatSample(string format)
        {
            if (OutputCoordItem == null)
            {
                return(string.Empty);
            }

            var def = DefaultFormats.FirstOrDefault(i => i.CType == OutputCoordItem.CType);

            if (def == null)
            {
                return(string.Empty);
            }

            foreach (var item in def.DefaultNameFormatDictionary)
            {
                if (item.Value == format)
                {
                    return(item.Key);
                }
            }

            return(Properties.Resources.CustomString);
        }
Example #7
0
        /// <summary>
        /// Executes the action related to the TextChanged event.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">EventArgs.</param>
        private void HandleMaskedTextBoxITTextChanged(object sender, EventArgs e)
        {
            // Clear the ErrorProvider control.
            if (mErrorProvider != null)
            {
                mErrorProvider.Clear();
            }

            // Raise the change value event if the control has not the focus.
            // If not, wait until it lose the focus.
            if (mMaskedTextBoxIT.Focused)
            {
                return;
            }

            // Check that the data belongs to the specified type.
            if (!DefaultFormats.CheckDataType(mMaskedTextBoxIT.Text, mDataType, true))
            {
                return;
            }

            // Throw value chaged event.
            OnValueChanged(new ValueChangedEventArgs());
        }
        /// <summary>
        /// Sets format to a column. If the column doesn't exist then creates a new one
        /// </summary>
        /// <param name="name"></param>
        /// <param name="alias"></param>
        /// <param name="modelType"></param>
        /// <param name="definedSelectionOptions"></param>
        /// <param name="width"></param>
        public void SetFormatDisplaySetItem(string name, string alias, ModelType modelType, List <KeyValuePair <object, string> > definedSelectionOptions, int width, bool editable, bool allowsNullInEditMode)
        {
            string lColumnName = name;
            int    counter     = 1;

            while (Exist(lColumnName))
            {
                lColumnName = name + counter.ToString();
                counter++;
            }

            // Add a new column to the Grid
            DataGridViewColumn lColumn = null;

            // For boolean data type and editable ones, use the checkbox column
            if ((definedSelectionOptions == null) && (modelType == ModelType.Bool) && (editable || ShowBooleanAsCheckBox))
            {
                DataGridViewCheckBoxColumn lCheckBoxColumn = new DataGridViewCheckBoxColumn();
                lCheckBoxColumn.SortMode = DataGridViewColumnSortMode.Automatic;
                if (editable && !allowsNullInEditMode)
                {
                    lCheckBoxColumn.ThreeState = false;
                }
                else
                {
                    lCheckBoxColumn.ThreeState = true;
                }

                lColumn = lCheckBoxColumn;
            }
            else
            {
                if (definedSelectionOptions != null || modelType == ModelType.Bool)
                {
                    DataGridViewComboBoxColumn lComboBoxColumn = new DataGridViewComboBoxColumn();
                    lComboBoxColumn.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
                    if (definedSelectionOptions != null)
                    {
                        lComboBoxColumn.DataSource = definedSelectionOptions;
                    }
                    else
                    {
                        lComboBoxColumn.DataSource = mBooleanValues;
                    }
                    lComboBoxColumn.DisplayMember = "Value";
                    lComboBoxColumn.ValueMember   = "Key";
                    lComboBoxColumn.SortMode      = DataGridViewColumnSortMode.Automatic;
                    lColumn = lComboBoxColumn;
                }
                else
                {
                    lColumn = new DataGridViewTextBoxColumn();
                    switch (modelType)
                    {
                    case ModelType.Time:
                    case ModelType.Autonumeric:
                    case ModelType.Date:
                    case ModelType.DateTime:
                    case ModelType.Int:
                    case ModelType.Nat:
                    case ModelType.Real:
                        lColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        break;
                    }
                    lColumn.DefaultCellStyle.Format = DefaultFormats.GetDefaultDisplayMask(modelType);
                }
            }
            // Assign the width
            if (width != 0)
            {
                if ((modelType == ModelType.Bool) && (definedSelectionOptions != null))
                {
                    lColumn.Width = DefaultFormats.ColWidthBoolDefinedSelection;
                }
                else
                {
                    lColumn.Width = width;
                }
            }

            lColumn.DataPropertyName = name;
            lColumn.Name             = lColumnName;
            if (alias == null)
            {
                alias = string.Empty;
            }
            lColumn.HeaderText = (alias.Length == 0 ? name : alias);

            // IF the column is editable ...
            if (editable)
            {
                lColumn.ReadOnly                 = false;
                mDataGridViewIT.ReadOnly         = false;
                mDataGridViewIT.EditMode         = DataGridViewEditMode.EditOnEnter;
                mDataGridViewIT.SelectionMode    = DataGridViewSelectionMode.FullRowSelect;
                mDataGridViewIT.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders;
            }
            else
            {
                lColumn.ReadOnly = true;
            }

            mDataGridViewIT.SuspendLayout();
            mDataGridViewIT.Columns.Add(lColumn);
            mDataGridViewIT.ResumeLayout();
        }
        /// <summary>
        /// Validates the control value.
        /// </summary>
        /// <param name="defaultErrorMessage">Default validation message.</param>
        /// <returns>Boolean value indicating if the validation was ok or not.</returns>
        public bool Validate(string defaultErrorMessage)
        {
            // No graphical editor.
            if (mMaskedTextBoxIT == null)
            {
                return(true);
            }

            // Null validation.
            if (!NullAllowed && !HasValue())
            {
                // Validation error.
                if (mErrorProvider != null)
                {
                    mErrorProvider.SetError(this.mMaskedTextBoxIT, defaultErrorMessage);
                }
                return(false);
            }

            // No value in the editor.
            if (NullAllowed && !HasValue())
            {
                return(true);
            }

            // There is a value in the editor.
            bool lIsValid = true;

            // If there is a mask defined, it has to be validated the value according the mask format.
            if (!string.IsNullOrEmpty(Mask))
            {
                // Format validation for String and Time data types which have any introduction mask.
                // String data type
                if (mDataType == ModelType.String)
                {
                    lIsValid = IsValidStringAccordingMask(this.mMaskedTextBoxIT.Text);
                }
                // Time data type
                if (mDataType == ModelType.Time)
                {
                    lIsValid = DefaultFormats.CheckDataType(this.mMaskedTextBoxIT.Text, mDataType, mNullAllowed) &&
                               this.mMaskedTextBoxIT.MaskCompleted &&
                               IsValidTimeAccordingMask(this.mMaskedTextBoxIT.Text);
                }
            }
            else
            {
                // Value data type validation, when there is not a mask defined.
                lIsValid = DefaultFormats.CheckDataType(this.mMaskedTextBoxIT.Text, mDataType, mNullAllowed);

                #region Numeric format validation
                if (NumericFormatValidationRequired())
                {
                    // Check the value according numeric introduction pattern.
                    decimal?lValue = null;
                    try
                    {
                        lValue = decimal.Parse(mMaskedTextBoxIT.Text, System.Globalization.NumberStyles.Number, CultureManager.Culture);
                    }
                    catch
                    {
                        lIsValid = false;
                    }

                    if (!lIsValid)
                    {
                        // It is not a numeric value, or it is not a correct value according the data type.
                        object[] lArgs = new object[1];
                        lArgs[0] = DefaultFormats.GetHelpMask(mDataType, string.Empty);
                        string lErrorMessage = CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_VALIDATION_INVALID_FORMAT_MASK, LanguageConstantValues.L_VALIDATION_INVALID_FORMAT_MASK, lArgs);
                        mErrorProvider.SetError(this.mMaskedTextBoxIT, lErrorMessage);
                        return(false);
                    }

                    if (lValue != null)
                    {
                        // Number of integer and decimal digits.
                        int lDecimalDigits = GetNumberDecimalDigits(mMaskedTextBoxIT.Text);
                        int lIntegerDigits = GetNumberIntegerDigits(mMaskedTextBoxIT.Text);
                        if (MinDecimalDigits > 0)
                        {
                            if (lDecimalDigits < MinDecimalDigits)
                            {
                                mErrorProvider.SetError(this.mMaskedTextBoxIT, IPValidationMessage);
                                return(false);
                            }
                        }
                        if (lDecimalDigits > MaxDecimalDigits)
                        {
                            mErrorProvider.SetError(this.mMaskedTextBoxIT, IPValidationMessage);
                            return(false);
                        }
                        if (MaxIntegerDigits != null)
                        {
                            if (lIntegerDigits > MaxIntegerDigits)
                            {
                                mErrorProvider.SetError(this.mMaskedTextBoxIT, IPValidationMessage);
                                return(false);
                            }
                        }

                        // Minimum and Maximum value validation.
                        if ((mMinValue != null || mMaxValue != null) && (mMinValue != mMaxValue))
                        {
                            if (mMinValue != null && lValue < mMinValue)
                            {
                                mErrorProvider.SetError(this.mMaskedTextBoxIT, IPValidationMessage);
                                return(false);
                            }
                            if (mMaxValue != null && lValue > mMaxValue)
                            {
                                mErrorProvider.SetError(this.mMaskedTextBoxIT, IPValidationMessage);
                                return(false);
                            }
                        }
                    }
                }
                #endregion Numeric format validation
            }

            // Show the suitable error message.
            if (!lIsValid)
            {
                // Default or introduction pattern error message
                if (string.IsNullOrEmpty(IPValidationMessage))
                {
                    object[] lArgs = new object[1];
                    lArgs[0] = DefaultFormats.GetHelpMask(mDataType, string.Empty);
                    string lErrorMessage = CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_VALIDATION_INVALID_FORMAT_MASK, LanguageConstantValues.L_VALIDATION_INVALID_FORMAT_MASK, lArgs);
                    mErrorProvider.SetError(this.mMaskedTextBoxIT, lErrorMessage);
                }
                else
                {
                    mErrorProvider.SetError(this.mMaskedTextBoxIT, IPValidationMessage);
                }
                // Validation error.
                return(false);
            }
            else
            {
                // Size validation.
                if ((mMaxLength != 0) && (mMaskedTextBoxIT.Text.Length > mMaxLength))
                {
                    string lMessageError = CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_VALIDATION_SIZE_WITHOUT_ARGUMENT, LanguageConstantValues.L_VALIDATION_SIZE_WITHOUT_ARGUMENT, mMaxLength);
                    mErrorProvider.SetError(this.mMaskedTextBoxIT, lMessageError);
                    return(false);
                }
            }

            // Restore the mask to the graphical control
            RestoreMask(false);

            // Validation OK.
            return(true);
        }
Example #10
0
        private void mbOK_Click(object sender, EventArgs e)
        {
            #region Actualize current language
            // Get the current language from the combobox language selector.
            CultureManager.Culture = new System.Globalization.CultureInfo(((KeyValuePair <string, string>) this.mLanguage.SelectedItem).Key);
            #endregion Actualize current language

            string   lAgentClassName = (mAgent.SelectedItem as Logics.LogInAgent).Name;
            Oids.Oid lagent          = Oids.Oid.Create(lAgentClassName);
            lagent.ClearValues();
            AgentInfo         lAgentInfo  = lagent as AgentInfo;
            Logics.LogInAgent lLogInAgent = Logics.Agents.GetLogInAgentByName(lAgentClassName);
            // Check if the connected agent has alternate key.
            if (lLogInAgent.AlternateKeyName != string.Empty)
            {
                // Obtain the Alternate Key used by the connected agent class,
                // in order to be able of filling in the field values from the editors.
                lagent = (Oid)lagent.GetAlternateKey(lLogInAgent.AlternateKeyName);
                lagent.AlternateKeyName = lLogInAgent.AlternateKeyName;
            }

            if (!(lAgentInfo is AnonymousAgentInfo))
            {
                // To validate that all the login values are introduced.
                bool lbIsNull = false;
                // Error provider properties
                lErrorProvider.Clear();
                lErrorProvider.BlinkRate  = 500;
                lErrorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;

                #region Validate that the login and password are introduced
                // Validate the password field.
                if (mTextBoxPassword.Text == string.Empty)
                {
                    // Set the focus and error
                    mTextBoxPassword.Focus();
                    lErrorProvider.SetError(mTextBoxPassword, CultureManager.TranslateString(LanguageConstantKeys.L_PASSWORD_NOT_NULL, LanguageConstantValues.L_PASSWORD_NOT_NULL));
                    lErrorProvider.SetIconPadding(mTextBoxPassword, -20);
                    lbIsNull = true;
                }

                // Validate the login fields.
                for (int i = mEditors.Length - 1; i >= 0; i--)
                {
                    if (mEditors[i].Visible)
                    {
                        // Null validation.
                        if (mEditors[i].Text == string.Empty)
                        {
                            // Set the focus and error
                            mEditors[i].Focus();
                            lErrorProvider.SetError(mEditors[i], CultureManager.TranslateString(LanguageConstantKeys.L_LOGIN_NOT_NULL, LanguageConstantValues.L_LOGIN_NOT_NULL));
                            lErrorProvider.SetIconPadding(mEditors[i], -20);
                            lbIsNull = true;
                        }
                    }
                }

                // If there are any empty argument.
                if (lbIsNull == true)
                {
                    // Do not continue
                    return;
                }
                #endregion Validate that the login and password are introduced
            }

            #region Create the agent
            int lOidField = 0;
            try
            {
                if (!(lAgentInfo is AnonymousAgentInfo))
                {
                    // Set the OID type to the proper control.
                    foreach (Control item in mEditors)
                    {
                        if (item.Visible == true)
                        {
                            try
                            {
                                if (!DefaultFormats.CheckDataType(item.Text, lagent.Fields[lOidField].Type, false))
                                {
                                    string lText    = CultureManager.TranslateString(LanguageConstantKeys.L_ERROR_BAD_IDENTITY, LanguageConstantValues.L_ERROR_BAD_IDENTITY);
                                    string lMessage = CultureManager.TranslateString(LanguageConstantKeys.L_ERROR, LanguageConstantValues.L_ERROR);
                                    MessageBox.Show(lText, lMessage, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                    return;
                                }
                                object value = Logics.Logic.StringToModel(lagent.Fields[lOidField].Type, item.Text);
                                lagent.SetValue(lOidField, value);
                                lOidField++;
                            }
                            catch
                            {
                                string lText    = CultureManager.TranslateString(LanguageConstantKeys.L_LOGIN_INCORRECT, LanguageConstantValues.L_LOGIN_INCORRECT);
                                string lMessage = CultureManager.TranslateString(LanguageConstantKeys.L_ERROR, LanguageConstantValues.L_ERROR);
                                MessageBox.Show(lText, lMessage, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }
                        }
                    }
                }

                #region Agent authentication
                if (lagent is AlternateKey)
                {
                    AuthenticateAlternateKey(lagent, mTextBoxPassword.Text);
                }
                else
                {
                    Authenticate(lagent as AgentInfo, mTextBoxPassword.Text);
                }
                #endregion Agent authentication
            }
            catch
            {
                string lMessage  = CultureManager.TranslateString(LanguageConstantKeys.L_ERROR, LanguageConstantValues.L_ERROR);
                string lExcepMsg = CultureManager.TranslateString(LanguageConstantKeys.L_ERROR_BAD_IDENTITY, LanguageConstantValues.L_ERROR_BAD_IDENTITY);
                MessageBox.Show(lExcepMsg, lMessage, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            #endregion Create the agent.
        }
        /// <summary>
        /// Shows specified data on ListView.
        /// </summary>
        /// <param name="data">Data to show.</param>
        public void ShowData(DataTable data, List <Oid> selectedOids)
        {
            // Clear Instance selector.
            mValue.Clear();
            // Clear viewer.
            CleanData();

            if ((data != null) && (data.Rows.Count > 0))
            {
                // Load from the DataTable.
                List <DataColumn> displaySetColumns = Adaptor.ServerConnection.GetDisplaySetColumns(data);

                DataRow row = data.Rows[0];

                // Store the Oid
                mValue.Add(Adaptor.ServerConnection.GetLastOid(data));
                // Show data in the ListView
                int i = 0;
                foreach (DataColumn column in displaySetColumns)
                {
                    // Do not continue, if displaySetColumns contains more columns
                    // than elements defined in the ListView control.
                    if (i < mListViewIT.Items.Count)
                    {
                        if (mDefinedSelectionOptions[i] != null)
                        {
                            for (int j = 0; j < mDefinedSelectionOptions[i].Count; j++)
                            {
                                if ((mDefinedSelectionOptions[i][j].Key != null) && (mDefinedSelectionOptions[i][j].Key.ToString() == row.ItemArray[column.Ordinal].ToString()))
                                {
                                    mListViewIT.Items[i].SubItems[1].Text = mDefinedSelectionOptions[i][j].Value;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            mListViewIT.Items[i].SubItems[1].Text = DefaultFormats.ApplyDisplayFormat(row.ItemArray[column.Ordinal], mTypeList[i]);
                        }
                    }
                    i++;
                }
            }

            if (SelectionChanged != null)
            {
                // Obtain the keys to enable or disable the actions and navigations.
                List <string> actionsKeys     = new List <string>();
                List <string> navigationsKeys = new List <string>();
                try
                {
                    DataRow row = data.Rows[0];
                    actionsKeys.Add((string)row[Constants.ACTIONS_ACTIVATION_COLUMN_NAME]);
                    navigationsKeys.Add((string)row[Constants.NAVIGATIONS_ACTIVATION_COLUMN_NAME]);
                }
                catch
                {
                }
                // Raise the event.
                SelectionChanged(this, new SelectedChangedEventArgs(mValue, actionsKeys, navigationsKeys));
            }
        }
Example #12
0
        /// <summary>
        /// Validates the control value.
        /// </summary>
        /// <param name="defaultErrorMessage">Default validation message.</param>
        /// <returns>Boolean value indicating if the validation was ok or not.</returns>
        public bool Validate(string defaultErrorMessage)
        {
            // No graphical editor.
            if (mMaskedTextBoxIT == null)
            {
                return(true);
            }

            // Null validation.
            if (!NullAllowed && !HasValue())
            {
                // Validation error.
                if (mErrorProvider != null)
                {
                    mErrorProvider.SetError(this.mMaskedTextBoxIT, defaultErrorMessage);
                }
                return(false);
            }

            // No value in the editor.
            if (NullAllowed && !HasValue())
            {
                return(true);
            }

            // There is a value in the editor.
            bool lIsValid = true;

            if (string.IsNullOrEmpty(Mask))
            {
                // If there is not a mask, check the value according data type.
                lIsValid = DefaultFormats.CheckDataType(this.mMaskedTextBoxIT.Text, mDataType, mNullAllowed);
            }
            else
            {
                lIsValid = !(Logics.Logic.StringToDateTime(mMaskedTextBoxIT.Text, Mask) == null);
                if (mDataType == ModelType.DateTime)
                {
                    lIsValid = lIsValid && IsValidDateTimeAccordingMask(this.mMaskedTextBoxIT.Text);
                }
                // If the editor had lost the mask and now has a valid value -> re-assign the mask.
                if (lIsValid)
                {
                    RestoreMask(false);
                }
            }
            // Show the suitable error message.
            if (!lIsValid)
            {
                // Default or introduction pattern error message
                if (string.IsNullOrEmpty(IPValidationMessage))
                {
                    object[] lArgs = new object[1];
                    lArgs[0] = DefaultFormats.GetHelpMask(mDataType, string.Empty);;
                    string lErrorMessage = CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_VALIDATION_INVALID_FORMAT_MASK, LanguageConstantValues.L_VALIDATION_INVALID_FORMAT_MASK, lArgs);
                    mErrorProvider.SetError(this.mMaskedTextBoxIT, lErrorMessage);
                    mDateTimePickerIT.Value = DateTime.Now;
                }
                else
                {
                    mErrorProvider.SetError(this.mMaskedTextBoxIT, IPValidationMessage);
                }
                return(false);
            }

            // Validation OK.
            return(true);
        }
        /// <summary>
        /// Validates the modified rows values. Not Null and datatype
        /// </summary>
        /// <param name="modifiedRows"></param>
        /// <returns></returns>
        private bool ValidateModifiedRows(DataTable modifiedRows)
        {
            // Error datatable
            DataTable errorReport = new DataTable();
            // Column for the OID
            string instanceColumnsName = CurrentDisplaySet.ServiceInfo.SelectedInstanceArgumentAlias;

            errorReport.Columns.Add(instanceColumnsName);
            // Column for the error message
            string lReportMessage = CultureManager.TranslateString(LanguageConstantKeys.L_MULTIEXE_EXECUTION, LanguageConstantValues.L_MULTIEXE_EXECUTION);

            errorReport.Columns.Add(lReportMessage);

            // Not null and Datatype validation
            foreach (DataRow rowValues in modifiedRows.Rows)
            {
                Oid instanceOID = Adaptor.ServerConnection.GetOid(modifiedRows, rowValues);
                foreach (DisplaySetServiceArgumentInfo argumentInfo in CurrentDisplaySet.ServiceInfo.ArgumentDisplaySetPairs.Values)
                {
                    object value = rowValues[argumentInfo.DSElementName];

                    // Null validation
                    if (value.GetType() == typeof(System.DBNull))
                    {
                        if (!argumentInfo.AllowsNull)
                        {
                            // Add a nuw row in the error datatable
                            DataRow  newReportRow   = errorReport.NewRow();
                            string   nameInScenario = argumentInfo.Alias;
                            object[] lArgs          = new object[1];
                            lArgs[0] = nameInScenario;
                            string lErrorMessage = CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_VALIDATION_NECESARY, LanguageConstantValues.L_VALIDATION_NECESARY, lArgs);
                            newReportRow[lReportMessage]      = lErrorMessage;
                            newReportRow[instanceColumnsName] = UtilFunctions.OidFieldsToString(instanceOID, ' ');
                            errorReport.Rows.Add(newReportRow);
                        }
                    }
                    else
                    {
                        // Data type validation
                        if (!DefaultFormats.CheckDataType(value.ToString(), argumentInfo.DataType, false))
                        {
                            // Add a nuw row in the error datatable
                            DataRow  newReportRow = errorReport.NewRow();
                            string   lMask        = DefaultFormats.GetHelpMask(argumentInfo.DataType, string.Empty);
                            object[] lArgs        = new object[1];
                            lArgs[0] = lMask;
                            string lErrorMessage = argumentInfo.Alias + ":  ";
                            lErrorMessage += CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_VALIDATION_INVALID_FORMAT_MASK, LanguageConstantValues.L_VALIDATION_INVALID_FORMAT_MASK, lArgs);
                            newReportRow[lReportMessage]      = lErrorMessage;
                            newReportRow[instanceColumnsName] = UtilFunctions.OidFieldsToString(instanceOID, ' ');
                            errorReport.Rows.Add(newReportRow);
                        }
                    }
                }
            }

            // If errors have been found, show them
            if (errorReport.Rows.Count > 0)
            {
                // Show error message to the user
                ScenarioManager.LaunchMultiExecutionReportScenario(errorReport, CurrentDisplaySet.ServiceInfo.ServiceAlias, null, null);
                return(false);
            }

            return(true);
        }