예제 #1
0
        public IActionResult DeleteContact(int id)
        {
            SQLRepository.ReadAllContactsToAddresses()?
            .Where(c2a => c2a.ContactID == id)
            .Select(c2a => c2a.ID)
            .ToList()
            .ForEach(i => SQLRepository.DeleteContactToAddress(i));

            SQLRepository.ReadAllContactInformations()?
            .Where(ci => ci.ContactID == id)
            .Select(ci => ci.ID)
            .ToList()
            .ForEach(i => SQLRepository.DeleteContactInformation(i));

            SQLRepository.DeleteContact(id);
            return(RedirectToAction(nameof(Contacts)));
        }
예제 #2
0
        public TracingReceiveStrategy(EMoflonTCPServer server, SQLRepository repository)
        {
            resetBuffer();
            this.repository = repository;
            this.stream     = server.inOutStream;
            this.server     = server;


            LoadTracingFileWorker = new BackgroundWorker();
            LoadTracingFileWorker.WorkerReportsProgress      = true;
            LoadTracingFileWorker.WorkerSupportsCancellation = true;
            LoadTracingFileWorker.DoWork             += new DoWorkEventHandler(worker_DoWork);
            LoadTracingFileWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
            LoadTracingFileWorker.ProgressChanged    += new ProgressChangedEventHandler(worker_ProgressChanged);

            LoadTracingFileWorker.RunWorkerAsync();
        }
        public override List <String> doRule(SQLElement eaElement, SQLRepository repository)
        {
            List <String> results = new List <string>();

            if (eaElement.Stereotype == SDMModelingMain.ObjectVariableStereotype ||
                eaElement.Stereotype == "SDM_Object" ||
                eaElement.Stereotype == TGGModelingMain.TggObjectVariableStereotype ||
                eaElement.Stereotype == TGGModelingMain.TggCorrespondenceStereotype)
            {
                SQLElement classifier = EAUtil.getClassifierElement(repository, eaElement.ClassifierID);
                if (classifier == null)
                {
                    results.Add("must have a valid classifier");
                }
            }
            return(results);
        }
예제 #4
0
        public void initializeComponent(SQLRepository repository, CSPController controller)
        {
            this.controller         = controller;
            this.repository         = repository;
            this.AllowUserToAddRows = false;
            DataGridViewRow templateRow = new DataGridViewRow();

            templateRow.Height = 15;
            this.RowTemplate   = templateRow;

            this.typedExpressions = new List <Expression>();

            this.GridColor                   = System.Drawing.SystemColors.ControlLight;
            this.AllowUserToAddRows          = false;
            this.AllowUserToDeleteRows       = false;
            this.AllowUserToResizeRows       = false;
            this.MultiSelect                 = false;
            this.BorderStyle                 = System.Windows.Forms.BorderStyle.Fixed3D;
            this.BackgroundColor             = System.Drawing.SystemColors.ControlLightLight;
            this.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.MultiSelect                 = false;
            this.RowHeadersVisible           = false;
            this.SelectionMode               = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;

            this.CellDoubleClick  += new DataGridViewCellEventHandler(ParametersDataGridView_CellDoubleClick);
            this.SelectionChanged += new EventHandler(ParametersDataGridView_SelectionChanged);
            this.CellEndEdit      += new DataGridViewCellEventHandler(CSPConstraintDataGridView_CellEndEdit);

            this.TabIndex = 24;

            DataTable.Columns.Add("Value");
            DataTable.Columns.Add("Information");


            DataTable.AcceptChanges();
            this.DataSource              = DataTable;
            this.Columns[0].FillWeight   = 0.7F;
            this.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.Columns[0].SortMode     = DataGridViewColumnSortMode.NotSortable;
            this.Columns[0].ReadOnly     = false;

            this.Columns[1].FillWeight   = 0.3F;
            this.Columns[1].SortMode     = DataGridViewColumnSortMode.NotSortable;
            this.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.Columns[1].ReadOnly     = true;
        }
예제 #5
0
        private void addPersonButton_Click(object sender, EventArgs e)
        {
            Contact p = new Contact();

            p.FirstName = firstNameTextBox.Text;
            p.LastName  = lastNameTextBox.Text;
            //p.Email = emailTextBox.Text;
            p.SSN = ssnTextBox.Text;

            SQLRepository.AddNewContact(p.SSN, p.FirstName, p.LastName);



            listBox1.Items.Add(p);

            DeleteTextBoxInfo();
        }
예제 #6
0
 public static EA.TaggedValue setTaggedValue(SQLRepository repository, EA.Element elem, String name, String value)
 {
     EA.Element element = elem;
     if (elem is SQLElement)
     {
         element = repository.GetOriginalRepository().GetElementByID(elem.ElementID);
     }
     element.TaggedValues.Refresh();
     EA.TaggedValue aTag = findTaggedValue(element, name);
     if (aTag == null)
     {
         aTag = (EA.TaggedValue)element.TaggedValues.AddNew(name, value);
     }
     aTag.Value = value;
     aTag.Update();
     return(aTag);
 }
예제 #7
0
 /// <summary>
 /// Creates or editExistingLink the MethodTag with the given name and value of the given method
 /// </summary>
 /// <param name="element"></param>
 /// <param name="name"></param>
 /// <param name="value"></param>
 /// <returns>the created or edited MethodTag</returns>
 public static EA.MethodTag setTaggedValue(SQLRepository repository, EA.Method meth, String name, String value)
 {
     EA.Method method = meth;
     if (meth is SQLMethod)
     {
         method = repository.GetOriginalRepository().GetMethodByID(meth.MethodID);
     }
     method.TaggedValues.Refresh();
     EA.MethodTag aTag = findTaggedValue(method, name);
     if (aTag == null)
     {
         aTag = (EA.MethodTag)method.TaggedValues.AddNew(name, value);
     }
     aTag.Value = value;
     aTag.Update();
     return(aTag);
 }
예제 #8
0
        private static Object computeActivity(Object owningOperation, SQLRepository repository, String pathEntry)
        {
            Object     eaObject     = owningOperation;
            SQLMethod  actMethod    = eaObject as SQLMethod;
            SQLElement methodParent = repository.GetElementByID(actMethod.ParentID);

            foreach (SQLElement actContainer in methodParent.Elements)
            {
                String guidOfAssociatedMethod = EAEcoreAddin.Util.EAUtil.findTaggedValue(actContainer, SDMModelingMain.SDMContainerAssociatedMethodTaggedValueName).Value;
                if (guidOfAssociatedMethod == actMethod.MethodGUID)
                {
                    eaObject = actContainer;
                    break;
                }
            }
            return(eaObject);
        }
예제 #9
0
        public static DomainType getDomainOfLinkVariable(SQLRepository repository, SQLConnector tggLv)
        {
            TGGObjectVariable supplier = new TGGObjectVariable(repository.GetElementByID(tggLv.SupplierID), repository);
            TGGObjectVariable client   = new TGGObjectVariable(repository.GetElementByID(tggLv.ClientID), repository);

            DomainType supplierDom = getDomainOfObjectVariable(repository, supplier);
            DomainType clientDom   = getDomainOfObjectVariable(repository, client);

            if (!supplierDom.Equals(clientDom))
            {
                return(DomainType.CORRESPONDENCE);
            }
            else
            {
                return(supplierDom);
            }
        }
        public override List <String> doRule(SQLElement eaElement, SQLRepository repository)
        {
            List <String> results = new List <string>();

            if (eaElement.Stereotype == SDMModelingMain.StoryNodeStereotype)
            {
                if (eaElement.Diagrams.Count == 1)
                {
                    SQLDiagram evacDiagram = eaElement.Diagrams.GetAt(0);
                    if (evacDiagram.Name != eaElement.Name)
                    {
                        results.Add("Diagram of evacuated storypattern must have the same name as the storypattern itself");
                    }
                }
            }
            return(results);
        }
예제 #11
0
        private static DomainType determineDomainSimple(SQLRepository repository, TGGObjectVariable tggOv)
        {
            if (tggOv.sqlElement.Stereotype == TGGModelingMain.TggCorrespondenceStereotype)
            {
                return(DomainType.CORRESPONDENCE);
            }

            EClass classifierElement = tggOv.Classifier;

            if (classifierElement != null)
            {
                SQLElement eClass          = repository.GetElementByID(classifierElement.EaElement.ElementID);
                SQLPackage wantedDomainPkg = repository.GetPackageByID(eClass.PackageID);
                while (!wantedDomainPkg.IsModel)
                {
                    wantedDomainPkg = repository.GetPackageByID(wantedDomainPkg.ParentID);
                }

                SQLPackage tggPackage = repository.GetPackageByID(tggOv.sqlElement.PackageID);
                while (!tggPackage.IsModel)
                {
                    tggPackage = repository.GetPackageByID(tggPackage.ParentID);
                }

                TGG tgg = new TGG(repository, tggPackage);
                tgg.loadTreeFromTaggedValue();

                // source metamodel == target metamodel
                if (tgg.getDomain(DomainType.SOURCE).MetamodelGuid == tgg.getDomain(DomainType.TARGET).MetamodelGuid)
                {
                    return(determineDomainUsingPrefixConvention(tggOv, repository));
                }

                if (wantedDomainPkg.PackageGUID == tgg.getDomain(DomainType.SOURCE).MetamodelGuid)
                {
                    return(DomainType.SOURCE);
                }
                else if (wantedDomainPkg.PackageGUID == tgg.getDomain(DomainType.TARGET).MetamodelGuid)
                {
                    return(DomainType.TARGET);
                }
            }

            return(determineDomainUsingPrefixConvention(tggOv, repository));
        }
예제 #12
0
        public EditMultipleObjects(SQLRepository repository)
        {
            InitializeComponent();

            worker = new BackgroundWorker();
            worker.WorkerReportsProgress      = true;
            worker.WorkerSupportsCancellation = true;
            worker.DoWork             += new DoWorkEventHandler(worker_DoWork);
            worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
            worker.ProgressChanged    += new ProgressChangedEventHandler(worker_ProgressChanged);

            this.repository    = repository;
            this.StartPosition = FormStartPosition.CenterScreen;
            //gather selected objectvariables
            EA.Diagram currentDiagram = repository.GetCurrentDiagram();
            this.currentDiag = currentDiagram;
            if (currentDiagram != null)
            {
                foreach (EA.DiagramObject diagramObject in currentDiagram.SelectedObjects)
                {
                    EA.Element actElement = repository.GetOriginalRepository().GetElementByID(diagramObject.ElementID);
                    if (actElement.MetaType == SDMModelingMain.ObjectVariableStereotype)
                    {
                        selectedObjectVariables.Add(actElement);
                        selectedObjectVariableIDs.Add(actElement.ElementID);
                    }
                }
            }

            //gather link variables between selected objectvariables
            foreach (EA.Element selectedObject in this.selectedObjectVariables)
            {
                foreach (EA.Connector con in selectedObject.Connectors)
                {
                    if (con.ClientID == selectedObject.ElementID && selectedObjectVariableIDs.Contains(con.SupplierID) && con.MetaType == SDMModelingMain.LinkVariableStereotype)
                    {
                        selectedLinkVariables.Add(con);
                    }
                }
            }
            if (currentDiag != null)
            {
                ShowDialog();
            }
        }
        public override void doRuleQuickFix(SQLConnector eaConnector, SQLRepository repository, int i, String errorMessage)
        {
            LinkVariable lv = new LinkVariable(eaConnector, repository);

            lv.loadTreeFromTaggedValue();


            if (errorMessage == "The rolename(s) of the LinkVariable differs from the related EReference")
            {
                if (i == 0)
                {
                    SQLConnector referencedReference = SDMUtil.getRelatedEReference(lv);
                    if (referencedReference != null)
                    {
                        EA.Diagram currentDiagram = repository.GetCurrentDiagram();

                        lv.linkDialogueEntry.clientRoleName   = referencedReference.ClientEnd.Role;
                        lv.linkDialogueEntry.supplierRoleName = referencedReference.SupplierEnd.Role;
                        lv.saveTreeToEATaggedValue(true);


                        if (currentDiagram != null)
                        {
                            repository.SaveDiagram(currentDiagram.DiagramID);
                            repository.ReloadDiagram(currentDiagram.DiagramID);
                        }
                    }
                }
            }
            else
            {
                if (i == 0)
                {
                    if (eaConnector.Stereotype == SDMModelingMain.LinkVariableStereotype)
                    {
                        lv = new LinkVariable(eaConnector, repository);
                    }
                    else if (eaConnector.Stereotype == TGGModelingMain.TggLinkVariableStereotype)
                    {
                        lv = new TGGLinkVariable(eaConnector, repository);
                    }
                    LinkVariablePropertiesForm lvForm = new LinkVariablePropertiesForm(lv, repository, true);
                }
            }
        }
예제 #14
0
        public void GetAll()
        {
            //Act
            var options = new DbContextOptionsBuilder <DataContext>()
                          .UseInMemoryDatabase(databaseName: "Testing_InMemoryDatabase3")
                          .Options;
            int count = 0;
            IEnumerable <Vraag> responseGetAll = null;
            Vraag firstResponse = null;


            var vraag = new Vraag
            {
                MaxScoreVraag           = 10,
                TypeVraagId             = 1,
                VraagStelling           = "Dit is de stelling van de vraag",
                JsonCorrecteAntwoord    = "JsonCorrecteAntwoord",
                JsonMogelijkeAntwoorden = "JsonMogelijkeAntwoorden"
            };

            //Arrange
            using (var context = new DataContext(options))
            {
                var repository = new SQLRepository <Vraag>(context);
                repository.Add(vraag);
                repository.SaveChanges();
                responseGetAll = repository.GetAll();
                count          = responseGetAll.Count();
                firstResponse  = responseGetAll.FirstOrDefault();
            }

            //Assert
            using (var context = new DataContext(options))
            {
                Assert.That(1, Is.EqualTo(count));

                Assert.IsNotNull(firstResponse.Id);
                Assert.IsNotEmpty(firstResponse.Id.ToString());
                Assert.That(vraag.JsonCorrecteAntwoord, Is.EqualTo(firstResponse.JsonCorrecteAntwoord));
                Assert.That(vraag.JsonMogelijkeAntwoorden, Is.EqualTo(firstResponse.JsonMogelijkeAntwoorden));
                Assert.That(vraag.MaxScoreVraag, Is.EqualTo(firstResponse.MaxScoreVraag));
                Assert.That(vraag.TypeVraagId, Is.EqualTo(firstResponse.TypeVraagId));
                Assert.That(vraag.VraagStelling, Is.EqualTo(firstResponse.VraagStelling));
            }
        }
예제 #15
0
        public override void doRuleQuickFix(SQLMethod eaMethod, SQLRepository repository, int i)
        {
            if (i == 0)
            {
                EA.Element parent = repository.GetOriginalRepository().GetElementByID(eaMethod.ParentID);

                if (parent.Stereotype == ECOREModelingMain.EClassStereotype)
                {
                    foreach (EA.Element sdmContainer in parent.Elements)
                    {
                        if (sdmContainer.Stereotype == SDMModelingMain.SdmContainerStereotype)
                        {
                            EA.TaggedValue associatedTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(sdmContainer, SDMModelingMain.SDMContainerAssociatedMethodTaggedValueName);
                            if (associatedTag != null)
                            {
                                String associatedTagValue = associatedTag.Value;
                                if (associatedTagValue == eaMethod.MethodGUID)
                                {
                                    foreach (EA.Element aNode in sdmContainer.Elements)
                                    {
                                        if (aNode.Stereotype == SDMModelingMain.StartNodeStereotype)
                                        {
                                            String parameters = "";
                                            foreach (SQLParameter param in eaMethod.Parameters)
                                            {
                                                parameters += param.Name + ": " + param.Type + ", ";
                                            }
                                            if (parameters.Length > 0)
                                            {
                                                parameters = parameters.Substring(0, parameters.Length - 2);
                                            }
                                            String nameShouldBe = parent.Name + "::" + eaMethod.Name + " (" + parameters + "): " + eaMethod.ReturnType.ToString();
                                            aNode.Name = nameShouldBe;
                                            aNode.Update();
                                            sdmContainer.Name = eaMethod.Name + " SDM";
                                            sdmContainer.Update();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #16
0
        public bool EA_OnPostNewConnector(EA.Repository Repository, EA.EventProperties Info)
        {
            preventCascade = true;
            SQLRepository sqlRepository = new SQLRepository(Repository, false);

            EA.Connector connector      = Repository.GetConnectorByID(int.Parse((string)Info.Get(0).Value));
            EA.Diagram   currentDiagram = sqlRepository.GetCurrentDiagram();
            sqlRepository.SaveDiagram(currentDiagram.DiagramID);

            bool modifiedBySDMModeling   = sdmModeling.EA_OnPostNewConnector(sqlRepository, connector, currentDiagram);
            bool modifiedByTGGModeling   = tggModeling.EA_OnPostNewConnector(sqlRepository, connector, currentDiagram);
            bool modifiedByECoreModeling = ecoreModeling.EA_OnPostNewConnector(sqlRepository, connector, currentDiagram);

            incrementalUpdateAdapter.EA_OnPostNewConnector(Repository, Info);

            preventCascade = false;
            return(modifiedBySDMModeling || modifiedByTGGModeling || modifiedByECoreModeling);
        }
        public void GetGenreCount()
        {
            var options = new DbContextOptionsBuilder <MoviesContext>()
                          .UseInMemoryDatabase(databaseName: "MRGetGenreCount")
                          .Options;

            addMovies(options);

            using (var context = new MoviesContext(options))
            {
                SQLRepository controller = new SQLRepository(context);

                List <GenreCount> actual = controller.GetGenreCount();

                Assert.Single(actual);             // just one Genre in the in memory DB - Comedy
                Assert.Equal(22, actual[0].Count); // 22 comedies
            }
        }
        public void GetPartyById()
        {
            var options = new DbContextOptionsBuilder <MoviesContext>()
                          .UseInMemoryDatabase(databaseName: "MRGetPartyById")
                          .Options;

            addParties(options);

            using (var context = new MoviesContext(options))
            {
                SQLRepository controller = new SQLRepository(context);

                Party result = controller.GetPartyById(1);

                Assert.Equal(1, result.Id);
                Assert.Equal("First", result.Name);
            }
        }
        public void GetNextMoviesForMovieByIdForSuggestions()
        {
            var options = new DbContextOptionsBuilder <MoviesContext>()
                          .UseInMemoryDatabase(databaseName: "MRNextMoviesForMovieForSuggestions")
                          .Options;

            addNextMovies(options);

            using (var context = new MoviesContext(options))
            {
                SQLRepository controller = new SQLRepository(context);

                List <NextMovie> nextMovies = controller.GetNextMoviesForMovieByIdForSuggestions(1, 2, 0);

                Assert.Equal(2, nextMovies.Count);
                Assert.True(nextMovies[0].Score >= nextMovies[1].Score);
            }
        }
        public void GetAllCommunityLikes()
        {
            var options = new DbContextOptionsBuilder <MoviesContext>()
                          .UseInMemoryDatabase(databaseName: "MRGetCommLikesAll")
                          .Options;

            addCommunityLikes(options);

            using (var context = new MoviesContext(options))
            {
                SQLRepository controller = new SQLRepository(context);

                List <UserLikedMovie> movieScores = controller.GetAllCommunityLikes();

                Assert.Equal(3, movieScores.Count);
                Assert.True(movieScores[0].Score >= movieScores[1].Score);
            }
        }
        public void GetAllMoviesWithPagination()
        {
            var options = new DbContextOptionsBuilder <MoviesContext>()
                          .UseInMemoryDatabase(databaseName: "MRAllMovies")
                          .Options;

            addMovies(options);
            // using a context instance to run the repository method
            using (var context = new MoviesContext(options))
            {
                SQLRepository controller = new SQLRepository(context);

                var allMovies = controller.GetAllMovies(1, 20);

                Assert.Equal(20, allMovies.Count);
                Assert.Equal("In Memory DB Movie 3", allMovies[2].Title);
            }
        }
예제 #22
0
        public static void configureConnectorEnd(SQLRepository sqlRepository, EA.ConnectorEnd sourceOrTarget, int valueId, String cardinality)
        {
            EA.Element targetEClass = sqlRepository.GetElementByID(valueId).getRealElement();
            sourceOrTarget.Role = targetEClass.Name.Substring(0, 1).ToLower() + targetEClass.Name.Substring(1, targetEClass.Name.Length - 1);

            // If the association end has a cardinality larger than 1, add a 'plural s' to the role name.
            String lowerBound = "";
            String upperBound = "";

            EcoreUtil.computeLowerUpperBound(cardinality, ref lowerBound, ref upperBound);
            if (upperBound == EcoreUtil.ARBITRARY_MANY_MULTIPLICITY_PLACEHOLDER || int.Parse(upperBound) > 1)
            {
                sourceOrTarget.Role = sourceOrTarget.Role + "s";
            }

            sourceOrTarget.Cardinality = cardinality;
            sourceOrTarget.Update();
        }
예제 #23
0
 private static object computeTGGSchemaPackage(object eaObject, SQLRepository repository, string pathEntry)
 {
     if (eaObject == null)
     {
         foreach (SQLPackage modelRoot in repository.Models)
         {
             foreach (SQLPackage metamodelPackage in modelRoot.Packages)
             {
                 if (metamodelPackage.Name == getNameOfPathEntry(pathEntry))
                 {
                     eaObject = metamodelPackage;
                     break;
                 }
             }
         }
     }
     return(null);
 }
예제 #24
0
        public void EA_OnPostNewDiagram(EA.Repository Repository, EA.EventProperties Info)
        {
            int           diagramID = int.Parse(Info.Get(0).Value.ToString());
            SQLRepository sqlRep    = new SQLRepository(Repository, false);

            EA.Diagram diagram         = Repository.GetDiagramByID(diagramID);
            String     diagramMetatype = diagram.MetaType;

            if (TGGModelingMain.TggSchemaDiagramMetatype.Contains(diagram.MetaType))
            {
                SQLPackage newTGGProject = sqlRep.GetPackageByID(diagram.PackageID);
                if (EAUtil.packageIsModel(newTGGProject, sqlRep) && newTGGProject.Diagrams.Count == 1 && newTGGProject.getRealPackage().StereotypeEx == "")
                {
                    NewTGGProjectDialog tggDialog = new NewTGGProjectDialog(sqlRep, newTGGProject);
                    tggDialog.ShowDialog();
                }
            }
        }
예제 #25
0
        public static ObjectVariable createCorrectOvType(SQLElement eaElement, SQLRepository repository)
        {
            ObjectVariable ov = null;

            if (eaElement.Stereotype == SDMModelingMain.ObjectVariableStereotype)
            {
                ov = new ObjectVariable(eaElement, repository);
            }
            else if (eaElement.Stereotype == TGGModelingMain.TggObjectVariableStereotype)
            {
                ov = new TGGObjectVariable(eaElement, repository);
            }
            else if (eaElement.Stereotype == TGGModelingMain.TggCorrespondenceStereotype)
            {
                ov = new TGGCorrespondence(eaElement, repository);
            }
            return(ov);
        }
예제 #26
0
 /// <summary>
 /// Searches for a DiagramObject with the same ID as the element on the given diagram
 /// </summary>
 /// <param name="element"></param>
 /// <param name="diagram"></param>
 /// <returns>The found DiagramObject or null if there exists none</returns>
 public static EA.DiagramObject findDiagramObject(SQLRepository repository, EA.Element element, EA.Diagram diagram)
 {
     EA.Diagram currentDiagram = diagram;
     if (currentDiagram is SQLDiagram)
     {
         currentDiagram = sqlEAObjectToOriginalObject(repository, currentDiagram) as EA.Diagram;
     }
     EA.DiagramObject val = null;
     foreach (EA.DiagramObject diagObj in currentDiagram.DiagramObjects)
     {
         if (diagObj.ElementID == element.ElementID)
         {
             val = diagObj;
             break;
         }
     }
     return(val);
 }
예제 #27
0
        public void initializeInformation(IExpressionProvider expressionProvider, Expression expression, SQLRepository repository)
        {
            this.expressionProvider = expressionProvider;
            this.repository         = repository;

            userChanged = false;
            this.cmbExpressions.Items.Clear();
            this.cmbExpressions.Items.AddRange(expressionProvider.getExpressionStringList().ToArray());
            if (cmbExpressions.Items.Count > 0)
            {
                this.cmbExpressions.SelectedIndex = 0;
            }


            setVisualOutput(expressionProvider, expression);

            userChanged = true;
        }
예제 #28
0
 public void doRules(Object eaObject, SQLRepository repository)
 {
     foreach (Rule rule in listOfRules)
     {
         if (ConsistencyModule.Canceled)
         {
             return;
         }
         try
         {
             doSingleRule(eaObject, repository, rule);
         }
         catch (Exception e)
         {
             MessageBox.Show("Exception while doing validation rules \r\n " + e.StackTrace);
         }
     }
 }
예제 #29
0
        public void Update()
        {
            //Act
            var options = new DbContextOptionsBuilder <DataContext>()
                          .UseInMemoryDatabase(databaseName: "Testing_InMemoryDatabase7")
                          .Options;

            Quiz responseQuizUpdated = null;

            var quiz = new Quiz
            {
                EmailCreator = "*****@*****.**",
                Naam         = "Quiz 1"
            };

            var updateQuiz = new Quiz
            {
                Id           = 1,
                EmailCreator = "*****@*****.**",
                Naam         = "Quiz 1"
            };

            //Arrange
            using (var context = new DataContext(options))
            {
                var repository  = new SQLRepository <Quiz>(context);
                var responseAdd = repository.Add(quiz);
                repository.SaveChanges();
            }

            using (var context = new DataContext(options))
            {
                var repository = new SQLRepository <Quiz>(context);
                responseQuizUpdated = repository.Update(updateQuiz);
                repository.SaveChanges();
            }

            //Assert
            using (var context = new DataContext(options))
            {
                Assert.That(updateQuiz.EmailCreator, Is.EqualTo(responseQuizUpdated.EmailCreator));
                Assert.That(updateQuiz.Naam, Is.EqualTo(responseQuizUpdated.Naam));
            }
        }
        public void GetTop20YearRatingMovies()
        {
            var options = new DbContextOptionsBuilder <MoviesContext>()
                          .UseInMemoryDatabase(databaseName: "MRGetTop20")
                          .Options;

            addMovies(options);

            using (var context = new MoviesContext(options))
            {
                SQLRepository controller = new SQLRepository(context);

                var top20Movies = controller.GetTop20YearRating();

                // movies over 6.5
                Assert.Equal(10, top20Movies.Count);
                Assert.Equal("In Memory DB Movie 6", top20Movies[2].Title);
            }
        }
예제 #31
0
        public static IPersonRepository GetRepository(string repositoryType)
        {
            IPersonRepository repo
                switch (repositoryType)
            {
                case "Service": repo = new ServiceRepository();
                    break;

                case "CSV":
                    repo = new CSVRepository();
                    break;
                case "SQL":
                    repo = new SQLRepository();
                    break;
                default:
                    throw new ArgumentException("Invalid Repository Type");
                    break;
            }
            return repo;
        }