public override void ApplyFeatureFilter(FeatureDef featureDef, string value) { if (DataContext != null) { Enova.Business.Old.DB.EnovaContext dc = DataContext as Enova.Business.Old.DB.EnovaContext; string name = featureDef.Name; if (featureDef.IsTree) { BaseQuery = (ObjectQuery <TowarRow>)(from t in query from f in dc.Features where t.ID == f.Parent && f.ParentType == "Towary" && f.Name == name && f.Data.StartsWith(value) group t by t.ID into ut select ut.FirstOrDefault()); } else { BaseQuery = (ObjectQuery <TowarRow>)(from t in query from f in dc.Features where t.ID == f.Parent && f.ParentType == "Towary" && f.Name == name && f.Data == value select t); } } base.ApplyFeatureFilter(featureDef, value); }
public DictionaryTreeNode(Dictionary dic, FeatureDef fd) : base(dic.Value) { this.dictionary = dic; this.featureDef = fd; if (fd.IsTree) { loadSubDictionary(); } }
public void LoadWartosci() { var ds = new List <Dictionary>() { new Dictionary() { ID = 0, Value = "(Wszystkie)" } };; FeatureDef fd = (FeatureDef)featureComboBox.SelectedItem; if (fd != null && fd.ID > 0) { var dc = Enova.Business.Old.Core.ContextManager.DataContext; ds.AddRange(dc.DictionarySet.Where(d => d.Category == "F." + fd.Dictionary).OrderBy(d => d.Value).ToList()); } this.valueBindingSource.DataSource = ds; }
private void zatwierdźButton_Click(object sender, EventArgs e) { Enabled = false; Cursor = Cursors.WaitCursor; string przedstawiciel = kontrahentSelect.Przedstawiciel; string trasa = kontrahentSelect.Trasa; Enova.API.CRM.Kontrahent kontrahent = kontrahentSelect.Kontrahent; FeatureDef featureDef = featureGroupSelect.DefinicjaCechy; string grupa = featureDef.Name; string słownik = featureDef.Dictionary; DateTime dateFrom1 = okres1dateSpan.DateFrom; DateTime dateTo1 = okres1dateSpan.DateTo; DateTime dateFrom2 = okres2DateSpan.DateFrom; DateTime dateTo2 = okres2DateSpan.DateTo; List <Enova.Business.Old.Types.ObrotyWgGrupTowarowych> reportSource = null; if (string.IsNullOrEmpty(trasa) || kontrahent != null) { var obroty = (from o in DataContext.ObrotyByKontrahent(przedstawiciel, kontrahent) join f in DataContext.FeaturesByDef("Towary", grupa) on o.Towar.ID equals f.Parent where o.Data >= dateFrom1 && o.Data <= dateTo1 group o by new { Grupa = f.Data, KontrahentID = o.RozchodKontrahent.ID } into g select new ObrotyWgGrupTowarowych() { GrupaTowarowa = g.Key.Grupa, IDKontrahenta = g.Key.KontrahentID, KodKontrahenta = g.FirstOrDefault().RozchodKontrahent.Kod, NazwaKontrahenta = g.FirstOrDefault().RozchodKontrahent.NazwaStr, ObrótNettoI = g.Sum(ob => ob.RozchodWartosc), ObrótNettoII = 0 }).ToList(); using (var lc = new DBWeb.WebContext()) { lc.CommandTimeout = int.MaxValue; int?kontrahentID = kontrahent == null ? (int?)null : kontrahent.ID; foreach (var f in DataContext.FeaturesByDef("Towary", grupa).ToList()) { var towar = DataContext.Towary.Where(t => t.ID == f.Parent).FirstOrDefault(); var pozycje = (from pz in lc.PozycjeZamowien where pz.Zamowienie.DataDodania >= dateFrom2 && pz.Zamowienie.DataDodania <= dateTo2 && pz.Zamowienie.Synchronizacja != (int)RowSynchronizeOld.NotsynchronizedDelete && pz.Zamowienie.Synchronizacja != (int)RowSynchronizeOld.Notsaved && pz.Zamowienie.Synchronizacja != (int)RowSynchronizeOld.Synchronizing && (pz.ProduktIndywidualny == null || pz.ProduktIndywidualny == false) && pz.Produkt.EnovaGuid == towar.Guid && pz.Ilosc > 0 && (kontrahentID == null || pz.Zamowienie.Kontrahent.ID == kontrahentID) && (przedstawiciel == null || pz.Zamowienie.Kontrahent.Przedstawiciel.Kod == przedstawiciel) select pz).ToList(); foreach (var poz in pozycje) { var kontr = DataContext.Kontrahenci.Where(k => k.Guid == poz.Zamowienie.Kontrahent.Guid).FirstOrDefault(); decimal wartosc = (decimal)(poz.Ilosc == null ? 0 : poz.Ilosc.Value) * (poz.Cena == null ? 0 : poz.Cena.Value) * (1 - (poz.Rabat == null ? 0 : poz.Rabat.Value)); obroty.Add(new ObrotyWgGrupTowarowych() { GrupaTowarowa = f.Data, IDKontrahenta = kontr.ID, KodKontrahenta = kontr.Kod, NazwaKontrahenta = kontr.NazwaStr, ObrótNettoI = 0, ObrótNettoII = decimal.Round(wartosc, 2) }); } } } reportSource = (from o in obroty group o by new { o.GrupaTowarowa, o.IDKontrahenta } into g select new ObrotyWgGrupTowarowych() { GrupaTowarowa = g.Key.GrupaTowarowa, IDKontrahenta = g.Key.IDKontrahenta, KodKontrahenta = g.FirstOrDefault().KodKontrahenta, NazwaKontrahenta = g.FirstOrDefault().NazwaKontrahenta, ObrótNettoI = g.Sum(o => o.ObrótNettoI), ObrótNettoII = g.Sum(o => o.ObrótNettoII) }).ToList(); } else { } reportViewer.LocalReport.ReportPath = "Reports\\ObrotyWgGrupTowarowychReport.rdlc"; reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("ObrotyWgGrupTowarowych", reportSource)); reportViewer.RefreshReport(); Cursor = Cursors.Default; Enabled = true; }
private void addGroup(bool isSubGroup, FeatureTypeNumber?type) { Enova.Business.Old.Forms.FeatureEditForm form = new Enova.Business.Old.Forms.FeatureEditForm(isSubGroup); DialogResult result = form.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrEmpty(form.Value)) { EnovaContext dc = Enova.Business.Old.Core.ContextManager.DataContext; if (treeView.SelectedNode is FeatureTreeNode && ((FeatureTreeNode)treeView.SelectedNode).FeatureDef.ID == 0) { if (dc.FeatureDefs.Any(f => f.Name == form.Value)) { MessageBox.Show("Istnieje już grupa o takiej nazwie.", "EnovaTools", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } FeatureTreeNode node = (FeatureTreeNode)treeView.SelectedNode; FeatureDef featureDef = new FeatureDef(TableName, form.Value, type.Value); ((Enova.Business.Old.Core.IContextSaveChanges)featureDef).SaveChanges(dc); FeatureTreeNode newNode = new FeatureTreeNode(featureDef); treeView.Nodes.Add(newNode); treeView.SelectedNode = newNode; } else { Dictionary parent = null; FeatureDef featureDef = null; TreeNode parentNode = null; if (treeView.SelectedNode is FeatureTreeNode) { featureDef = ((FeatureTreeNode)treeView.SelectedNode).FeatureDef; parentNode = treeView.SelectedNode; } else { featureDef = ((DictionaryTreeNode)treeView.SelectedNode).FeatureDef; if (featureDef.IsTree) { parent = ((DictionaryTreeNode)treeView.SelectedNode).Dictionary; parentNode = treeView.SelectedNode; } else { parentNode = treeView.SelectedNode; if (parentNode.Parent != null) { parentNode = parentNode.Parent; } } } Dictionary dictionary = new Dictionary(parent, "F." + featureDef.Dictionary, form.Value); ((Enova.Business.Old.Core.ISaveChanges)dictionary).SaveChanges(); DictionaryTreeNode newNode = new DictionaryTreeNode(dictionary, featureDef); parentNode.Nodes.Add(newNode); treeView.SelectedNode = newNode; } } }
public FeatureTreeNode(FeatureDef featureDef) : base(featureDef.Name) { this.featureDef = featureDef; loadDictionary(); }
public static string GetFeatureName(FeatureDef feature) { return GetFeatureName(GetFeatureIndex(feature)); }
public static int GetFeatureIndex(FeatureDef feature) { return (int)feature - (int)FeatureDef.AVG_Average_volumes_of_residues_Pontius_et_al_1996; }
public static double[] GetCoefficients(FeatureDef feature) { return GetCoefficients(GetFeatureIndex(feature)); }
public static double CalculateFeature(FeatureDef feature, string seq) { double[] coeffs = GetCoefficients(feature); char[] aas = seq.Where(c => !double.IsNaN(coeffs[AminoAcid.ToIndex(c)])).ToArray(); return aas.Sum(c => coeffs[AminoAcid.ToIndex(c)]) / aas.Length; }
private void CreateReport() { this.Enabled = false; this.Cursor = Cursors.WaitCursor; DateTime dataOd = dataOdDateTimePicker.Value.Date; DateTime dataDo = dataDoDateTimePicker.Value.Date.AddDays(1); string przedstawiciel = przedstawicielSelect.Przedstawiciel; FeatureDef fd = featureSelect.FeatureDef; Dictionary disc = featureSelect.Dictionary; List <BrakiRow> ds; if (fd != null && fd.ID > 0 && disc != null && disc.ID > 0) { var dc = Enova.Business.Old.Core.ContextManager.WebContext; var ec = Enova.Business.Old.Core.ContextManager.DataContext; var guids = (from t in ec.Towary join f in ec.Features on new { ParentType = "Towary", Parent = t.ID, Name = fd.Name } equals new { ParentType = f.ParentType, Parent = f.Parent, Name = f.Name } where f.Data == disc.Value select t.Guid).ToArray(); ds = (from p in Enova.Business.Old.Core.ContextManager.WebContext.PozycjeZamByPrzedstawiciel(przedstawiciel) where p.Zamowienie.DataDodania >= dataOd && p.Zamowienie.DataDodania < dataDo && p.Ilosc != p.IloscOrg && p.IloscOrg != null && p.Produkt != null && p.Produkt.EnovaGuid != null && guids.Contains(p.Produkt.EnovaGuid.Value) select new BrakiRow() { KontrahentKod = p.Zamowienie.Kontrahent.Kod, KontrahentNazwa = p.Zamowienie.Kontrahent.Nazwa, TowarKod = p.Produkt != null ? p.Produkt.Kod : "", TowarNazwa = p.Produkt != null ? p.Produkt.Nazwa : p.ProduktNazwa, Opis = p.Opis, AtrybutProduktu = p.AtrybutProduktu, Ilosc = (double)(p.Ilosc - p.IloscOrg), Cena = (decimal)(p.Cena != null ? p.Cena.Value : 0M) } ).ToList(); } else { ds = (from p in Enova.Business.Old.Core.ContextManager.WebContext.PozycjeZamByPrzedstawiciel(przedstawiciel) where p.Zamowienie.DataDodania >= dataOd && p.Zamowienie.DataDodania < dataDo && p.Ilosc != p.IloscOrg && p.IloscOrg != null select new BrakiRow() { KontrahentKod = p.Zamowienie.Kontrahent.Kod, KontrahentNazwa = p.Zamowienie.Kontrahent.Nazwa, TowarKod = p.Produkt != null ? p.Produkt.Kod : "", TowarNazwa = p.Produkt != null ? p.Produkt.Nazwa : p.ProduktNazwa, Opis = p.Opis, AtrybutProduktu = p.AtrybutProduktu, Ilosc = (double)(p.Ilosc - p.IloscOrg), Cena = (decimal)(p.Cena != null ? p.Cena.Value : 0M) } ).ToList(); } this.reportViewer.LocalReport.ReportPath = "BrakiReport.rdlc"; this.reportViewer.LocalReport.DataSources.Clear(); this.reportViewer.LocalReport.DataSources.Add(new ReportDataSource("BrakiRow", ds)); this.reportViewer.SetDisplayMode(DisplayMode.PrintLayout); this.reportViewer.ZoomMode = ZoomMode.PageWidth; this.reportViewer.RefreshReport(); this.Cursor = Cursors.Default; this.Enabled = true; }
private static ushort <GenerateFresh> m__1(FeatureDef x) { return(x.index); }
private static float <GenerateFresh> m__0(FeatureDef x) { return(x.order); }