public Series(Grid container, double margin, DataItemCollection dataItem,Brush palette)
 {
     this._container = container;
     this._ItemSource = dataItem;
     this.margin = margin;
     this._palette = palette;
 }
Ejemplo n.º 2
0
 public void LoadAll(Call call)
 {
     lock (DataRepo)
     {
         Items = base.LoadAll(call);
     }
 }
Ejemplo n.º 3
0
        //---------------------------------------------------------------------
        public ToolStripItem CreateItem <TDataItem, TData>(
            TData data,
            DataItemCollection <TDataItem, TData> collection,
            EventHandler handler,
            bool showToolTip  = true,
            Keys shortcutKeys = Keys.None,
            bool showImage    = false,
            ToolStripItemImageScaling imageScaling = ToolStripItemImageScaling.None
            ) where TDataItem : DataItem <TData>
        {
            if (collection == null)
            {
                throw new ArgumentNullException(nameof(collection));
            }

            var dataItem = collection[data];

            if (dataItem == null)
            {
                throw new ArgumentException(string.Empty, nameof(data));
            }

            var menuItem = new ToolStripMenuItem(dataItem.Name, null, handler)
            {
                ShortcutKeys = shortcutKeys,
                ImageScaling = imageScaling,
                Font         = new Font(_fontFamilyName, _fontEmSize),
            };

            _UpdateItem(menuItem, dataItem, showToolTip, showImage, false);

            return(menuItem);
        }
Ejemplo n.º 4
0
 public void LoadAllOrderBy(Call call, string orderByMemberName)
 {
     lock (DataRepo)
     {
         DataItemCollection <T> items = base.LoadAll(call);
         Items = new DataItemCollection <T>(items.OrderBy(orderByMemberName));
     }
 }
Ejemplo n.º 5
0
 public void SortByDescending(string memberName)
 {
     lock (DataRepo)
     {
         var ordered = Items.OrderByDescending(memberName);
         Items = new DataItemCollection <T>(ordered);
     }
 }
 void InitializeGallery(DataItemCollection dataStore)
 {
     foreach (var item in dataStore)
     {
         galleryControl1.Gallery.Groups[0].Items.Add(new GalleryItem()
         {
             Tag = item, Image = DXApplication1.Properties.Resources.Image1
         });
     }
 }
Ejemplo n.º 7
0
        public IApiRequest CreateRequest(string MethodName, DataItemCollection Parameters)
        {
            XmlHttpRequest    request = new XmlHttpRequest();
            XmlHttpMethodCall method  = new XmlHttpMethodCall();

            method.MethodName  = MethodName;
            method.Parameters  = (Parameters ?? method.Parameters);
            request.MethodCall = method;

            return(request);
        }
        private void dgRegionBreakdown_Sorting(object sender, GridViewSortingEventArgs e)
        {
            List <RegionBreakdownData> datasource = (e.DataControl.ItemsSource as ObservableCollection <RegionBreakdownData>).ToList();
            DataItemCollection         collection = (sender as RadGridView).Items;
            List <RegionBreakdownData> data       = new List <RegionBreakdownData>();

            foreach (RegionBreakdownData item in collection)
            {
                data.Add(item);
            }

            if ((e.Column as GridViewDataColumn).DataMemberBinding.Path.Path == "Security" ||
                e.NewSortingState == SortingState.None)
            {
                ArrangeSortOrder(data);
                return;
            }

            List <String>            distinctRegions = data.Select(a => a.Region).Distinct().ToList();
            List <OrderedAggregates> orderedRegion   = GetRegionAggregates(data, distinctRegions, (e.Column as GridViewDataColumn).DataMemberBinding.Path.Path);

            orderedRegion = e.NewSortingState == SortingState.Ascending
                ? orderedRegion.OrderBy(a => a.Aggregate).ToList()
                : orderedRegion.OrderByDescending(a => a.Aggregate).ToList();

            int regionCount = 1;

            foreach (String region in orderedRegion.Select(a => a.Description))
            {
                List <string> distinctCountries = data.Where(a => a.Region == region).OrderBy(a => a.Country)
                                                  .Select(a => a.Country).Distinct().ToList();
                List <OrderedAggregates> orderedCountnies = GetCountryAggregates(data, distinctCountries, region, (e.Column as GridViewDataColumn).DataMemberBinding.Path.Path);
                orderedCountnies = e.NewSortingState == SortingState.Ascending
                    ? orderedCountnies.OrderBy(a => a.Aggregate).ToList()
                    : orderedCountnies.OrderByDescending(a => a.Aggregate).ToList();
                int countryCount = 1;
                foreach (String country in orderedCountnies.Select(a => a.Description))
                {
                    foreach (RegionBreakdownData item in datasource)
                    {
                        if (item.Region == region && item.Country == country)
                        {
                            item.RegionSortOrder  = String.Format("{0}. {1}", regionCount < 10 ? " " + regionCount.ToString() : regionCount.ToString("00"), region);
                            item.CountrySortOrder = String.Format("{0}. {1}", countryCount < 10 ? " " + countryCount.ToString() : countryCount.ToString("00"), country);
                        }
                    }
                    countryCount++;
                }
                regionCount++;
            }

            this.dgRegionBreakdown.ItemsSource = new ObservableCollection <RegionBreakdownData>(datasource);
        }
Ejemplo n.º 9
0
        private void dgSectorBreakdown_Sorting(object sender, GridViewSortingEventArgs e)
        {
            List <SectorBreakdownData> datasource = (e.DataControl.ItemsSource as ObservableCollection <SectorBreakdownData>).ToList();
            DataItemCollection         collection = (sender as RadGridView).Items;
            List <SectorBreakdownData> data       = new List <SectorBreakdownData>();

            foreach (SectorBreakdownData item in collection)
            {
                data.Add(item);
            }

            if ((e.Column as GridViewDataColumn).DataMemberBinding.Path.Path == "Security" ||
                e.NewSortingState == SortingState.None)
            {
                ArrangeSortOrder(data);
                return;
            }

            List <String>            distinctSectors = data.Select(a => a.Sector).Distinct().ToList();
            List <OrderedAggregates> orderedSectors  = GetRegionAggregates(data, distinctSectors, (e.Column as GridViewDataColumn).DataMemberBinding.Path.Path);

            orderedSectors = e.NewSortingState == SortingState.Ascending
                ? orderedSectors.OrderBy(a => a.Aggregate).ToList()
                : orderedSectors.OrderByDescending(a => a.Aggregate).ToList();

            int sectorCount = 1;

            foreach (String sector in orderedSectors.Select(a => a.Description))
            {
                List <string> distinctIndustries = data.Where(a => a.Sector == sector).OrderBy(a => a.Industry)
                                                   .Select(a => a.Industry).Distinct().ToList();
                List <OrderedAggregates> orderedIndustries = GetCountryAggregates(data, distinctIndustries, sector, (e.Column as GridViewDataColumn).DataMemberBinding.Path.Path);
                orderedIndustries = e.NewSortingState == SortingState.Ascending
                    ? orderedIndustries.OrderBy(a => a.Aggregate).ToList()
                    : orderedIndustries.OrderByDescending(a => a.Aggregate).ToList();
                int industryCount = 1;
                foreach (String country in orderedIndustries.Select(a => a.Description))
                {
                    foreach (SectorBreakdownData item in datasource)
                    {
                        if (item.Sector == sector && item.Industry == country)
                        {
                            item.SectorSortOrder   = String.Format("{0}. {1}", sectorCount < 10 ? " " + sectorCount.ToString() : sectorCount.ToString("00"), sector);
                            item.IndustrySortOrder = String.Format("{0}. {1}", industryCount < 10 ? " " + industryCount.ToString() : industryCount.ToString("00"), country);
                        }
                    }
                    industryCount++;
                }
                sectorCount++;
            }
            this.dgSectorBreakdown.ItemsSource = new ObservableCollection <SectorBreakdownData>(datasource);
        }
Ejemplo n.º 10
0
        public DataBase()
        {
            Contaminants       = new DataItemCollection <Contaminant>();
            TransshippingAreas = new DataItemCollection <TransshippingArea>();
            ControlStations    = new DataItemCollection <ControlStation>();
            Ports = new DataItemCollection <Port>();
            EnvironmentalEquipments = new DataItemCollection <EnvironmentalEquipment>();

            TransshippingAreas.AddRelation(new ResetingRelation(Contaminants, x => ((Contaminant)x).TransshippingAreaId, x => ((Contaminant)x).TransshippingAreaId = 0));

            Contaminants.DataChanged       += OnDataBaseChanged;
            TransshippingAreas.DataChanged += OnDataBaseChanged;
            ControlStations.DataChanged    += OnDataBaseChanged;
            Ports.DataChanged += OnDataBaseChanged;
            EnvironmentalEquipments.DataChanged += OnDataBaseChanged;
        }
Ejemplo n.º 11
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            // We are binding an item
            DataItem item = value as DataItem;

            if (item != null)
            {
                return(item.Owner.Where(i => i.ParentId == item.Id));
            }
            // We are binding the treeview
            DataItemCollection items = value as DataItemCollection;

            if (items != null)
            {
                return(items.Where(i => i.ParentId == 0));
            }
            return(null);
        }
Ejemplo n.º 12
0
        public void UpdateItem <TDataItem, TData>(ToolStripItem item, TData data, DataItemCollection <TDataItem, TData> collection, bool showToolTip = true, bool showImage = false, bool updateText = false)
            where TDataItem : DataItem <TData>
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }
            if (collection == null)
            {
                throw new ArgumentNullException(nameof(collection));
            }

            var dataItem = collection[data];

            if (dataItem == null)
            {
                throw new ArgumentException(string.Empty, nameof(data));
            }

            _UpdateItem(item, dataItem, showToolTip, showImage, updateText);
        }
Ejemplo n.º 13
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            // We are binding an item
            DataItem item = value as DataItem;

            if (item != null)
            {
                var children   = item.OwnerCollection.Where(i => i.ParentId == item.Id);
                var collection = new DataItemCollection(children);
                collection.SetAssociatedItem(item);
                return(collection);
            }

            // We are binding the treeview
            DataItemCollection items = value as DataItemCollection;

            if (items != null)
            {
                var children = items.Where(i => i.ParentId == 0);
                return(new DataItemCollection(children));
            }
            return(null);
        }
Ejemplo n.º 14
0
        internal void OnSearchTextChanged()
        {
            IsBusy = true;
            var dispatcher = Application.Current.Dispatcher;
            var dItems     = DataItems;
            var vItems     = new DataItemCollection();

            Task.Factory.StartNew(() =>
            {
                foreach (DataItem dItem in dItems)
                {
                    if (Regex.IsMatch(dItem.Description, NameSearch == null ? "" : NameSearch, RegexOptions.IgnoreCase))
                    {
                        vItems.Add(dItem);
                    }
                }
                dispatcher.Invoke(() =>
                {
                    ViewItems.Clear();
                    ViewItems = vItems;
                    IsBusy    = false;
                });
            });
        }
Ejemplo n.º 15
0
 public Task5()
 {
     InitialData = new DataItemCollection();
 }
Ejemplo n.º 16
0
 public DataEditorViewModel()
 {
     _dataItems = new DataItemCollection();
     _viewItems = new DataItemCollection();
     _isEnabled = true;
 }
Ejemplo n.º 17
0
        public DataTable GetAttributesByDimension(Dimension D)
        {
            DimensionAttributeCollection DAC = D.Attributes;
            DataTable DT = new DataTable();

            DT.Columns.Add("Attribue Name");
            DT.Columns.Add("Table/View/Query");
            DT.Columns.Add("Source Key Column");
            DT.Columns.Add("Source Name Column");
            DT.Columns.Add("Usage");
            DT.Columns.Add("FriendlyName");
            DT.Columns.Add("TableType");

            DataSourceView DS = D.DataSourceView;
            DataSet        d  = new DataSet();

            d = DS.Schema;

            try
            {
                foreach (DimensionAttribute DA in DAC)
                {
                    //Console.Write(DA.Name + "\t|\t " + DA.Usage + " | ");
                    DataItemCollection DIC = DA.KeyColumns;
                    //DA.AttributeHierarchyEnabled;
                    //DA.DerivedFromTableId;
                    //DA.IsAggregatable;

                    foreach (DataItem DI in DIC)
                    {
                        ColumnBinding CB = (ColumnBinding)DI.Source;

                        string source     = DI.Source.ToString();
                        string NameColumn = DA.NameColumn.ToString();

                        DataTable VT = d.Tables[CB.TableID];

                        if (VT.ExtendedProperties["QueryDefinition"] != null)
                        {
                            DT.Rows.Add(DA.Name
                                        , VT.ExtendedProperties["QueryDefinition"].ToString()
                                        , source.Substring(source.IndexOf(".") + 1)
                                        , NameColumn.Substring(NameColumn.IndexOf(".") + 1)
                                        , DA.Usage
                                        , VT.ExtendedProperties["FriendlyName"]
                                        , "NamedQuery"
                                        );
                        }
                        else
                        {
                            DT.Rows.Add(DA.Name
                                        , VT.ExtendedProperties["DbTableName"]
                                        , source.Substring(source.IndexOf(".") + 1)
                                        , NameColumn.Substring(NameColumn.IndexOf(".") + 1)
                                        , DA.Usage
                                        , VT.ExtendedProperties["FriendlyName"]
                                        , VT.ExtendedProperties["TableType"]
                                        );
                        }

                        //Console.Write(DI.DataType + " | " + DI.Source + " | ");


                        //GetDataSourceViewDefinitionByTableID(VT);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            return(DT);
        }
 private string GetPartialQueryForAttributeColumns(DimensionAttribute Attr, DataItemCollection Cols, string ColType, int iLevel)
 {
     try
     {
         string qryView = "";
         if (Cols.Count > 1)
         {
             EnhancedColumnBinding cb = null;
             for (int k = 0; k < Cols.Count; k++)
             {
                 cb = (EnhancedColumnBinding)Cols[k].Source;
                 if (cb.NamedCalculationExpression != "")
                     qryView += "CONVERT(VARCHAR(MAX), " + cb.NamedCalculationExpression + ") + ";
                 else
                     qryView += "CONVERT(VARCHAR(MAX), " + cb.ColumnName + ") + ";
             }
             qryView = qryView.Trim().Trim('+');
             qryView += " [" + GetNaturalizedLevelName(iLevel) + "_" + Attr.Name + "_" + ColType + "]";
         }
         else
             qryView += GetPartialQueryForSingleAttributeColumn(Attr, Cols[0], ColType, iLevel);
         return qryView;
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 19
0
 public Task_2_exct()
 {
     InitialData = new DataItemCollection();
 }
		public DataItem()
		{
			this.items = new DataItemCollection(this);
		}
Ejemplo n.º 21
0
 public Zibarov()
 {
     InitialData = new DataItemCollection();
 }
Ejemplo n.º 22
0
 internal void SetOwner(DataItemCollection collection)
 {
     this.Owner = collection;
 }
        public LineDataSeries(Grid container, double margin, DataItemCollection dataItem,Brush palette)
            : base(container, margin, dataItem,palette)
        {

        }
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     this.dataStore = LoadData();
     InitializeGallery(this.dataStore);
 }
		public DataViewModel()
		{
			this.items = new DataItemCollection(null);

			this.BeginLoadingItems();
		}
Ejemplo n.º 26
0
 public task8()
 {
     InitialData = new DataItemCollection();
 }
Ejemplo n.º 27
0
        public MainWindow()
        {
            InitializeComponent();

            var source = new DataItemCollection()
            {
                new DataItem()
                {
                    Text = "Item 1", Id = 1, ParentId = 0
                },
                new DataItem()
                {
                    Text = "Item 2", Id = 2, ParentId = 0
                },
                new DataItem()
                {
                    Text = "Item 3", Id = 3, ParentId = 0
                },
                new DataItem()
                {
                    Text = "Item 1.1", Id = 5, ParentId = 1
                },
                new DataItem()
                {
                    Text = "Item 1.2", Id = 6, ParentId = 1
                },
                new DataItem()
                {
                    Text = "Item 1.3", Id = 7, ParentId = 1
                },
                new DataItem()
                {
                    Text = "Item 2.1", Id = 8, ParentId = 2
                },
                new DataItem()
                {
                    Text = "Item 2.2", Id = 9, ParentId = 2
                },
                new DataItem()
                {
                    Text = "Item 2.3", Id = 10, ParentId = 2
                },
                new DataItem()
                {
                    Text = "Item 3.1", Id = 11, ParentId = 3
                },
                new DataItem()
                {
                    Text = "Item 3.2", Id = 12, ParentId = 3
                },
                new DataItem()
                {
                    Text = "Item 3.3", Id = 13, ParentId = 3,
                }
            };

            foreach (var item in source)
            {
                item.SetOwnerCollection(source);
            }

            this.DataContext = source;
        }