void IOracleModelVisitor.VisitConstraint(ConstraintModel item) { if (this._filter(item)) { _items.Add(item); } }
public Response CreatePermission([FromBody] ConstraintModel constraintModel) { Response reqResponse = new Response(); if (constraintModel.username != "root") { reqResponse.SetResponse(401, "Not Authorized", "You are not authorized to create a constraint!", null); goto Finish; } int userId = _userService.GetUser(constraintModel.username, constraintModel.password); if (userId == -1) { reqResponse.SetResponse(401, "Not Authorized", "Invalid credentials inserted!", null); goto Finish; } if (_constraintsService.ExistsConstraint(constraintModel.roleName1, constraintModel.roleName2)) { reqResponse.SetResponse(500, "Already Existing", "The constraint already exists in the system.", null); goto Finish; } _constraintsService.CreateConstraint(constraintModel.roleName1, constraintModel.roleName2); reqResponse = new Response(); Finish: return(reqResponse); }
public async Task AddAsync(ConstraintModel constraintModel) { var constraint = _mapper.Map <Constraint>(constraintModel); await _constraintsRepository.AddAsync(constraint); await _uow.CommitAsync(); }
public override void AppendMissing(ConstraintModel source) { if (_buckets.Add(source)) { var d = base.AppendDifference(source, false); } }
public override void AppendChange(ConstraintModel source, ConstraintModel target, string propertyName) { if (_buckets.Add(source)) { var d = base.AppendDifference(source, target, propertyName); } }
private void createFunc(double shag, ConstraintModel constraint) { if (constraint.x1 == 0 && constraint.x2 == 0) { throw new Exception("Argument error!"); } else if (constraint.x1 == 0) { var index = createNewSeries(); for (double i = -10; i <= 30; i += shag) { var x = Math.Round(i, 2); chartGraphic.Series[index].Points.AddXY(x, (constraint.c) / constraint.x2); } } else if (constraint.x2 == 0) { var index = createNewSeries(); for (double i = 0; i <= 30; i += shag) { var x = Math.Round(i, 2); chartGraphic.Series[index].Points.AddXY((constraint.c) / constraint.x1, x); } } else { var index = createNewSeries(); for (double i = -10; i <= 30; i += shag) { var x = Math.Round(i, 2); chartGraphic.Series[index].Points.AddXY(x, (constraint.c - constraint.x1 * x) / constraint.x2); } } }
public string GetNarrative(ConstraintModel constraint) { IGSettingsManager igSettings = new IGSettingsManager(this.tdb); IFormattedConstraint fc = FormattedConstraintFactory.NewFormattedConstraint(this.tdb, igSettings, null, constraint, null); fc.HasChildren = true; return(fc.GetPlainText(false, false, true)); }
public JsonResult AddConstraint(ConstraintModel cModel) { var userId = User.Identity.GetUserId(); cModel.TimeStamp = DateTime.UtcNow; var constraintTable = Mapper.Map <ConstraintTable>(cModel); var result = _changeService.AddConstraint(constraintTable, userId); return(Json(result)); }
public async Task AddAsync_NewConstraint_CanBeAdded() { var addedConstraint = new Constraint() { Name = "TimeZone", Description = "Description" }; var addedConstraintModel = new ConstraintModel(5, "TimeZone", "Description"); ConfigureModelMapper(addedConstraint, addedConstraintModel); ConfigureRepositoryMock_AddAsync(_constraintsRepositoryMock, addedConstraintModel, addedConstraint); await _constraintsService.AddAsync(addedConstraintModel); Assert.Contains(addedConstraintModel, _constraintModels); }
public ConstraintModelItemViewModel MapFrom(ConstraintModel theConstraintModel) { Debug.Assert(theConstraintModel.HasIdentity); switch (theConstraintModel) { case ExpressionConstraintModel expressionConstraint: return(new ExpressionConstraintModelItemViewModel(expressionConstraint, _windowManager)); case AllDifferentConstraintModel allDifferentConstraint: return(new AllDifferentConstraintModelItemViewModel(allDifferentConstraint, _windowManager)); default: throw new NotSupportedException("Error loading constraint. Unknown constraint type"); } }
public virtual void AppendMissingReference(ConstraintModel constraint, ReferenceTable table) { var d = new DifferenceModel() { Source = constraint, Kind = TypeDifferenceEnum.Orphean, Reference = "Table " + table.ToString(), }; this._lst.Add(d); //if (generateSource) //{ // string p = BuildPath(Path.Combine(this.folderForSource, constraint.TableReference.Owner), "Triggers", constraint.Name); // WriteFile(p, CreateOrReplace + Utils.Unserialize(constraint.Code, true)); //} }
private bool isThePointIncludedIntheConstraint(double x, double y, ConstraintModel constraint) { if (constraint.sign == ">=") { if (x * constraint.x1 + y * constraint.x2 >= constraint.c) { return(true); } } else if (constraint.sign == "<=") { if (x * constraint.x1 + y * constraint.x2 <= constraint.c) { return(true); } } return(false); }
public async Task AddFieldTypesForConstraintAsync(ConstraintModel constraint, IEnumerable <FieldTypeModel> fieldTypes) { var constraintDalModel = _mapper.Map <Constraint>(constraint); var fieldTypeDalModels = _mapper.Map <IEnumerable <FieldType> >(fieldTypes); var fieldTypesConstraintsDalModels = fieldTypeDalModels.Select(item => new FieldTypeConstraint() { Constraint = constraintDalModel, FieldType = item }); await _fieldTypesConstraintsRepository.AddRangeAsync(fieldTypesConstraintsDalModels); await _constraintsRepository.UpdateAsync(constraintDalModel); await _fieldTypeRepository.UpdateRangeAsync(fieldTypeDalModels); await _uow.CommitAsync(); }
public Response CreateHierarchy([FromBody] ConstraintModel roleModel) { Response reqResponse = new Response(); if (roleModel.username != "root") { reqResponse.SetResponse(401, "Not Authorized", "You are not authorized to create a constraint!", null); goto Finish; } int userId = _userService.GetUser(roleModel.username, roleModel.password); if (userId == -1) { reqResponse.SetResponse(401, "Not Authorized", "Invalid credentials inserted!", null); goto Finish; } if (!_roleService.ExistsRole(roleModel.roleName1)) { reqResponse.SetResponse(500, "Not Existing", "Role '" + roleModel.roleName1 + "' does not exist in the system.", null); goto Finish; } if (!_roleService.ExistsRole(roleModel.roleName2)) { reqResponse.SetResponse(500, "Not Existing", "Role '" + roleModel.roleName2 + "' does not exist in the system.", null); goto Finish; } if (_constraintsService.ExistsConstraint(roleModel.roleName1, roleModel.roleName2)) { reqResponse.SetResponse(500, "Forbidden!", "There is a contraint that prevents the creation of a hierarchy between '" + roleModel.roleName1 + "' and '" + roleModel.roleName2 + "'.", null); goto Finish; } _roleService.CreateHierarchy(roleModel.roleName1, roleModel.roleName2); reqResponse = new Response(); Finish: return(reqResponse); }
protected ConstraintModelItemViewModel(ConstraintModel theConstraint) : base(theConstraint) { Constraint = theConstraint; DisplayName = theConstraint.Name; }
private DataAttribute storeConstraint(ConstraintModel constraintModel, DataAttribute dataAttribute) { DataContainerManager dcManager = null; try { dcManager = new DataContainerManager(); if (constraintModel is RangeConstraintModel) { RangeConstraintModel rcm = (RangeConstraintModel)constraintModel; if (rcm.Id == 0) { RangeConstraint constraint = new RangeConstraint(ConstraintProviderSource.Internal, "", AppConfiguration.Culture.Name, rcm.Description, rcm.Negated, null, null, null, rcm.Min, rcm.MinInclude, rcm.Max, rcm.MaxInclude); dcManager.AddConstraint(constraint, dataAttribute); } else { for (int i = 0; i < dataAttribute.Constraints.Count; i++) { if (dataAttribute.Constraints.ElementAt(i).Id == rcm.Id) { ((RangeConstraint)dataAttribute.Constraints.ElementAt(i)).Description = rcm.Description; ((RangeConstraint)dataAttribute.Constraints.ElementAt(i)).Negated = rcm.Negated; ((RangeConstraint)dataAttribute.Constraints.ElementAt(i)).Lowerbound = rcm.Min; ((RangeConstraint)dataAttribute.Constraints.ElementAt(i)).LowerboundIncluded = rcm.MinInclude; ((RangeConstraint)dataAttribute.Constraints.ElementAt(i)).Upperbound = rcm.Max; ((RangeConstraint)dataAttribute.Constraints.ElementAt(i)).UpperboundIncluded = rcm.MaxInclude; break; } } } } if (constraintModel is PatternConstraintModel) { PatternConstraintModel pcm = (PatternConstraintModel)constraintModel; if (pcm.Id == 0) { PatternConstraint constraint = new PatternConstraint(ConstraintProviderSource.Internal, "", AppConfiguration.Culture.Name, pcm.Description, pcm.Negated, null, null, null, pcm.MatchingPhrase, true); dcManager.AddConstraint(constraint, dataAttribute); } else { for (int i = 0; i < dataAttribute.Constraints.Count; i++) { if (dataAttribute.Constraints.ElementAt(i).Id == pcm.Id) { ((PatternConstraint)dataAttribute.Constraints.ElementAt(i)).Description = pcm.Description; ((PatternConstraint)dataAttribute.Constraints.ElementAt(i)).Negated = pcm.Negated; ((PatternConstraint)dataAttribute.Constraints.ElementAt(i)).MatchingPhrase = pcm.MatchingPhrase; break; } } } } if (constraintModel is DomainConstraintModel) { DomainConstraintModel dcm = (DomainConstraintModel)constraintModel; List <DomainItem> items = createDomainItems(dcm.Terms); dcm.Terms = cutSpaces(dcm.Terms); if (items.Count > 0) { if (dcm.Id == 0) { DomainConstraint constraint = new DomainConstraint(ConstraintProviderSource.Internal, "", AppConfiguration.Culture.Name, dcm.Description, dcm.Negated, null, null, null, items); dcManager.AddConstraint(constraint, dataAttribute); } else { DomainConstraint temp = new DomainConstraint(); for (int i = 0; i < dataAttribute.Constraints.Count; i++) { if (dataAttribute.Constraints.ElementAt(i).Id == dcm.Id) { temp = (DomainConstraint)dataAttribute.Constraints.ElementAt(i); temp.Materialize(); temp.Description = dcm.Description; temp.Negated = dcm.Negated; temp.Items = items; dcManager.AddConstraint(temp, dataAttribute); break; } } } } } return(dataAttribute); } finally { dcManager.Dispose(); } }
public void VisitConstraint(ConstraintModel item) { if (InFile(item)) { } }
private ConstraintModel CreateConstraintModel(TemplateConstraint constraint, IGSettingsManager igSettings, IIGTypePlugin igTypePlugin) { IFormattedConstraint fc = FormattedConstraintFactory.NewFormattedConstraint(this.tdb, igSettings, igTypePlugin, constraint); var newConstraintModel = new ConstraintModel() { Id = constraint.Id, Number = constraint.Number.Value, DisplayNumber = constraint.DisplayNumber, IsNew = false, Context = constraint.Context, Conformance = constraint.Conformance, Cardinality = constraint.Cardinality, DataType = constraint.DataType == null ? string.Empty : constraint.DataType, IsBranch = constraint.IsBranch, IsBranchIdentifier = constraint.IsBranchIdentifier, Description = constraint.Description, Notes = constraint.Notes, Label = constraint.Label, PrimitiveText = constraint.PrimitiveText, Value = constraint.Value, ValueDisplayName = constraint.ValueDisplayName, ValueSetId = constraint.ValueSetId, ValueSetDate = constraint.ValueSetDate, ValueCodeSystemId = constraint.CodeSystemId, IsPrimitive = constraint.IsPrimitive, IsHeading = constraint.IsHeading, HeadingDescription = constraint.HeadingDescription, IsInheritable = constraint.IsInheritable, IsSchRooted = constraint.IsSchRooted, ValueConformance = constraint.ValueConformance, Schematron = constraint.Schematron, Category = constraint.Category, IsModifier = constraint.IsModifier, MustSupport = constraint.MustSupport, IsChoice = constraint.IsChoice, IsFixed = constraint.IsFixed, NarrativeProseHtml = fc.GetPlainText(false, false, false) }; newConstraintModel.References = (from tcr in constraint.References join t in this.tdb.Templates on tcr.ReferenceIdentifier equals t.Oid where tcr.ReferenceType == ConstraintReferenceTypes.Template select new ConstraintReferenceModel() { Id = tcr.Id, ReferenceIdentifier = tcr.ReferenceIdentifier, ReferenceType = tcr.ReferenceType, ReferenceDisplay = t.Name }).ToList(); if (constraint.IsStatic == true) { newConstraintModel.Binding = "STATIC"; } else if (constraint.IsStatic == false) { newConstraintModel.Binding = "DYNAMIC"; } else { newConstraintModel.Binding = "DEFAULT"; } List <ConstraintModel> children = newConstraintModel.Children as List <ConstraintModel>; foreach (TemplateConstraint childConstraint in constraint.ChildConstraints.OrderBy(y => y.Order)) { var newChildConstraintModel = CreateConstraintModel(childConstraint, igSettings, igTypePlugin); children.Add(newChildConstraintModel); } return(newConstraintModel); }
protected virtual void ValidateConstraintModel(CompositeValidationResult result, CompositeModel model, ConstraintModel constraint) { if (constraint.ConstraintType == null) { result.InternalValidationErrors.Add(ValidationErrorFactory.NewInternalError("Constraint model had null as constraint type", constraint)); } }
private void ConfigureModelMapper(Constraint objectForMapper, ConstraintModel modelForMapper) { _mapperMock.Setup(mapper => mapper.Map <Constraint>(modelForMapper)).Returns(objectForMapper); _mapperMock.Setup(mapper => mapper.Map <ConstraintModel>(objectForMapper)).Returns(modelForMapper); }
public virtual void AppendChange(ConstraintModel source, ConstraintModel target, string propertyName) { AppendDifference(source, target, propertyName); }
private void ConfigureRepositoryMock_AddAsync(Mock <IConstraintsRepository> repositoryMock, ConstraintModel coreModel, Constraint dalModel) { _constraintsRepositoryMock.Setup(repository => repository.AddAsync(dalModel)).Callback(() => { _constraintModels.Add(coreModel); }); }
public override List <ConstraintsTable_11> Resolve(DbContextOracle context, Action <ConstraintsTable_11> action) { List <ConstraintsTable_11> List = new List <ConstraintsTable_11>(); this.OracleContext = context; var db = context.Database; if (action == null) { action = t => { if (!context.Use(t.SchemaName)) { return; } if (t.TABLE_NAME.ExcludIfStartwith(t.SchemaName, Models.Configurations.ExcludeKindEnum.Table)) { return; } var c = new ConstraintModel() { Name = t.CONSTRAINT_NAME, Owner = t.SchemaName, IndexOwner = t.INDEX_NAME, IndexName = t.INDEX_NAME, Type = t.CONSTRAINT_TYPE, DeleteRule = t.DELETE_RULE, Generated = t.GENERATED, Deferrable = t.DEFERRABLE, Deferred = t.DEFERRED, Rely = t.RELY, Search_Condition = Utils.Serialize(t.search_condition, false), ViewRelated = t.VIEW_RELATED, Invalid = t.INVALID, Status = t.Status, }; c.Reference.Owner = t.R_OWNER; c.Reference.Name = t.R_CONSTRAINT_NAME; c.TableReference.Owner = t.SchemaName; c.TableReference.Name = t.TABLE_NAME; c.Key = c.BuildKey(); if (db.Constraints.TryGet(c.Key, out ConstraintModel c2)) { db.Constraints.Remove(c2); } db.Constraints.Add(c); } } ; ConstraintDescriptor_11 view = new ConstraintDescriptor_11(context.Manager.ConnectionString); sql = string.Format(sql, TableQueryWhereCondition()); using (var reader = context.Manager.ExecuteReader(System.Data.CommandType.Text, sql, QueryBase.DbParams.ToArray())) { List = view.ReadAll(reader, action).ToList(); } return(List); } }
public virtual void AppendMissing(ConstraintModel source) { AppendDifference(source, false); }
public virtual void AppendToRemove(ConstraintModel target) { AppendDifference(target, true); }
public AppViewModel() { // Create LoginInfoModel LoginInfoModel = new LoginInfoModel { ButtonLoginOrLogoutCommand = new RelayCommand <object>(new Action <object>(LoginOrLogoutCommand), new Predicate <object>(LoginOrLogoutCommandCanExecute)) }; // Create ConversationModel ConversationModel = new ConversationModel { ButtonRejectCommand = new RelayCommand <object>(new Action <object>(RejectCommand), new Predicate <object>(RejectCommandCanExecute)), ButtonHangUpCommand = new RelayCommand <object>(new Action <object>(HangUpCommand), new Predicate <object>(HangUpCommandCanExecute)), ButtonAnswerCommand = new RelayCommand <object>(new Action <object>(AnswerCommand), new Predicate <object>(AnswerCommandCanExecute)), ButtonCallCommand = new RelayCommand <object>(new Action <object>(CallCommand), new Predicate <object>(CallCommandCanExecute)), ButtonSelectDevicesCommand = new RelayCommand <object>(new Action <object>(SelectDevicesCommand), new Predicate <object>(SelectDevicesCommandCanExecute)), ButtonMuteUnmuteAudioCommand = new RelayCommand <object>(new Action <object>(MuteUnmuteAudioCommand), new Predicate <object>(MuteUnmuteAudioCommandCanExecute)), ButtonMuteUnmuteVideoCommand = new RelayCommand <object>(new Action <object>(MuteUnmuteVideoCommand), new Predicate <object>(MuteUnmuteVideoCommandCanExecute)), ButtonMuteUnmuteSharingCommand = new RelayCommand <object>(new Action <object>(MuteUnmuteSharingCommand), new Predicate <object>(MuteUnmuteSharingCommandCanExecute)), ButtonAddAudioCommand = new RelayCommand <object>(new Action <object>(AddAudioCommand), new Predicate <object>(AddAudioCommandCanExecute)), ButtonAddRemoveVideoCommand = new RelayCommand <object>(new Action <object>(AddRemoveVideoCommand), new Predicate <object>(AddRemoveVideoCommandCanExecute)), ButtonAddRemoveSharingCommand = new RelayCommand <object>(new Action <object>(AddRemoveSharingCommand), new Predicate <object>(AddRemoveSharingCommandCanExecute)), }; // Create LayoutModel LayoutModel = new LayoutModel(); LayoutModel.LocalVideo.ButtonSetCommand = new RelayCommand <object>(new Action <object>(SetLocalVideoCommand)); LayoutModel.LocalVideo.ButtonPictureInPictureSwitchCommand = new RelayCommand <object>(new Action <object>(SwitchPictureInPictureModeOnLocalVideoCommand)); LayoutModel.RemoteVideo.ButtonSetCommand = new RelayCommand <object>(new Action <object>(SetRemoteVideoCommand)); LayoutModel.RemoteVideo.ButtonPictureInPictureSwitchCommand = new RelayCommand <object>(new Action <object>(SwitchPictureInPictureModeOnRemoteVideoCommand)); LayoutModel.Sharing.ButtonSetCommand = new RelayCommand <object>(new Action <object>(SetSharingCommand)); LayoutModel.Sharing.ButtonPictureInPictureSwitchCommand = new RelayCommand <object>(new Action <object>(SwitchPictureInPictureModeOnSharingCommand)); LayoutModel.PropertyChanged += LayoutModel_PropertyChanged; // Create DevicesModel DevicesModel = new DevicesModel(); // Create UsersModel UsersModel = new UsersModel(); // Create LanguagesModel LanguagesModel = new LanguagesModel() { ButtonSetCommand = new RelayCommand <object>(new Action <object>(SetLanguageCommand)) }; // Get Rainbow Languages service rbLanguages = Rainbow.Common.Languages.Instance; SetLanguagesList(rbLanguages.GetLanguagesIdList()); // Create ConstraintModel ConstraintModel = new ConstraintModel() { MaxFrameRateValue = "10", WidthValue = "640", HeightValue = "480", VideoConstraint = true, ButtonSetConstraintCommand = new RelayCommand <object>(new Action <object>(SetConstraintCommand), new Predicate <object>(SetConstraintCommandCanExecute)) }; }
protected virtual void Visit(ConstraintModel source, ConstraintModel target, TypeDifferenceEnum kind, string propertyName, DifferenceModel item) { }