protected override void InitImportImpl() { LogMsg("Caching rank data..."); var taxonService = new TaxaService(User); _ranks = taxonService.GetOrderedRanks(); }
protected override void ProcessImpl(User user) { Debug.Assert(Model.SANTypeDataID >= 0); var service = new TaxaService(user); service.DeleteSANTypeData(Model.SANTypeDataID); }
private int GetTaxonNumber() { // test to see if an internal taxon id is present in the incoming dataset var existingTaxonId = Get("Taxon.ExistingTaxonID"); if (!String.IsNullOrEmpty(existingTaxonId)) { var existingTaxon = TaxaService.GetTaxon(Int32.Parse(existingTaxonId)); if (existingTaxon != null) { return(existingTaxon.TaxaID.Value); } } // No existing taxon found? need to create it var strLowestRank = LowestTaxonLevel(); var taxon = BuildTaxonCacheRecord(); int elementID = -1; if (!_taxonCache.FindInCache(taxon, out elementID)) { elementID = 0; foreach (TaxonRankName name in _ranks) { elementID = AddElementID(elementID, name, strLowestRank); } taxon.TaxonID = elementID; taxon.SourceRowID = CurrentRowId; _taxonCache.AddToCache(taxon); } return(elementID); }
public List <HierarchicalViewModelBase> LoadModel(HierarchicalViewModelBase parent) { var service = new TaxaService(User); List <Taxon> model = null; if (parent == null) { model = service.GetTopLevelTaxa(); } else { model = service.GetTaxaForParent((parent as TaxonViewModel).TaxaID.Value); } if (model != null) { var temp = model.Where((taxon) => { return(_options == LookupOptions.TaxonExcludeAvailableNames ? !taxon.AvailableName.ValueOrFalse() : true); }).Select((m) => { return(new TaxonViewModel(parent, m, _explorer.GenerateTaxonDisplayLabel)); }); var list = new List <HierarchicalViewModelBase>(temp); return(list); } return(null); }
protected override void ProcessImpl(User user) { var service = new TaxaService(user); service.MergeTaxon(Source.TaxaID.Value, Target.TaxaID.Value, CreateNewIDRecord); service.DeleteTaxon(Source.TaxaID.Value); }
public XMLExportOptions(User user, List <int> taxonIds) { InitializeComponent(); TaxonIDs = taxonIds; this.User = user; var lastFile = Config.GetUser(User, "XMLIOExport.LastExportFile", ""); if (!string.IsNullOrEmpty(lastFile)) { if (taxonIds.Count == 1) { var service = new TaxaService(user); var taxon = service.GetTaxon(taxonIds[0]); if (taxon != null) { var f = new FileInfo(lastFile); var directory = f.DirectoryName; var taxaName = taxon.TaxaFullName == null ? "Unnamed" : taxon.TaxaFullName; txtFilename.Text = System.IO.Path.Combine(f.DirectoryName, SystemUtils.StripIllegalFilenameChars(taxaName) + ".xml"); } } else { txtFilename.Text = lastFile; } } }
public async Task CheckTaxa() { var service = new TaxaService(); var taxa = await service.GetTaxaAsync(); Assert.Equal(0.01M, taxa); }
public void DeveRetornarTaxaDeJuros() { var taxaSetada = 0.01; TaxaService service = new TaxaService(); var taxaRetornada = service.ObterTaxaDeJuros(); Assert.AreEqual(taxaSetada, taxaRetornada); }
/// <summary> /// Returns a PartialView with a list /// </summary> /// <param name="page"></param> /// <returns></returns> public ActionResult Listagem(int? page) { page = page ?? 1; var taxas = new TaxaService().GetByPage(page.Value); var list = new MvcList<Ecommerce_TributoTaxa>(taxas.Item1, page.Value, taxas.Item2, Settings.QuantityRegistersPerPage); return PartialView(list); }
public override void Validate(ValidationMessages messages) { var service = new TaxaService(PluginManager.Instance.User); if (!service.SafeToDeleteTaxon(Taxon.TaxaID.Value)) { messages.Warn("There are material and or associations that will be orphaned if you delete this taxon."); } }
/// <summary> /// Returns a View with the record for Edit /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Editar(int id) { var tx = new TaxaService().GetById(id); var estados = new EstadoService().GetAll(); ViewBag.Estados = estados; return View(tx); }
public TaxonNameDetails(int?taxonId, User user, Action <TaxonNameViewModel> successAction) : base(user, "TaxonNameDetails::" + taxonId.Value) { _successAction = successAction; var service = new TaxaService(user); Taxon taxon = service.GetTaxon(taxonId.Value); _rank = service.GetTaxonRank(taxon); _kingdomList = service.GetKingdomList(); Kingdom kingdom = _kingdomList.Find((k) => k.KingdomCode.Equals(taxon.KingdomCode)); _model = new TaxonNameViewModel(taxon, kingdom, _rank); _model.DataChanged += new DataChangedHandler(_model_DataChanged); InitializeComponent(); cmbKingdom.ItemsSource = _kingdomList; this.chkChangedCombination.Visibility = (_rank != null && _rank.Category == "S" ? Visibility.Visible : Visibility.Hidden); if (taxon.AvailableName.ValueOrFalse() || taxon.LiteratureName.ValueOrFalse()) { string phraseCategory = "ALN Name Status"; chkChangedCombination.Visibility = System.Windows.Visibility.Hidden; if (taxon.AvailableName.ValueOrFalse()) { TaxonRank rank = service.GetTaxonRank(taxon); if (rank != null) { switch (rank.Category.ToLower()) { case "g": phraseCategory = "GAN Name Status"; break; case "s": phraseCategory = "SAN Name Status"; break; } } } txtNameStatus.BindUser(PluginManager.Instance.User, PickListType.Phrase, phraseCategory, TraitCategoryType.Taxon); } else { txtNameStatus.Visibility = System.Windows.Visibility.Collapsed; lblNameStatus.Visibility = System.Windows.Visibility.Collapsed; } this.DataContext = _model; this.ChangesCommitted += new PendingChangesCommittedHandler(TaxonNameDetails_ChangesCommitted); }
protected override void ProcessImpl(User user) { var service = new TaxaService(user); service.InsertTaxon(Taxon.Taxon); // The service will have updated the new taxon with its database identity. // If this taxon has any children we can update their identity too. foreach (HierarchicalViewModelBase child in Taxon.Children) { TaxonViewModel tvm = child as TaxonViewModel; tvm.TaxaParentID = Taxon.Taxon.TaxaID; } }
protected override List <RefLink> SelectReferences(IProgressObserver progress) { var service = new SupportService(User); var taxaService = new TaxaService(User); if (progress != null) { progress.ProgressMessage("Retrieving Reference links..."); } var reflinks = service.GetReferenceLinks(TraitCategoryType.Taxon.ToString(), Taxon.TaxaID.Value); if (Options.IncludeChildReferences == true) { var children = taxaService.GetExpandFullTree(Taxon.TaxaID.Value); var elementCount = 0; int total = children.Count; if (progress != null) { progress.ProgressStart("Extracting references for children..."); } foreach (Taxon child in children) { if (progress != null) { double percent = (((double)elementCount) / ((double)total)) * 100.0; progress.ProgressMessage(string.Format("Processing {0}", child.TaxaFullName), percent); } elementCount++; var links = service.GetReferenceLinks(TraitCategoryType.Taxon.ToString(), child.TaxaID.Value); foreach (RefLink link in links) { reflinks.Add(link); } } if (progress != null) { progress.ProgressEnd(""); } } return(reflinks); }
// GET: Home public async Task <ActionResult> Index() { // Exemplos de chamadas paralelas usando diferentes repositorios // Servico se vira para achar o repositorio var calculoA = TaxaService.CalcularTaxa(1); // Servico recebe o repositorio via DI var calculoB = TaxaService.CalcularTaxa(1, _repository); // Servico recebe o repositorio especifico do mongodb var calculoC = TaxaService.CalcularTaxa(1, new MongoDBTaxaRepository()); await Task.WhenAll(calculoA, calculoB, calculoC); return(View()); }
private void BuildTaxaChildrenViewModel(HierarchicalViewModelBase item, int taxaID) { // The model node is a Taxon favorites, so we can get the 'real' taxon children for it... item.Children.Clear(); var taxaService = new TaxaService(User); List <Taxon> taxa = taxaService.GetTaxaForParent(taxaID); foreach (Taxon taxon in taxa) { TaxonViewModel child = new TaxonViewModel(item, taxon, null); if (child.NumChildren > 0) { child.LazyLoadChildren += new HierarchicalViewModelAction(viewModel_LazyLoadChildren); child.Children.Add(new ViewModelPlaceholder("Loading...")); } item.Children.Add(child); } }
public ActionResult Details() { CarrinhoModel carrinho = GetCurrentCart(); if(carrinho.ShippingMethod == null) { new CarrinhoService().UpdateShippingMethod(carrinho.Cookie, "UPS"); carrinho = GetCurrentCart(); } ViewBag.Title = Resources.Resource.Carrinho_Titulo; ViewBag.FormasEnvio = new EntregaService().GetRecords(m => m.IsAtivo); ViewBag.TipoEntrega = carrinho.ShippingMethod; var peso = carrinho.Items.Sum(x => x.Quantidade * x.Produto.Peso) / 1000; var comprimento = carrinho.Items.Sum(x => x.Quantidade * (GetDimensao(x.Produto.Dimensoes, 0) / 10)); var altura = carrinho.Items.Sum(x => x.Quantidade * (GetDimensao(x.Produto.Dimensoes, 1) / 10)); var largura = carrinho.Items.Sum(x => x.Quantidade * (GetDimensao(x.Produto.Dimensoes, 2) / 10)); var diametro = carrinho.Items.Sum(x => x.Quantidade * (GetDimensao(x.Produto.Dimensoes, 3) / 10)); //if (carrinho.ShippingMethod != null) //{ carrinho.ValorFrete = (carrinho.ShippingMethod ?? "UPS").Equals("UPS") ? GetShippingPriceUPS(carrinho.ZipCode, peso) : GetShippingPriceCorreios(carrinho.ZipCode, peso, carrinho.ShippingMethod, comprimento, altura, largura, diametro, ref carrinho); //} //Atualiza o valor das taxas para o estado if (User.Identity.IsAuthenticated && UserAuthenticated != null && UserAuthenticated.IdCliente.HasValue) { var endereco = new EnderecoService().GetShippingAddressesByClientId(UserAuthenticated.IdCliente.Value); if (endereco.IdEstado.HasValue) { var tax = new TaxaService().GetByEstadoId(endereco.IdEstado.Value); if (tax != null && tax.Taxa.HasValue && carrinho.ValorSubtotal > 0) carrinho.ValorTaxas = Decimal.Round(((carrinho.ValorSubtotal / 100) * tax.Taxa.Value), 2); } } return View(carrinho); }
public override DataMatrix ExtractReportData(IProgressObserver progress) { var service = new TaxaService(User); progress.ProgressStart(String.Format("Preparing Darwin Core records for {0} specimens...", _idSet.Count)); DataMatrix result = null; var idSet = new LinkedList <int>(_idSet); int chunkSize = 2000; var helper = new DarwinCoreReportHelper(); var chunk = new List <int>(); var count = 0; while (idSet.Count > 0) { chunk.Add(idSet.First.Value); idSet.RemoveFirst(); count++; if (chunk.Count >= chunkSize || idSet.Count == 0) { var percentComplete = ((double)count / (double)_idSet.Count) * 100; progress.ProgressMessage(String.Format("Preparing Darwin Core records {0} of {1}", count, _idSet.Count), percentComplete); var where = "tblMaterial.intMaterialID in (" + chunk.Join(",") + ")"; var dataChunk = helper.RunDwcQuery(service, where); if (result == null) { result = dataChunk; } else { result.AppendMatrix(dataChunk); } chunk = new List <int>(); } } progress.ProgressEnd(String.Format("{0} Darwin Core records retrieved.", count)); return(result); }
public AvailableNameControl(TaxonViewModel taxon, User user) : base(taxon, user, "AvailableNames") { InitializeComponent(); txtReference.BindUser(user, LookupType.Reference); txtNameStatus.BindUser(user, PickListType.Phrase, "ALN Name Status", TraitCategoryType.Taxon); var name = new TaxaService(user).GetAvailableName(taxon.TaxaID.Value); if (name == null) { name = new AvailableName(); name.BiotaID = taxon.TaxaID.Value; } _model = new AvailableNameViewModel(name); this.DataContext = _model; _model.DataChanged += new DataChangedHandler((vm) => { RegisterUniquePendingChange(new UpdateAvailableNameCommand(_model.Model)); }); }
public SelectRankWindow() { InitializeComponent(); var service = new TaxaService(PluginManager.Instance.User); _map = service.GetTaxonRankMap(); var kingdoms = service.GetKingdomList().Where((kingdom) => { return(!string.IsNullOrWhiteSpace(kingdom.KingdomCode)); }); cmbKingdom.SelectionChanged += new SelectionChangedEventHandler(cmbKingdom_SelectionChanged); cmbKingdom.ItemsSource = kingdoms; if (kingdoms.Count() > 0) { cmbKingdom.SelectedIndex = 0; } this.DataContext = this; }
public List <HierarchicalViewModelBase> Search(string searchTerm) { var service = new TaxaService(User); var list = service.FindTaxa(searchTerm).Where((taxon) => { return(_options == LookupOptions.TaxonExcludeAvailableNames ? !taxon.AvailableName.ValueOrFalse() : true); }); var results = new List <HierarchicalViewModelBase>(list.Select((m) => { return(new TaxonViewModel(null, m, _explorer.GenerateTaxonDisplayLabel)); })); results.Sort(new TaxonComparer()); //(vm1, vm2) => { // var t1 = vm1 as TaxonViewModel; // var t2 = vm2 as TaxonViewModel; // return StringComparer.CurrentCultureIgnoreCase.Compare(t2.DefaultSortOrder, t1.DefaultSortOrder); //}); return(results); }
protected override void ProcessImpl(User user) { var service = new TaxaService(user); // First we need to delete all of the existing regions... service.DeleteAllBiotaDistribution(Model.TaxaID); // Then insert the ones from the model... var list = new List <DistributionViewModel>(); foreach (HierarchicalViewModelBase b in _regionTree) { b.Traverse((m) => { if (m is DistributionViewModel) { list.Add(m as DistributionViewModel); } }); } foreach (DistributionViewModel dvm in list) { service.InsertBiotaDist(Model.TaxaID, dvm.Model); } }
protected override void ProcessImpl(User user) { var service = new TaxaService(user); service.DeleteTaxon(Taxon.TaxaID.Value); }
private void TreeViewItem_MouseRightButtonDown(object sender, MouseEventArgs e) { TreeViewItem item = sender as TreeViewItem; if (item == null) { return; } item.Focus(); e.Handled = true; var model = tvwFavorites.SelectedItem as HierarchicalViewModelBase; Debug.Assert(model != null); int?favoriteId = null; TaxonViewModel tvm = null; bool isGroup = false; if (model is TaxonFavoriteViewModel) { var fav = model as TaxonFavoriteViewModel; favoriteId = fav.FavoriteID; if (!fav.IsGroup) { var taxon = new TaxaService(User).GetTaxon(fav.TaxaID); tvm = new TaxonViewModel(null, taxon, TaxonExplorer.GenerateTaxonDisplayLabel); } else { isGroup = true; } } else if (model is TaxonViewModel) { tvm = model as TaxonViewModel; } if (tvm != null) { TaxonMenuFactory f = new TaxonMenuFactory(tvm, TaxonExplorer, TaxonExplorer._R); tvwFavorites.ContextMenu = f.BuildFavoritesMenu(model); } else { var builder = new ContextMenuBuilder(null); builder.New("Add favorite group").Handler(() => { AddFavoriteGroup(model); }).End(); if (isGroup) { builder.New("Rename group").Handler(() => { RenameFavoriteGroup(model as TaxonFavoriteViewModel); }).End(); builder.New("Remove favorite group").Handler(() => { DeleteFavoriteGroup(model); }).End(); } tvwFavorites.ContextMenu = builder.ContextMenu; } }
/// <summary> /// Update the quantities for a list of items of the cart /// </summary> /// <param name="list"></param> /// <returns></returns> public ActionResult UpdateCartItems(List<CarrinhoItemModel> list, String shippingType) { var cService = new CarrinhoService(); CarrinhoModel carrinho = GetCurrentCart(); cService.UpdateQuantityCartItem(carrinho.Cookie, list); carrinho = GetCurrentCart(); decimal peso = carrinho.Items.Sum(x => x.Quantidade * x.Produto.Peso) / 1000; carrinho.ValorFrete = GetShippingPriceUPS(carrinho.ZipCode, peso); carrinho.ValorFrete = carrinho.ValorFrete > 0 ? carrinho.ValorFrete : 0; //Atualiza o valor das taxas para o estado if (User.Identity.IsAuthenticated && UserAuthenticated != null && UserAuthenticated.IdCliente.HasValue) { var endereco = new EnderecoService().GetShippingAddressesByClientId(UserAuthenticated.IdCliente.Value); if (endereco.IdEstado.HasValue) { var tax = new TaxaService().GetByEstadoId(endereco.IdEstado.Value); if (tax != null && tax.Taxa.HasValue && carrinho.ValorSubtotal > 0) carrinho.ValorTaxas = Decimal.Round(((carrinho.ValorSubtotal / 100) * tax.Taxa.Value), 2); } } ViewBag.TipoEntrega = carrinho.ShippingMethod; ViewBag.FormasEnvio = new EntregaService().GetRecords(m => m.IsAtivo); return PartialView("Details", carrinho); }
public ActionResult Payment() { if (User.Identity.IsAuthenticated) { ViewBag.Title = Resources.Resource.Pagamento_Titulo; CarrinhoModel carrinho = GetCurrentCart(); var peso = carrinho.Items.Sum(x => x.Quantidade * x.Produto.Peso) / 1000; var comprimento = carrinho.Items.Sum(x => x.Quantidade * (GetDimensao(x.Produto.Dimensoes, 0) / 10)); var altura = carrinho.Items.Sum(x => x.Quantidade * (GetDimensao(x.Produto.Dimensoes, 1) / 10)); var largura = carrinho.Items.Sum(x => x.Quantidade * (GetDimensao(x.Produto.Dimensoes, 2) / 10)); var diametro = carrinho.Items.Sum(x => x.Quantidade * (GetDimensao(x.Produto.Dimensoes, 3) / 10)); //if (carrinho.ShippingMethod != null) //{ carrinho.ValorFrete = (carrinho.ShippingMethod ?? "UPS" ).Equals("UPS") ? GetShippingPriceUPS(carrinho.ZipCode, peso) : GetShippingPriceCorreios(carrinho.ZipCode, peso, carrinho.ShippingMethod, comprimento, altura, largura, diametro, ref carrinho); //} //Atualiza o valor das taxas para o estado if (UserAuthenticated != null && UserAuthenticated.IdCliente.HasValue) { var endereco = new EnderecoService().GetShippingAddressesByClientId(UserAuthenticated.IdCliente.Value); if (endereco.IdEstado.HasValue) { var tax = new TaxaService().GetByEstadoId(endereco.IdEstado.Value); if (tax != null && tax.Taxa.HasValue && carrinho.ValorSubtotal > 0) carrinho.ValorTaxas = Decimal.Round(((carrinho.ValorSubtotal / 100) * tax.Taxa.Value), 2); } } return View(carrinho); } else { return RedirectToAction("Index", "Account"); } }
public ActionResult ShippingMethodByAddress(String address, String shippingType) { var carrinho = GetCurrentCart(); new CarrinhoService().UpdateShippingMethod(carrinho.Cookie, shippingType); carrinho = GetCurrentCart(); var idCliente = FormsAuthenticationUtil.UserAuthenticated.IdCliente; if (idCliente != null) { var endEntregaAntigo = new EnderecoService().GetDefaultShippingAddress(idCliente.Value); if (endEntregaAntigo != null) { new EnderecoService().ChangeShippingAddress(endEntregaAntigo, false); } var end = new EnderecoService().GetById(int.Parse(address)); if (end != null) { new EnderecoService().ChangeShippingAddress(end, true); } carrinho.ZipCode = end.Cep;//Change zipcode } var peso = carrinho.Items.Sum(x => x.Quantidade * x.Produto.Peso) / 1000; var comprimento = carrinho.Items.Sum(x => x.Quantidade * (GetDimensao(x.Produto.Dimensoes, 0) / 10)); var altura = carrinho.Items.Sum(x => x.Quantidade * (GetDimensao(x.Produto.Dimensoes, 1) / 10)); var largura = carrinho.Items.Sum(x => x.Quantidade * (GetDimensao(x.Produto.Dimensoes, 2) / 10)); var diametro = carrinho.Items.Sum(x => x.Quantidade * (GetDimensao(x.Produto.Dimensoes, 3) / 10)); carrinho.ValorFrete = shippingType.Equals("UPS") ? GetShippingPriceUPS(carrinho.ZipCode, peso) : GetShippingPriceCorreios(carrinho.ZipCode, peso, shippingType, comprimento, altura, largura, diametro, ref carrinho); //Atualiza o valor das taxas para o estado if (User.Identity.IsAuthenticated && UserAuthenticated != null && UserAuthenticated.IdCliente.HasValue) { var endereco = new EnderecoService().GetShippingAddressesByClientId(UserAuthenticated.IdCliente.Value); if (endereco.IdEstado.HasValue) { var tax = new TaxaService().GetByEstadoId(endereco.IdEstado.Value); if (tax != null && tax.Taxa.HasValue && carrinho.ValorSubtotal > 0) carrinho.ValorTaxas = Decimal.Round(((carrinho.ValorSubtotal / 100) * tax.Taxa.Value), 2); } } ViewBag.TipoEntrega = carrinho.ShippingMethod; ViewBag.FormasEnvio = new EntregaService().GetRecords(m => m.IsAtivo); return PartialView("Summary", carrinho); }
protected override void ProcessImpl(User user) { var service = new TaxaService(user); service.MoveTaxon(Taxon.TaxaID.Value, NewParent.TaxaID.Value); }
public override void InitializePlugin(User user, PluginManager pluginManager, Window parentWindow) { base.InitializePlugin(user, pluginManager, parentWindow); _taxaService = new TaxaService(user); }
public ActionResult ShippingMethod(CarrinhoModel carrinho) { Decimal peso = carrinho.Items.Sum(x => x.Quantidade * x.Produto.Peso) / 1000; carrinho.ValorFrete = GetShippingPriceUPS(carrinho.ZipCode, peso); //Atualiza o valor das taxas para o estado if (UserAuthenticated != null && UserAuthenticated.IdCliente.HasValue) { var endereco = new EnderecoService().GetShippingAddressesByClientId(UserAuthenticated.IdCliente.Value); if (endereco.IdEstado.HasValue) { var tax = new TaxaService().GetByEstadoId(endereco.IdEstado.Value); if (tax != null && tax.Taxa.HasValue && carrinho.ValorSubtotal > 0) carrinho.ValorTaxas = Decimal.Round(((carrinho.ValorSubtotal / 100) * tax.Taxa.Value), 2); } } return PartialView(carrinho); }
private DataMatrix AddMediaForTaxon(int taxonId, IProgressObserver progress) { var results = new DataMatrix(); results.Columns.Add(new MatrixColumn { Name = "MultimediaID", IsHidden = true }); results.Columns.Add(new MatrixColumn { Name = "TaxonID", IsHidden = true }); results.Columns.Add(new MatrixColumn { Name = "MultimediaLink", IsHidden = true }); results.Columns.Add(new MatrixColumn { Name = "Taxon name" }); results.Columns.Add(new MatrixColumn { Name = "Rank" }); results.Columns.Add(new MatrixColumn { Name = "Multimedia Name" }); results.Columns.Add(new MatrixColumn { Name = "Extension" }); results.Columns.Add(new MatrixColumn { Name = "Multimedia Type" }); results.Columns.Add(new MatrixColumn { Name = "Size" }); results.Columns.Add(new MatrixColumn { Name = "Attached To" }); results.Columns.Add(new MatrixColumn { Name = "MaterialID", IsHidden = true }); if (progress != null) { progress.ProgressMessage("Extracting multimedia details for item..."); } // First add the multimedia for this item var links = SupportService.GetMultimediaItems(TraitCategoryType.Taxon.ToString(), taxonId); var taxon = TaxaService.GetTaxon(taxonId); foreach (MultimediaLink link in links) { AddTaxonRow(results, taxon, link); } if (_includeMaterial) { AddMaterialRowsForTaxon(results, taxon); } if (_recurse) { // Now find all the children of this item if (progress != null) { progress.ProgressMessage("Retrieving child items..."); } var children = TaxaService.GetExpandFullTree(taxonId); var elementCount = 0; int total = children.Count; if (progress != null) { progress.ProgressStart("Extracting multimedia for children..."); } foreach (Taxon child in children) { if (progress != null) { double percent = (((double)elementCount) / ((double)total)) * 100.0; progress.ProgressMessage(string.Format("Processing {0}", child.TaxaFullName), percent); } elementCount++; links = SupportService.GetMultimediaItems(TraitCategoryType.Taxon.ToString(), child.TaxaID.Value); foreach (MultimediaLink link in links) { AddTaxonRow(results, child, link); } if (_includeMaterial) { AddMaterialRowsForTaxon(results, child); } } } if (progress != null) { progress.ProgressEnd(string.Format("{0} multimedia items found.", results.Rows.Count)); } return(results); }
protected override void ProcessImpl(User user) { var service = new TaxaService(user); service.UpdateGANIncludedSpecies(Model); }
public override Data.DataMatrix ExtractReportData(IProgressObserver progress) { var service = new TaxaService(User); return(service.TaxaForDistributionRegionReport(DistributionRegion.DistRegionID, TaxonID)); }
protected override void ProcessImpl(User user) { var service = new TaxaService(user); service.DeleteCommonName(Model.CommonNameID); }
protected override void ProcessImpl(User user) { var service = new TaxaService(user); service.InsertCommonName(Model); }
public override DataMatrix ExtractReportData(IProgressObserver progress) { var matrix = new DataMatrix(); if (IsGroupedByTaxon) { matrix.Columns.Add(new MatrixColumn { Name = "TaxonName" }); matrix.Columns.Add(new MatrixColumn { Name = "BiotaID", IsHidden = true }); } matrix.Columns.Add(new MatrixColumn { Name = "Count" }); foreach (string colname in SelectedColumns) { matrix.Columns.Add(new MatrixColumn { Name = colname }); } // Open the feature layer data SelectedFeatureLayer.DataSource.Open(); var map = new Dictionary <string, FeatureCountPair>(); if (progress != null) { progress.ProgressMessage("Counting points...", 0); } int pointCount = 0; foreach (VectorLayer pointLayer in SelectedPointLayers) { var ds = pointLayer.DataSource; ds.Open(); pointCount += ds.GetFeatureCount(); } if (progress != null) { progress.ProgressStart(String.Format("Processing {0} points...", pointCount)); } int processed = 0; int notFoundCount = 0; var materialService = new MaterialService(User); var taxaService = new TaxaService(User); foreach (VectorLayer pointLayer in SelectedPointLayers) { var pointProvider = pointLayer.DataSource; pointProvider.Open(); for (uint i = 0; i < pointProvider.GetFeatureCount(); ++i) { var row = pointProvider.GetFeature(i); Taxon taxon = null; if (IsGroupedByTaxon) { int?materialId = (int?)row["MaterialID"]; if (materialId.HasValue) { var m = materialService.GetMaterial(materialId.Value); if (m.BiotaID > 0) { if (_taxonCache.ContainsKey(m.BiotaID)) { taxon = _taxonCache[m.BiotaID]; } else { taxon = taxaService.GetTaxon(m.BiotaID); _taxonCache[m.BiotaID] = taxon; } } } } SharpMap.Geometries.Point p = row.Geometry as Point; if (!ProcessPoint(SelectedFeatureLayer.DataSource, pointLayer, p, map, taxon)) { notFoundCount++; } processed++; if (progress != null) { double percent = ((double)processed) / ((double)pointCount) * 100; progress.ProgressMessage(String.Format("Processing {0} points...", pointCount), percent); } } } if (progress != null) { progress.ProgressMessage("Constructing result set...", 100); } int countIndex = matrix.IndexOf("Count"); int taxaIndex = matrix.IndexOf("TaxonName"); int biotaIDIndex = matrix.IndexOf("BiotaID"); foreach (FeatureCountPair pair in map.Values) { var matrixRow = matrix.AddRow(); foreach (DataColumn col in pair.First.Table.Columns) { if (SelectedColumns.Contains(col.ColumnName)) { var index = matrix.IndexOf(col.ColumnName); matrixRow[index] = pair.First[col]; } } matrixRow[countIndex] = pair.Second; if (IsGroupedByTaxon) { matrixRow[taxaIndex] = pair.Taxon == null ? "Unidentified" : pair.Taxon.TaxaFullName; matrixRow[biotaIDIndex] = pair.Taxon == null ? -1 : pair.Taxon.TaxaID.Value; } } if (IncludeUnmatchedPointRow && notFoundCount > 0) { var unmatched = matrix.AddRow(); unmatched[countIndex] = notFoundCount; } if (progress != null) { progress.ProgressEnd(String.Format("{0} points processed.", pointCount)); } return(matrix); }
protected override void ProcessImpl(User user) { var service = new TaxaService(user); service.InsertOrUpdateSpeciesAvailableName(Model); }