/*##############################################################################################################################*/ /*##############################################################################################################################*/ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /*##############################################################################################################################*/ /*##############################################################################################################################*/ #region ButtonAction Events protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } try { FillPropeties(); if (ViewState["CommandName"].ToString() == "Add") { SqlClass.Insert(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Employee added successfully", "تمت إضافة الموظف بنجاح")); } if (ViewState["CommandName"].ToString() == "Edit") { SqlClass.Update(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Employee updated successfully", "تم تعديل الموظف بنجاح")); } ClearItem(); Search(); } catch (Exception Ex) { MessageFun.ShowAdminMsg(this, Ex.Message); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { try { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } ProClass.UsrLoginID = FormSession.LoginID; ProClass.UsrPassword = txtNewPass.Text; SqlClass.UpdatePassword(ProClass); ClearUI(); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Password updated successfully", "تم تعديل كلمة المرور بنجاح")); } catch (Exception Ex) { MessageFun.ShowAdminMsg(this, Ex.Message); } }
public static string GetFirstValidationError(ValidatorCollection validators, string validatorGroup = null) { string errMsg = null; foreach (BaseValidator validator in validators) { if (String.IsNullOrEmpty(validatorGroup)) { if (!validator.IsValid) { errMsg = validator.ErrorMessage; break; } } else { if (!validator.IsValid && validator.ValidationGroup == validatorGroup) { errMsg = validator.ErrorMessage; break; } } } return(errMsg); }
public SettingsViewModel() { m_okCommand = new RelayCommand(Ok, CanOk); m_cancelCommand = new RelayCommand(Cancel); m_clearDatasheetsCacheCommand = new RelayCommand(ClearDatasheetsCache); m_clearImagesCacheCommand = new RelayCommand(ClearImagesCache); m_clearSavedDatasheetsCommand = new RelayCommand(ClearSavedDatasheets); m_checkUpdatesCommand = new RelayCommand(CheckUpdates); m_selectAppDataPathCommand = new RelayCommand(SelectAppDataPath); m_validators = new ValidatorCollection(() => m_okCommand.RaiseCanExecuteChanged()); m_maxCacheSize = new IntegerValidator(0, 100000); m_maxCacheSize.ValidValue = (int)(Global.Configuration.MaxDatasheetsCacheSize / (1024 * 1024)); m_validators.Add(m_maxCacheSize); LanguagePair pair = new LanguagePair(string.Empty); m_availableLanguages.Add(pair); m_selectedLanguage = pair; pair = new LanguagePair("en-US"); if (Global.Configuration.Language == pair.Name) m_selectedLanguage = pair; m_availableLanguages.Add(pair); foreach (var langPath in Directory.EnumerateFiles(Global.LanguagesDirectory)) { string[] tokens = Path.GetFileName(langPath).Split('.'); if (tokens.Length < 2) continue; pair = new LanguagePair(tokens[1]); m_availableLanguages.Add(pair); if (pair.Name == Global.Configuration.Language) m_selectedLanguage = pair; } m_initialPath = AppDataPath = Global.AppDataPath; m_favouritesOnStart = Global.Configuration.FavouritesOnStart; }
public async Task ValidatorCollectionTests() { var error10 = "Must equal 10"; var error20 = "Must equal 20"; var collection = new ValidatorCollection <int>() .Add(e => (e == 10, error10)) .Add(e => (e == 20, error20)); IValidatorCollection <int> target1 = collection; IValidatorCollection target2 = collection; Assert.NotNull(target1); var(_, test1_10) = await target1.ValidateInput(40); var(_, test1_20) = await target1.ValidateInput(10); Assert.Equal(error10, test1_10); Assert.Equal(error20, test1_20); Assert.NotNull(target2); var(_, test2_10) = await target2.ValidateRawInput(40); var(_, test2_20) = await target2.ValidateRawInput(10); Assert.Equal(error10, test2_10); Assert.Equal(error20, test2_20); }
public void GivenNoMessageContext_IsValid_ThrowsArgumentNullException() { var uut = new ValidatorCollection(IntegerToFixConverter.Instance); var message = new TestFixMessageBuilder(TestFixMessageBuilder.DefaultBody).Build(); Assert.Throws <ArgumentNullException>(() => uut.PreValidate(message, null)); }
public void ParserByNewParser() { byte[] message = new MessageBuilder().AddRaw("35=D|53=10|44=145|55=ABC|").Build(); // Create a property mapper and map types to be parsed. SubPropertySetterFactory is responsible creating the actual property setters. var propertyMapper = new TagToPropertyMapper(new SubPropertySetterFactory()); propertyMapper.Map <Order>(); // Create the composite property setter. CompositePropertySetter is the delegator of the sub property setters. var compositeSetter = new CompositePropertySetter(); // Create a validator collection to have all default validators var validators = new ValidatorCollection(IntegerToFixConverter.Instance); // Passing empty options var options = new MessageParserOptions(); // Create MessageParser, passing dependencies var parser = new MessageParser(propertyMapper, compositeSetter, validators, options); Order order = parser.Parse <Order>(message); Console.WriteLine($"Order {order.Symbol} - Px {order.Price}, Qty {order.Quantity}"); }
/// <summary> /// Adds validation error messages to <see cref="FeedbackMessageStore"/>. /// </summary> /// <param name="page"></param> /// <param name="option"></param> public static void AppendValidationErrorsToStore(Page page, FeedbackMessageRenderOption option) { var messageStore = FeedbackMessageStore.Current; if (option.ShowValidationErrors) { ValidatorCollection validators = page.GetValidators(option.ValidationGroup); foreach (FeedbackMessage errorMessage in GetErrorsAsFeedbackMessage(validators)) { messageStore.Add(errorMessage); } } if (option.ShowModelStateErrors) { ModelStateDictionary modelState = page.ModelState; if (!modelState.IsValid) { foreach (FeedbackMessage errorMessage in GetErrorsAsFeedbackMessage(modelState)) { messageStore.Add(errorMessage); } } } }
/// <summary> /// Gets all the assigned validators for the given Editor. /// </summary> /// <param name="editor"></param> /// <returns>ValidatorCollection</returns> private ValidatorCollection GetEditorValidators(FieldSuiteEditor editor) { ValidatorCollection validators = ValidatorManager.BuildValidators(ValidatorsMode.ValidatorBar, editor.Item); ValidatorOptions options = new ValidatorOptions(false); foreach (string marker in editor.FieldInfo.Keys) { FieldInfo fieldInfo = editor.FieldInfo[marker] as FieldInfo; if (fieldInfo == null) { continue; } Sitecore.Data.Validators.BaseValidator validator = validators.Where(x => x.FieldID == fieldInfo.FieldID).FirstOrDefault(); if (validator == null) { continue; } validator.ControlToValidate = marker; } ValidatorManager.Validate(validators, options); ValidatorManager.UpdateValidators(validators); return(validators); }
public static void RemoverValidadores(ValidatorCollection Validators) { for (int x = 0; x < Validators.Count; x++) { Validators[0].IsValid = true; } }
private EditStationForm() { Eto.Serialization.Xaml.XamlReader.Load(this); positionValidator = new NumberValidator(positionTextBox, false, false, errorMessage: "Bitte eine Zahl als Position eingeben!"); nameValidator = new NotEmptyValidator(nameTextBox, errorMessage: "Bitte einen Bahnhofsnamen eingeben!"); validators = new ValidatorCollection(positionValidator, nameValidator); this.Shown += (s, e) => { stationRendererHeight = stationRenderer.Height; stationRendererWidth = stationRenderer.Width; }; stationRenderer.SizeChanged += (s, e) => { if (WindowShown && stationRenderer.Height > stationRendererHeight) { var diff = stationRenderer.Height - stationRendererHeight; this.Height += diff; stationRendererHeight = stationRenderer.Height; } if (WindowShown && stationRenderer.Width > stationRendererWidth) { var diff = stationRenderer.Width - stationRendererWidth; this.Width += diff; stationRendererWidth = stationRenderer.Width; } }; }
internal string[] GetErrorMessages(out bool inError) { string[] strArray = null; inError = false; int num = 0; ValidatorCollection validators = this.Page.GetValidators(this.ValidationGroup); for (int i = 0; i < validators.Count; i++) { IValidator validator = validators[i]; if (!validator.IsValid) { inError = true; if (validator.ErrorMessage.Length != 0) { num++; } } } if (num != 0) { strArray = new string[num]; int index = 0; for (int j = 0; j < validators.Count; j++) { IValidator validator2 = validators[j]; if ((!validator2.IsValid && (validator2.ErrorMessage != null)) && (validator2.ErrorMessage.Length != 0)) { strArray[index] = string.Copy(validator2.ErrorMessage); index++; } } } return(strArray); }
public Handler( ValidatorCollection validator, IActionstepService actionstepService) { _validator = validator; _actionstepService = actionstepService; }
public Handler( ValidatorCollection validator, WCADbContext wCADbContext) { _validator = validator; _wCADbContext = wCADbContext; }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnDeleteIssue_Click(object sender, EventArgs e) { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } //cblConditions.Items.Remove(cblConditions.SelectedValue); for (int i = cblConditions.Items.Count - 1; i >= 0; i--) { if (cblConditions.Items[i].Selected) { cblConditions.Items.RemoveAt(i); } } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnUpdate_Click(object sender, EventArgs e) { try { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } AppPro.UsrLoginID = FormSession.LoginUsr; AppPro.UsrPassword = CryptorEngine.Encrypt(txtNewpassword.Text, true); AppPro.TransactionBy = FormSession.LoginUsr; AppSql.UpdatePassword(AppPro); ClearUI(); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Password updated successfully", "تم تعديل كلمة المرور بنجاح")); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
/*******************************************************************************************************************************/ /*******************************************************************************************************************************/ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /*******************************************************************************************************************************/ /*******************************************************************************************************************************/ #region ButtonAction Events protected void btnSave_Click(object sender, EventArgs e) { try { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } string Action = ViewState["CommandName"].ToString(); FillPropeties(); SqlCs.InsertUpdate(ProCs); ClearItem(); PopulateUI(); ViewState["CommandName"] = "NOT"; MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Save Data successfully", "تم الحفظ البيانات بنجاح")); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
public static void Localize(this ValidatorCollection collection, BaseResourceManager resoourceManager) { foreach (BaseValidator validator in collection) { validator.ErrorMessage = resoourceManager.GetString(validator.ErrorMessage); } }
private ValidatorProvider GetProvider() { var provider = new ValidatorProvider(); provider.Register( StringValidator.NotEmpty, ValidatorCollection.Create <string>() .Add(e => (!string.IsNullOrEmpty(e), "Can't be empty"))); provider.Register( StringValidator.MinLength3, ValidatorCollection.Create <string>() .Add(e => (e.Length >= 3, "Length must be at least 3"))); provider.Register( StringValidator.MinLength7, ValidatorCollection.Create <string>() .Add(e => (e.Length >= 7, "Length must be at least 7"))); provider.Register( StringValidator.Lowercase, ValidatorCollection.Create <string>() .Add(e => (e == e.ToLower(), "Must be in lowercase"))); return(provider); }
/// <summary> /// Gets the model validators. /// </summary> /// <param name="validationGroup">The validation group.</param> /// <returns></returns> public ValidatorCollection GetModelValidators(string validationGroup) { if (validationGroup == null) { validationGroup = String.Empty; } ValidatorCollection validators = new ValidatorCollection(); foreach (IValidator validator in _validatorCollection) { IModelValidator modelValidator = validator as IModelValidator; if (modelValidator != null) { if (String.Compare(modelValidator.ValidationGroup, validationGroup, StringComparison.Ordinal) == 0) { validators.Add(modelValidator); } } else if (validationGroup.Length == 0) { validators.Add(validator); } } return(validators); }
public Handler( ValidatorCollection validator, ITokenSetRepository tokenSetRepository) { _validator = validator; _tokenSetRepository = tokenSetRepository; }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } try { FillPropeties(); SqlClass.InsertUpdate(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("institution Setting saved successfully", "تم حفظ إعدادات المنشأة")); ClearUI(); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
public ConfigForm(Timetable tt, IPluginInterface pluginInterface) { Eto.Serialization.Xaml.XamlReader.Load(this); backupHandle = pluginInterface.BackupTimetable(); this.tt = tt; this.pluginInterface = pluginInterface; heightPerHourValidator = new NumberValidator(heightPerHourTextBox, false, false, errorMessage: "Bitte eine Zahl als Höhe pro Stunde angeben!"); startTimeValidator = new TimeValidator(startTimeTextBox, false, errorMessage: "Bitte eine gültige Uhrzeit im Format hh:mm angeben!"); endTimeValidator = new TimeValidator(endTimeTextBox, false, errorMessage: "Bitte eine gültige Uhrzeit im Format hh:mm angeben!", maximum: new TimeEntry(48, 0)); validators = new ValidatorCollection(heightPerHourValidator, startTimeValidator, endTimeValidator); DropDownBind.Color <TimetableStyle>(pluginInterface.Settings, bgColorComboBox, "BgColor"); DropDownBind.Color <TimetableStyle>(pluginInterface.Settings, stationColorComboBox, "StationColor"); DropDownBind.Color <TimetableStyle>(pluginInterface.Settings, timeColorComboBox, "TimeColor"); DropDownBind.Color <TimetableStyle>(pluginInterface.Settings, trainColorComboBox, "TrainColor"); DropDownBind.Font <TimetableStyle>(stationFontComboBox, stationFontSizeComboBox, "StationFont"); DropDownBind.Font <TimetableStyle>(timeFontComboBox, timeFontSizeComboBox, "TimeFont"); DropDownBind.Font <TimetableStyle>(trainFontComboBox, trainFontSizeComboBox, "TrainFont"); DropDownBind.Width <TimetableStyle>(hourTimeWidthComboBox, "HourTimeWidth"); DropDownBind.Width <TimetableStyle>(minuteTimeWidthComboBox, "MinuteTimeWidth"); DropDownBind.Width <TimetableStyle>(stationWidthComboBox, "StationWidth"); DropDownBind.Width <TimetableStyle>(trainWidthComboBox, "TrainWidth"); var styles = new Dictionary <StationLineStyle, string>() { [StationLineStyle.None] = "Keine", [StationLineStyle.Normal] = "Gerade Linien", [StationLineStyle.Cubic] = "Kubische Linien", }; if (tt.Version == TimetableVersion.JTG2_x) { styles.Remove(StationLineStyle.Cubic); } DropDownBind.Enum <TimetableStyle, StationLineStyle>(stationLinesDropDown, "StationLines", styles); heightPerHourTextBox.TextBinding.AddFloatConvBinding <TimetableStyle, TextControl>(s => s.HeightPerHour); startTimeTextBox.TextBinding.AddTimeEntryConvBinding <TimetableStyle, TextControl>(s => s.StartTime); endTimeTextBox.TextBinding.AddTimeEntryConvBinding <TimetableStyle, TextControl>(s => s.EndTime); includeKilometreCheckBox.CheckedBinding.BindDataContext <TimetableStyle>(s => s.DisplayKilometre); drawStationNamesCheckBox.CheckedBinding.BindDataContext <TimetableStyle>(s => s.DrawHeader); stationVerticalCheckBox.CheckedBinding.BindDataContext <TimetableStyle>(s => s.StationVertical); multitrackCheckBox.CheckedBinding.BindDataContext <TimetableStyle>(s => s.MultiTrack); networkTrainsCheckBox.CheckedBinding.BindDataContext <TimetableStyle>(s => s.DrawNetworkTrains); networkTrainsCheckBox.Enabled = tt.Type == TimetableType.Network; attrs = new TimetableStyle(tt); DataContext = attrs; this.AddCloseHandler(); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } try { FillPropeties(); if (ViewState["CommandName"].ToString() == "Save") { SqlCs.Insert(ProCs); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Save Data successfully", "تم الحفظ بنجاح")); } if (ViewState["CommandName"].ToString() == "Update") { SqlCs.Update(ProCs); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Save Data successfully", "تم الحفظ بنجاح")); } if (ViewState["CommandName"].ToString() == "Delete") { //string Q = " SELECT NatID FROM EmployeeMaster WHERE NatID = " + ddlPkID.SelectedValue + " " // + " UNION " // + " SELECT NatID FROM BlackList WHERE NatID = " + ddlPkID.SelectedValue + " "; //dt = DBFun.FetchData(Q); //if (!DBFun.IsNullOrEmpty(dt)) //{ // MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Deletion can not because of the presence of related records", "لا يمكن الحذف بسبب وجود سجلات مرتبطة")); //} //else //{ SqlCs.Delete(ProCs); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("deleted Data successfully", "تم الحذف بنجاح")); //} } } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, Ex.Message); } ClearUI(); Fillddl(); FillGrid(); }
public void ShouldBeEmptyIfDefaultConstructor() { // Act var collection = new ValidatorCollection(); // Assert collection.Count.ShouldBe(0); }
public Handler( ValidatorCollection validator, IActionstepService actionstepService, ITokenSetRepository tokenSetRepository) { _validator = validator; _actionstepService = actionstepService; _tokenSetRepository = tokenSetRepository; }
public static List <IValidator> GetValidatorsByGroup(ValidatorCollection valColl, string validationGroup) { List <IValidator> groupValidators = new List <IValidator>(); valColl.Cast <IValidator>().ToList().ForEach(delegate(IValidator iVal) { Type valType = iVal.GetType(); switch (valType.Name.ToString()) { case "CustomValidator": CustomValidator val1 = (CustomValidator)iVal; if (val1.ValidationGroup == validationGroup) { groupValidators.Add(val1); } break; case "RequiredFieldValidator": RequiredFieldValidator val2 = (RequiredFieldValidator)iVal; if (val2.ValidationGroup == validationGroup) { groupValidators.Add(val2); } break; case "CompareValidator": CompareValidator val3 = (CompareValidator)iVal; if (val3.ValidationGroup == validationGroup) { groupValidators.Add(val3); } break; case "RegularExpressionValidator": RegularExpressionValidator val4 = (RegularExpressionValidator)iVal; if (val4.ValidationGroup == validationGroup) { groupValidators.Add(val4); } break; case "RangeValidator": RangeValidator val5 = (RangeValidator)iVal; if (val5.ValidationGroup == validationGroup) { groupValidators.Add(val5); } break; default: throw new Exception(valType.ToString() + ": Add this type to the switch -> Helpers.GetValidatorsByGroup()."); } }); return(groupValidators); }
public Handler( ValidatorCollection validator, WCADbContext wCADbContext, IMediator mediator) { _validator = validator; _wCADbContext = wCADbContext; _mediator = mediator; }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } try { FillPropeties(); if (ViewState["CommandName"].ToString() == "Save") { SqlClass.RoleInsert(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " added successfully", "تمت إضافة " + MainName2Ar + " بنجاح")); } if (ViewState["CommandName"].ToString() == "Update") { SqlClass.RoleUpdate(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " updated successfully", "تم تعديل " + MainName2Ar + " بنجاح")); } if (ViewState["CommandName"].ToString() == "Delete") { //dt = DBFun.FetchData("SELECT BrcID FROM CollegesFaculty WHERE BrcID = " + ddlPkID.SelectedValue); //if (!DBFun.IsNullOrEmpty(dt)) if (txtRoleNameEn.Text == "admin" || txtRoleNameAr.Text == "مدير النظام") { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("You can not delete a Role the system administrator", "لا يمكن حذف مجموعة صلاحيات مدير النظام")); //MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Deletion can not because of the presence of related records", "لا يمكن الحذف بسبب وجود سجلات مرتبطة")); } else { SqlClass.RoleDelete(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " deleted successfully", "تم حذف " + MainName2Ar + " بنجاح")); } } ClearUI(); Fillddl(); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSaveDelete"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
public Handler( ValidatorCollection validator, IActionstepService actionstepService, InfoTrackService infoTrackService) { _validator = validator; _actionstepService = actionstepService; _infoTrackService = infoTrackService; }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { try { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } if ((btnSave.Text == "Save") || (btnSave.Text == "حفظ")) { ProClass.Printed = false; ProClass.Status = 1; FillObject(); SqlClass.Insert(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Sticker details added successfully", "تم اضافة بيانات الملصق بنجاح")); } //if ((btnSave.Text == "Update") || (btnSave.Text == "تعديل")) //{ // ProClass.StickerID = ; // ProClass.ModifiedBy = userName; // ProClass.ModifiedDate = DateTime.Now.ToShortDateString(); // ProClass.Printed = false; // ProClass.Status = true; // ProClass.ExceptionReq = Convert.ToBoolean(ViewState["checkStick"]); // FillObject(); // SqlClass.Update(ProClass); // MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Sticker details updated successfully", "تم تعديل بيانات الملصق بنجاح")); // ViewState["checkStick"] = "False"; //} FillGrid(txtIDSearch.Text.Trim()); ClearUI(); } catch (Exception EX) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, EX.Message); } }
public MainViewModel() { m_writeCommand = new RelayCommand(Write); m_readCommand = new RelayCommand(Read); m_restoreDefaultCommand = new RelayCommand(RestoreDefault); m_validators = new ValidatorCollection(null); m_profiles = new ObservableCollection<ProfileViewModel>(); m_months = new ObservableCollection<MonthViewModel>(); Initialize(); }
private EditPartViewModel() { m_okCommand = new RelayCommand(Ok); m_cancelCommand = new RelayCommand(Cancel); m_refreshCommand = new RelayCommand(Refresh, CanRefresh); m_rebuildTagsCommand = new RelayCommand(RebuildTags); m_selectImageCommand = new RelayCommand(SelectImage); m_validators = new ValidatorCollection(() => m_okCommand.RaiseCanExecuteChanged()); m_name = new NoWhitespaceValidator(); m_validators.Add(m_name); m_tags = new SeparatedValuesValidator(','); m_validators.Add(m_tags); }
/// <summary> /// Adds one or more validators that apply to the parameter at the specified parameter index. /// </summary> /// <param name="parameterIndex">Zero-based index of the parameter to apply the validators to.</param> /// <param name="validators">Collection of parameters to add.</param> public void Add(int parameterIndex, params Validator[] validators) { if (_option.Usage.ParameterRequirement == OptionParameterRequirement.NotAllowed) { throw new ParserException(1000, $"Cannot add validators to option {_option.Name} because it does not accept parameters."); } if (parameterIndex >= 0 && _option.Usage.ParameterType == OptionParameterType.Repeating) { throw new ParserException(1000, $"Cannot add a specific parameter validator for option {_option.Name} because it is configured to have repeating parameters, where all parameters share the same validators. Use the ValidateWith overload that does not accept a parameter index."); } if (parameterIndex >= _option.Usage.MaxParameters) { throw new ParserException(1000, $"Parameter index specified {parameterIndex} is greater than the number of parameters allowed for option {_option.Name}."); } if (parameterIndex < -1) parameterIndex = -1; ValidatorCollection validatorList; if (!_validators.TryGetValue(parameterIndex, out validatorList)) { validatorList = new ValidatorCollection(); _validators.Add(parameterIndex, validatorList); } foreach (Validator validator in validators) validatorList.Add(validator); }