internal bool ValidateProperty() { bool res = true; AlertsModel.Select(isOpen: false); // default var textProperty = ComponentModelProperty.ExtensionModel.TextProperty; bool validateModel = string.IsNullOrEmpty(textProperty).IsFalse(); ComponentModelProperty.ValidateModel(validateModel); // show alerts if (validateModel.IsFalse()) { AlertsModel.Select(TAlertsModel.TKind.Warning); AlertsModel.Select(Properties.Resource.RES_EMPTY, Properties.Resource.RES_TEXT_EMPTY); AlertsModel.Select(isOpen: true); res = false; } AlertsModel.Refresh(); return(res); }
internal void RefreshModel(TEntityAction entityAction) { if (entityAction.NotNull()) { var gadgets = new Collection <TActionComponent> (); TActionConverter.Collection(TCategory.Material, gadgets, entityAction); if (gadgets.Any()) { foreach (var component in gadgets) { var selection = TSelectionInfo.Create(component.Models.GadgetMaterialModel.GadgetName, component.Models.GadgetMaterialModel.Id, component.Models.GadgetMaterialModel.Enabled); selection.SetImage(component.Models.GadgetMaterialModel.GetImage()); entityAction.SupportAction.SelectionCollection.Add(selection); } ComponentModelProperty.ValidateModel(true); ComponentModelProperty.ExtensionModel.SelectModel(TCategory.Target, entityAction); // update Selection Property (Material list) AlertsModel.Select(isOpen: false); // default } else { ComponentModelProperty.ValidateModel(false); // show alerts AlertsModel.Select(TAlertsModel.TKind.Warning); AlertsModel.Select(Properties.Resource.RES_EMPTY, Properties.Resource.RES_LIST_EMPTY); AlertsModel.Select(isOpen: true); } } }
internal bool ValidateProperty(string propertyName) { bool res = true; AlertsModel.Select(isOpen: false); // default if (propertyName.Equals("TextProperty", StringComparison.InvariantCulture)) { ComponentModelProperty.ValidateModel(true); var entityAction = TEntityAction.CreateDefault; entityAction.CategoryType.Select(TCategory.Material); RequestModel(entityAction); // test empty if (string.IsNullOrEmpty(entityAction.ModelAction.ExtensionTextModel.Text)) { ComponentModelProperty.ValidateModel(false); // show alerts AlertsModel.Select(TAlertsModel.TKind.Warning); AlertsModel.Select(Properties.Resource.RES_EMPTY, Properties.Resource.RES_TEXT_EMPTY); AlertsModel.Select(isOpen: true); res = false; } } AlertsModel.Refresh(); return(res); }
bool ValidateProperty() { AlertsModel.Select(isOpen: false); // default // TextProperty var textProperty = ComponentModelProperty.ExtensionModel.TextProperty; var emptyText = string.IsNullOrEmpty(textProperty); var emptyRegistration = m_Registration.ValidateId.IsFalse(); bool validateModel = emptyText.IsFalse() && emptyRegistration.IsFalse(); ComponentModelProperty.ValidateModel(validateModel); // show alerts if (validateModel.IsFalse()) { string message = emptyText ? Properties.Resource.RES_TEXT_EMPTY : string.Empty; message += Environment.NewLine; message += emptyRegistration ? Properties.Resource.RES_REGISTRATION_EMPTY : string.Empty; AlertsModel.Select(TAlertsModel.TKind.Warning); AlertsModel.Select(Properties.Resource.RES_EMPTY, message); AlertsModel.Select(isOpen: true); } AlertsModel.Refresh(); return(validateModel); }
internal void ModifyEnter(TActionComponent component) { if (component.NotNull()) { if (component.IsCategory(TCategory.Result)) { var gadget = component.Models.GadgetResultModel; if (gadget.HasRegistration) { gadget.RequestContent(m_Registration); } var entityAction = TEntityAction.CreateDefault; TActionConverter.Request(TCategory.Result, component, entityAction); ComponentModelProperty.SelectModel(entityAction); ComponentModelProperty.ValidateModel(validated: false); ComponentModelProperty.IsComponentModelEnabled = false; ComponentModelProperty.IsExtensionModelEnabled = false; } } }
internal bool ValidateProperty(string propertyName) { bool res = true; if (propertyName.Equals("TextProperty", StringComparison.InvariantCulture)) { AlertsModel.Select(isOpen: false); // default ComponentModelProperty.ValidateModel(true); var entityAction = TEntityAction.CreateDefault; entityAction.CategoryType.Select(TCategory.Material); RequestModel(entityAction); // test empty if (string.IsNullOrEmpty(entityAction.ModelAction.ExtensionTextModel.Text)) { ComponentModelProperty.ValidateModel(false); // show alerts AlertsModel.Select(TAlertsModel.TKind.Warning); AlertsModel.Select(Properties.Resource.RES_EMPTY, Properties.Resource.RES_TEXT_EMPTY); AlertsModel.Select(isOpen: true); res = false; } // test duplicated else { foreach (var gadget in m_Gadgets) { var material = gadget.Value.Material; var item = ComponentModelProperty.ExtensionModel.TextProperty; bool validateModel = string.Compare(material, item, true, CultureInfo.InvariantCulture).Equals(0).IsFalse(); // check same gadget (change) if (gadget.Value.Id.Equals(ComponentModelProperty.Id).IsFalse()) { ComponentModelProperty.ValidateModel(validateModel); // show alerts if (validateModel.IsFalse()) { var message = $"Material (Text = {material})"; AlertsModel.Select(TAlertsModel.TKind.Warning); AlertsModel.Select(Properties.Resource.RES_DUPLICATED, message); AlertsModel.Select(isOpen: true); res = false; break; } } } } AlertsModel.Refresh(); if (res) { //TGadgetMaterialActionComponent.Select (GadgetModel, entityAction); } } return(res); }