Beispiel #1
0
        public void RefreshCoordinates()
        {
            using (var repositoriesContainer = new InnostarRepositoriesContainer())
            {
                var organizationsList = repositoriesContainer.RepositoryFor <Organization>().GetAll().ToList();

                IGeoCoder geoCoder = new GoogleGeoCoder();

                foreach (var mapObject in organizationsList)
                {
                    var organization = mapObject;

                    var addresses = geoCoder.GeoCode(organization.Address).ToList();

                    if (addresses.Any())
                    {
                        organization.Latitude  = addresses.First().Coordinates.Latitude;
                        organization.Longitude = addresses.First().Coordinates.Longitude;
                    }
                }

                repositoriesContainer.RepositoryFor <Organization>().Save(organizationsList);
                repositoriesContainer.ApplyChanges();
            }
        }
Beispiel #2
0
 public void DeleteProject(Project project)
 {
     using (var repositoriesContainer = new InnostarRepositoriesContainer())
     {
         repositoriesContainer.MapProjectsRepository.Delete(project);
         repositoriesContainer.ApplyChanges();
     }
 }
Beispiel #3
0
 public void Save(Project project)
 {
     using (var repositoriesContainer = new InnostarRepositoriesContainer())
     {
         repositoriesContainer.RepositoryFor <Project>().Save(project);
         repositoriesContainer.ApplyChanges();
     }
 }
Beispiel #4
0
 public void SaveOrganizationsRelation(OrganizationsRelation organizationsRelation)
 {
     using (var repositoriesContainer = new InnostarRepositoriesContainer())
     {
         repositoriesContainer.OrganizationsRelations.Save(organizationsRelation);
         repositoriesContainer.ApplyChanges();
     }
 }
Beispiel #5
0
 public void DeleteOrganization(Organization organization)
 {
     using (var repositoriesContainer = new InnostarRepositoriesContainer())
     {
         repositoriesContainer.MapOrganizationsRepository.Delete(organization);
         repositoriesContainer.ApplyChanges();
     }
 }
 public void Save(Person person)
 {
     using (var repositoriesContainer = new InnostarRepositoriesContainer())
     {
         repositoriesContainer.RepositoryFor <Person>().Save(person);
         repositoriesContainer.ApplyChanges();
     }
 }
Beispiel #7
0
 public void SaveProjectPersonRelation(ProjectContactRelation domainModel)
 {
     using (var repositoriesContainer = new InnostarRepositoriesContainer())
     {
         repositoriesContainer.ProjectPersonRelationRepository.Save(domainModel);
         repositoriesContainer.ApplyChanges();
     }
 }
 public void DeletePerson(Person person)
 {
     using (var repositoriesContainer = new InnostarRepositoriesContainer())
     {
         repositoriesContainer.MapPersonsRepository.Delete(person);
         repositoriesContainer.ApplyChanges();
     }
 }
Beispiel #9
0
 public void DeleteResource(Resource resource)
 {
     using (var repositoriesContainer = new InnostarRepositoriesContainer())
     {
         repositoriesContainer.MapResourcesRepository.Delete(resource);
         repositoriesContainer.ApplyChanges();
     }
 }
        public TCatalog SaveCatalogValue <TCatalog>(TCatalog catalog) where TCatalog : CatalogBase, new()
        {
            using (var repositoriesContainer = new InnostarRepositoriesContainer())
            {
                repositoriesContainer.CatalogsRepository <TCatalog>().Save(catalog);
                repositoriesContainer.ApplyChanges();
            }

            return(catalog);
        }
Beispiel #11
0
 public void DeleteOrganizationProjectRelation(int id)
 {
     using (var repositoriesContainer = new InnostarRepositoriesContainer())
     {
         repositoriesContainer.OrganizationProjectRelations.Delete(new OrganizationProjectRelation
         {
             Id = id
         });
         repositoriesContainer.ApplyChanges();
     }
 }
Beispiel #12
0
 public void DeletePersonProjectRelation(int id)
 {
     using (var repositoriesContainer = new InnostarRepositoriesContainer())
     {
         repositoriesContainer.ProjectPersonRelationRepository.Delete(new ProjectContactRelation
         {
             Id = id
         });
         repositoriesContainer.ApplyChanges();
     }
 }
        public Person SavePerson(Person person)
        {
            return(ProcessMethod(() =>
            {
                using (var repositoriesContainer = new InnostarRepositoriesContainer())
                {
                    repositoriesContainer.MapPersonsRepository.Save(person);
                    repositoriesContainer.ApplyChanges();

                    return person;
                }
            }));
        }
Beispiel #14
0
        public Organization SaveOrganization(Organization organization)
        {
            return(ProcessMethod(() =>
            {
                using (var repositoriesContainer = new InnostarRepositoriesContainer())
                {
                    repositoriesContainer.MapOrganizationsRepository.Save(organization);
                    repositoriesContainer.ApplyChanges();

                    return organization;
                }
            }));
        }
Beispiel #15
0
        public Project SaveProject(Project project)
        {
            return(ProcessMethod(() =>
            {
                using (var repositoriesContainer = new InnostarRepositoriesContainer())
                {
                    repositoriesContainer.MapProjectsRepository.Save(project);
                    repositoriesContainer.ApplyChanges();

                    return project;
                }
            }));
        }
Beispiel #16
0
        public Resource SaveResource(Resource resource)
        {
            return(ProcessMethod(() =>
            {
                using (var repositoriesContainer = new InnostarRepositoriesContainer())
                {
                    repositoriesContainer.MapResourcesRepository.Save(resource);
                    repositoriesContainer.ApplyChanges();

                    return resource;
                }
            }));
        }
        public void DeleteCatalog <TCatalog>(int catalogValueId) where TCatalog : CatalogBase, new()
        {
            ProcessMethod(() =>
            {
                using (var repositoriesContainer = new InnostarRepositoriesContainer())
                {
                    repositoriesContainer.CatalogsRepository <TCatalog>().Delete(new TCatalog
                    {
                        Id = catalogValueId
                    });

                    repositoriesContainer.ApplyChanges();
                }
            });
        }
        public bool TryReorderCatalogValues <TCatalog>(int catalogValueId, int orderDirection) where TCatalog : CatalogBase, new()
        {
            using (var repositoriesContainer = new InnostarRepositoriesContainer())
            {
                var catalog       = repositoriesContainer.CatalogsRepository <TCatalog>().GetCatalogValue(catalogValueId);
                var catalogValues = repositoriesContainer.CatalogsRepository <TCatalog>().GetCatalogValues();

                OrderableModel neighbor;
                var            isSuccessFully = false;

                if (catalog.TryReOrder(catalogValues, out neighbor, orderDirection))
                {
                    repositoriesContainer.CatalogsRepository <TCatalog>().Save((TCatalog)neighbor);
                    repositoriesContainer.CatalogsRepository <TCatalog>().Save((TCatalog)catalog);
                    repositoriesContainer.ApplyChanges();

                    isSuccessFully = true;
                }

                return(isSuccessFully);
            }
        }