//internal static string GetSortExpr(PerformMemberActionArgs args) //{ // List<string> sortExpr = new List<string>(); // string lasthier = args.Member.HierarchyUniqueName; // for (int i = 0; i < args.Ascendants.Count; i++) // { // var member = args.Ascendants[i]; // if (lasthier != member.HierarchyUniqueName) // { // lasthier = member.HierarchyUniqueName; // sortExpr.Insert(0, member.UniqueName); // } // } // sortExpr.Add(args.Member.UniqueName); // return "("+string.Join(",",sortExpr.ToArray())+")"; //} internal void SortByValue(PerformMemberActionArgs args) { var tuple = args.Member.GetAxisTuple(); var measuresSort=MeasuresSort as SortByValueDescriptor; if (measuresSort == null) { measuresSort = new SortByValueDescriptor(); measuresSort.Tuple=tuple; MeasuresSort = measuresSort; } else if (!measuresSort.CompareByTuple(tuple)) { measuresSort.Tuple = tuple; measuresSort.Type = SortTypes.None; } if (MeasuresSort.Type == SortTypes.None) MeasuresSort.Type = SortTypes.Ascending; else if (MeasuresSort.Type == SortTypes.Ascending) MeasuresSort.Type = SortTypes.Descending; else if (MeasuresSort.Type == SortTypes.Descending) MeasuresSort.Type = SortTypes.None; }
public Accounts() { InitializeComponent(); SortDescriptor banksSD = new SortDescriptor(); SortDescriptor typesSD = new SortDescriptor(); SortDescriptor entitiesSD = new SortDescriptor(); SortDescriptor currenciesSD = new SortDescriptor(); SortDescriptor divisionsSD = new SortDescriptor(); banksSD.Member = "name"; banksSD.SortDirection = ListSortDirection.Ascending; this.BanksdataServiceDataSource.SortDescriptors.Add(banksSD); typesSD.Member = "description"; typesSD.SortDirection = ListSortDirection.Ascending; this.TypesdataServiceDataSource.SortDescriptors.Add(typesSD); entitiesSD.Member = "name"; entitiesSD.SortDirection = ListSortDirection.Ascending; this.EntitiesdataServiceDataSource.SortDescriptors.Add(entitiesSD); currenciesSD.Member = "currencyCode"; currenciesSD.SortDirection = ListSortDirection.Ascending; this.CurrenciesdataServiceDataSource.SortDescriptors.Add(currenciesSD); divisionsSD.Member = "divisionCode"; divisionsSD.SortDirection = ListSortDirection.Ascending; this.DivisionsdataServiceDataSource.SortDescriptors.Add(divisionsSD); dataServiceDataSource.SubmittedChanges += new EventHandler<DataServiceSubmittedChangesEventArgs>(dataServiceDataSource_SubmittedChanges); dataServiceDataSource.LoadedData += new EventHandler<LoadedDataEventArgs>(dataServiceDataSource_LoadedData); dataServiceDataSource.LoadingData += new EventHandler<LoadingDataEventArgs>(dataServiceDataSource_LoadingData); }
public void CtorWithParamsTest() { var item = new SortDescriptor("column", SortDirection.Descending); Assert.AreEqual("column", item.ColumnName); Assert.AreEqual(SortDirection.Descending, item.Direction); }
public AccountsSigners() { InitializeComponent(); SortDescriptor accountsSD = new SortDescriptor(); SortDescriptor signersSD = new SortDescriptor(); SortDescriptor entitlementsSD = new SortDescriptor(); accountsSD.Member = "accountNumber"; accountsSD.SortDirection = ListSortDirection.Ascending; this.AccountsdataServiceDataSource.SortDescriptors.Add(accountsSD); signersSD.Member = "name"; signersSD.SortDirection = ListSortDirection.Ascending; this.SignersdataServiceDataSource.SortDescriptors.Add(signersSD); entitlementsSD.Member = "entitlementGroup"; entitlementsSD.SortDirection = ListSortDirection.Ascending; this.EntitlementsdataServiceDataSource.SortDescriptors.Add(entitlementsSD); Accounts_Signers_EntitlementsDataSource.SubmittedChanges += new EventHandler<DataServiceSubmittedChangesEventArgs>(Accounts_Signers_EntitlementsDataSource_SubmittedChanges); Accounts_Signers_EntitlementsDataSource.LoadedData += new EventHandler<LoadedDataEventArgs>(Accounts_Signers_EntitlementsDataSource_LoadedData); RadGridView1.ItemsSource = dataServiceDataSource.DataView; RadGridView1.IsSynchronizedWithCurrentItem = true; }
public Contacts() { InitializeComponent(); SortDescriptor banksSD = new SortDescriptor(); banksSD.Member = "name"; banksSD.SortDirection = ListSortDirection.Ascending; this.BanksdataServiceDataSource.SortDescriptors.Add(banksSD); dataServiceDataSource.SubmittedChanges += new EventHandler<DataServiceSubmittedChangesEventArgs>(dataServiceDataSource_SubmittedChanges); }
AxisInfo(AxisInfo old) { HideEmpty = old.HideEmpty; if (old.MeasuresSort != null) MeasuresSort = old.MeasuresSort.Clone(); foreach (var cont in old.Actions) { Actions.Add(cont.Clone()); } }
public Signers() { InitializeComponent(); SortDescriptor citizenshipsSD = new SortDescriptor(); citizenshipsSD.Member = "citizenshipName"; citizenshipsSD.SortDirection = ListSortDirection.Ascending; this.CitizenshipsdataServiceDataSource.SortDescriptors.Add(citizenshipsSD); dataServiceDataSource.SubmittedChanges += new EventHandler<DataServiceSubmittedChangesEventArgs>(dataServiceDataSource_SubmittedChanges); }
public ActivitiesViewModel() { this.groupDescriptor = new GroupDescriptor() { Member = "StatusType", SortDirection = System.ComponentModel.ListSortDirection.Ascending }; groupDescriptor.AggregateFunctions.Add(new CountFunction() { Caption = "Count:" }); this.sortDescriptor = new SortDescriptor() { Member = "DueDate", SortDirection = System.ComponentModel.ListSortDirection.Descending }; }
private void InitializeGridViewSettings() { var dateGroupDescriptor = new Telerik.Windows.Data.GroupDescriptor<Email, DateTime, DateTime>(); dateGroupDescriptor.GroupingExpression = email => email.Received.Date; this.gridView.GroupDescriptors.Add(dateGroupDescriptor); var dateSortDescriptor = new SortDescriptor<Email, DateTime>(); dateSortDescriptor.SortingExpression = item => item.Received; dateSortDescriptor.SortDirection = System.ComponentModel.ListSortDirection.Descending; this.gridView.SortDescriptors.Add(dateSortDescriptor); this.unreadDescriptor = new FilterDescriptor { Member = "Status", Operator = FilterOperator.IsEqualTo, Value = "Unread", }; }
public void InvalidPropertyPathSortDescriptor() { this._dds.AutoLoad = true; this._dds.QueryName = "GetCitiesQuery"; this._dds.DomainContext = new CityDomainContext(); // The first two cases are acceptable and support the binding scenario SortDescriptor sd = new SortDescriptor(null, ListSortDirection.Ascending); this._dds.SortDescriptors.Add(sd); sd.PropertyPath = string.Empty; this._dds.SortDescriptors.Clear(); // The second two cases throw exceptions for property paths that are not valid sd.PropertyPath = "invalid"; AssertExpectedException( new ArgumentException( string.Format( CultureInfo.InvariantCulture, CommonResources.PropertyNotFound, "invalid", "City")), () => this._dds.SortDescriptors.Add(sd)); AssertExpectedException( new ArgumentException( string.Format( CultureInfo.InvariantCulture, CommonResources.PropertyNotFound, "invalid2", "City")), () => sd.PropertyPath = "invalid2"); }
private void InitializeComponent() { SortDescriptor sortDescriptor1 = new SortDescriptor(); SortDescriptor sortDescriptor2 = new SortDescriptor(); ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(SingleWindow)); this.btnSetSourceServer = new RadButton(); this.visualStudio2012LightTheme1 = new VisualStudio2012LightTheme(); this.radSplitContainer1 = new RadSplitContainer(); this.HeaderPanel = new SplitPanel(); this.srcTableDropdown = new RadDropDownList(); this.refreshButton = new RadButton(); this.radLabel2 = new RadLabel(); this.btnSetDestinationServer = new RadButton(); this.TablesPanel = new SplitPanel(); this.gridFields = new RadGridView(); this.ButtonsQueryPanel = new SplitPanel(); this.btnSaveSQL = new RadButton(); this.btnExecute = new RadButton(); this.btnEnableConst = new RadButton(); this.btnDisableConst = new RadButton(); this.ProgressPanel = new SplitPanel(); this.progressBarResult = new RadProgressBar(); this.LabelsQuery = new SplitPanel(); this.btnClear = new RadButton(); this.radLabel1 = new RadLabel(); this.ResultQueryPanel = new SplitPanel(); this.txtResult = new RadTextBox(); this.saveFileDialog1 = new SaveFileDialog(); this.btnToggleSelect = new RadButton(); this.btnSetSourceServer.BeginInit(); this.radSplitContainer1.BeginInit(); this.radSplitContainer1.SuspendLayout(); this.HeaderPanel.BeginInit(); this.HeaderPanel.SuspendLayout(); this.srcTableDropdown.BeginInit(); this.refreshButton.BeginInit(); this.radLabel2.BeginInit(); this.btnSetDestinationServer.BeginInit(); this.TablesPanel.BeginInit(); this.TablesPanel.SuspendLayout(); this.gridFields.BeginInit(); this.gridFields.MasterTemplate.BeginInit(); this.ButtonsQueryPanel.BeginInit(); this.ButtonsQueryPanel.SuspendLayout(); this.btnSaveSQL.BeginInit(); this.btnExecute.BeginInit(); this.btnEnableConst.BeginInit(); this.btnDisableConst.BeginInit(); this.ProgressPanel.BeginInit(); this.ProgressPanel.SuspendLayout(); this.progressBarResult.BeginInit(); this.LabelsQuery.BeginInit(); this.LabelsQuery.SuspendLayout(); this.btnClear.BeginInit(); this.radLabel1.BeginInit(); this.ResultQueryPanel.BeginInit(); this.ResultQueryPanel.SuspendLayout(); this.txtResult.BeginInit(); this.btnToggleSelect.BeginInit(); this.BeginInit(); this.SuspendLayout(); this.btnSetSourceServer.DisplayStyle = DisplayStyle.Image; this.btnSetSourceServer.Dock = DockStyle.Left; this.btnSetSourceServer.Image = (Image)Resources.tool_icon; this.btnSetSourceServer.ImageAlignment = ContentAlignment.MiddleCenter; this.btnSetSourceServer.Location = new Point(0, 20); this.btnSetSourceServer.Name = "btnSetSourceServer"; this.btnSetSourceServer.Size = new Size(43, 40); this.btnSetSourceServer.TabIndex = 2; this.btnSetSourceServer.ThemeName = "VisualStudio2012Light"; this.btnSetSourceServer.Click += new EventHandler(this.btnSetSourceServer_Click); this.radSplitContainer1.Controls.Add((Control)this.HeaderPanel); this.radSplitContainer1.Controls.Add((Control)this.TablesPanel); this.radSplitContainer1.Controls.Add((Control)this.ButtonsQueryPanel); this.radSplitContainer1.Controls.Add((Control)this.ProgressPanel); this.radSplitContainer1.Controls.Add((Control)this.LabelsQuery); this.radSplitContainer1.Controls.Add((Control)this.ResultQueryPanel); this.radSplitContainer1.Dock = DockStyle.Fill; this.radSplitContainer1.Location = new Point(0, 0); this.radSplitContainer1.Name = "radSplitContainer1"; this.radSplitContainer1.Orientation = Orientation.Horizontal; this.radSplitContainer1.RootElement.MinSize = new Size(0, 0); this.radSplitContainer1.Size = new Size(767, 633); this.radSplitContainer1.SplitterWidth = 3; this.radSplitContainer1.TabIndex = 5; this.radSplitContainer1.TabStop = false; this.radSplitContainer1.ThemeName = "VisualStudio2012Light"; this.HeaderPanel.Controls.Add((Control)this.srcTableDropdown); this.HeaderPanel.Controls.Add((Control)this.refreshButton); this.HeaderPanel.Controls.Add((Control)this.radLabel2); this.HeaderPanel.Controls.Add((Control)this.btnSetDestinationServer); this.HeaderPanel.Controls.Add((Control)this.btnSetSourceServer); this.HeaderPanel.Location = new Point(0, 0); this.HeaderPanel.Name = "HeaderPanel"; this.HeaderPanel.Padding = new Padding(0, 20, 0, 0); this.HeaderPanel.RootElement.MaxSize = new Size(0, 60); this.HeaderPanel.RootElement.MinSize = new Size(0, 60); this.HeaderPanel.Size = new Size(767, 60); this.HeaderPanel.SizeInfo.AutoSizeScale = new SizeF(0.0f, -0.1355878f); this.HeaderPanel.SizeInfo.MaximumSize = new Size(0, 60); this.HeaderPanel.SizeInfo.MinimumSize = new Size(0, 60); this.HeaderPanel.TabIndex = 0; this.HeaderPanel.TabStop = false; this.HeaderPanel.Text = "splitPanel1"; this.HeaderPanel.ThemeName = "VisualStudio2012Light"; this.srcTableDropdown.Dock = DockStyle.Fill; this.srcTableDropdown.Location = new Point(118, 20); this.srcTableDropdown.Name = "srcTableDropdown"; this.srcTableDropdown.Size = new Size(563, 40); this.srcTableDropdown.TabIndex = 0; this.srcTableDropdown.ThemeName = "VisualStudio2012Light"; this.srcTableDropdown.SelectedIndexChanged += new Telerik.WinControls.UI.Data.PositionChangedEventHandler(this.srcTableDropdown_SelectedIndexChanged); this.refreshButton.DisplayStyle = DisplayStyle.Image; this.refreshButton.Dock = DockStyle.Right; this.refreshButton.Image = (Image)Resources.reload_icon; this.refreshButton.ImageAlignment = ContentAlignment.MiddleCenter; this.refreshButton.Location = new Point(681, 20); this.refreshButton.Name = "refreshButton"; this.refreshButton.Size = new Size(43, 40); this.refreshButton.TabIndex = 6; this.refreshButton.ThemeName = "VisualStudio2012Light"; this.refreshButton.Click += new EventHandler(this.refreshButton_Click); this.radLabel2.Dock = DockStyle.Left; this.radLabel2.Font = new Font("Segoe UI", 8.25f, FontStyle.Bold); this.radLabel2.Location = new Point(43, 20); this.radLabel2.Name = "radLabel2"; this.radLabel2.Size = new Size(75, 40); this.radLabel2.TabIndex = 1; this.radLabel2.Text = "Source Table"; this.radLabel2.ThemeName = "VisualStudio2012Light"; this.btnSetDestinationServer.DisplayStyle = DisplayStyle.Image; this.btnSetDestinationServer.Dock = DockStyle.Right; this.btnSetDestinationServer.Image = (Image)Resources.tool_icon; this.btnSetDestinationServer.ImageAlignment = ContentAlignment.MiddleCenter; this.btnSetDestinationServer.Location = new Point(724, 20); this.btnSetDestinationServer.Name = "btnSetDestinationServer"; this.btnSetDestinationServer.Size = new Size(43, 40); this.btnSetDestinationServer.TabIndex = 5; this.btnSetDestinationServer.ThemeName = "VisualStudio2012Light"; this.btnSetDestinationServer.Click += new EventHandler(this.btnSetDestinationServer_Click); this.TablesPanel.Controls.Add((Control)this.gridFields); this.TablesPanel.Location = new Point(0, 63); this.TablesPanel.Name = "TablesPanel"; this.TablesPanel.Padding = new Padding(5); this.TablesPanel.RootElement.MinSize = new Size(0, 0); this.TablesPanel.Size = new Size(767, 308); this.TablesPanel.SizeInfo.AutoSizeScale = new SizeF(0.0f, 0.1494364f); this.TablesPanel.SizeInfo.SplitterCorrection = new Size(0, -72); this.TablesPanel.TabIndex = 1; this.TablesPanel.TabStop = false; this.TablesPanel.Text = "splitPanel2"; this.TablesPanel.ThemeName = "VisualStudio2012Light"; this.gridFields.AutoSizeRows = true; this.gridFields.BeginEditMode = RadGridViewBeginEditMode.BeginEditProgrammatically; this.gridFields.Dock = DockStyle.Fill; this.gridFields.EnableHotTracking = false; this.gridFields.Location = new Point(5, 5); this.gridFields.MasterTemplate.AllowAddNewRow = false; this.gridFields.MasterTemplate.AllowColumnChooser = false; this.gridFields.MasterTemplate.AllowColumnReorder = false; this.gridFields.MasterTemplate.AllowDeleteRow = false; this.gridFields.MasterTemplate.AllowDragToGroup = false; this.gridFields.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.gridFields.MasterTemplate.EnableAlternatingRowColor = true; this.gridFields.MasterTemplate.EnableFiltering = true; this.gridFields.MasterTemplate.EnableGrouping = false; this.gridFields.MasterTemplate.MultiSelect = true; sortDescriptor1.PropertyName = "idCol"; sortDescriptor2.PropertyName = "column1"; this.gridFields.MasterTemplate.SortDescriptors.AddRange(sortDescriptor1, sortDescriptor2); this.gridFields.Name = "gridFields"; this.gridFields.Size = new Size(757, 298); this.gridFields.TabIndex = 0; this.gridFields.Text = "radGridView1"; this.ButtonsQueryPanel.Controls.Add((Control)this.btnToggleSelect); this.ButtonsQueryPanel.Controls.Add((Control)this.btnSaveSQL); this.ButtonsQueryPanel.Controls.Add((Control)this.btnExecute); this.ButtonsQueryPanel.Controls.Add((Control)this.btnEnableConst); this.ButtonsQueryPanel.Controls.Add((Control)this.btnDisableConst); this.ButtonsQueryPanel.Location = new Point(0, 374); this.ButtonsQueryPanel.Name = "ButtonsQueryPanel"; this.ButtonsQueryPanel.Padding = new Padding(0, 5, 0, 0); this.ButtonsQueryPanel.RootElement.MaxSize = new Size(0, 40); this.ButtonsQueryPanel.RootElement.MinSize = new Size(0, 40); this.ButtonsQueryPanel.Size = new Size(767, 40); this.ButtonsQueryPanel.SizeInfo.AutoSizeScale = new SizeF(0.0f, -0.1533011f); this.ButtonsQueryPanel.SizeInfo.MaximumSize = new Size(0, 40); this.ButtonsQueryPanel.SizeInfo.MinimumSize = new Size(0, 40); this.ButtonsQueryPanel.SizeInfo.SplitterCorrection = new Size(0, 124); this.ButtonsQueryPanel.TabIndex = 2; this.ButtonsQueryPanel.TabStop = false; this.ButtonsQueryPanel.Text = "splitPanel3"; this.ButtonsQueryPanel.ThemeName = "VisualStudio2012Light"; this.btnSaveSQL.Dock = DockStyle.Right; this.btnSaveSQL.Image = (Image)Resources.copy_icon; this.btnSaveSQL.Location = new Point(581, 5); this.btnSaveSQL.Name = "btnSaveSQL"; this.btnSaveSQL.Padding = new Padding(5, 0, 5, 0); this.btnSaveSQL.Size = new Size(100, 35); this.btnSaveSQL.TabIndex = 6; this.btnSaveSQL.Text = "Save to file"; this.btnSaveSQL.TextAlignment = ContentAlignment.MiddleRight; this.btnSaveSQL.ThemeName = "VisualStudio2012Light"; this.btnSaveSQL.Click += new EventHandler(this.btnSaveSQL_Click); this.btnExecute.Dock = DockStyle.Right; this.btnExecute.Image = (Image)Resources.run_icon; this.btnExecute.Location = new Point(681, 5); this.btnExecute.Name = "btnExecute"; this.btnExecute.Padding = new Padding(5, 0, 5, 0); this.btnExecute.Size = new Size(86, 35); this.btnExecute.TabIndex = 5; this.btnExecute.Text = "Execute"; this.btnExecute.TextAlignment = ContentAlignment.MiddleRight; this.btnExecute.ThemeName = "VisualStudio2012Light"; this.btnExecute.Click += new EventHandler(this.btnExecute_Click); this.btnEnableConst.Dock = DockStyle.Left; this.btnEnableConst.Image = (Image)Resources.enable_icon; this.btnEnableConst.Location = new Point(136, 5); this.btnEnableConst.Name = "btnEnableConst"; this.btnEnableConst.Padding = new Padding(5, 0, 5, 0); this.btnEnableConst.Size = new Size(136, 35); this.btnEnableConst.TabIndex = 4; this.btnEnableConst.Text = "Enable constraints"; this.btnEnableConst.TextAlignment = ContentAlignment.MiddleRight; this.btnEnableConst.ThemeName = "VisualStudio2012Light"; this.btnEnableConst.Click += new EventHandler(this.btnEnableConst_Click); this.btnDisableConst.Dock = DockStyle.Left; this.btnDisableConst.Image = (Image)Resources.disable_icon; this.btnDisableConst.Location = new Point(0, 5); this.btnDisableConst.Name = "btnDisableConst"; this.btnDisableConst.Padding = new Padding(5, 0, 5, 0); this.btnDisableConst.Size = new Size(136, 35); this.btnDisableConst.TabIndex = 3; this.btnDisableConst.Text = "Disable constraints"; this.btnDisableConst.TextAlignment = ContentAlignment.MiddleRight; this.btnDisableConst.ThemeName = "VisualStudio2012Light"; this.btnDisableConst.Click += new EventHandler(this.btnDisableConst_Click); this.ProgressPanel.Controls.Add((Control)this.progressBarResult); this.ProgressPanel.Location = new Point(0, 417); this.ProgressPanel.Name = "ProgressPanel"; this.ProgressPanel.RootElement.MaxSize = new Size(0, 30); this.ProgressPanel.RootElement.MinSize = new Size(0, 30); this.ProgressPanel.Size = new Size(767, 30); this.ProgressPanel.SizeInfo.AutoSizeScale = new SizeF(0.0f, 0.27343f); this.ProgressPanel.SizeInfo.MaximumSize = new Size(0, 30); this.ProgressPanel.SizeInfo.MinimumSize = new Size(0, 30); this.ProgressPanel.SizeInfo.SplitterCorrection = new Size(0, 106); this.ProgressPanel.TabIndex = 3; this.ProgressPanel.TabStop = false; this.ProgressPanel.Text = "splitPanel4"; this.ProgressPanel.ThemeName = "VisualStudio2012Light"; this.progressBarResult.Dock = DockStyle.Fill; this.progressBarResult.Location = new Point(0, 0); this.progressBarResult.Name = "progressBarResult"; this.progressBarResult.SeparatorGradientAngle = 4; this.progressBarResult.SeparatorWidth = 5; this.progressBarResult.ShowProgressIndicators = true; this.progressBarResult.Size = new Size(767, 30); this.progressBarResult.Step = 1; this.progressBarResult.StepWidth = 30; this.progressBarResult.SweepAngle = 60; this.progressBarResult.TabIndex = 6; this.progressBarResult.TabStop = false; this.progressBarResult.Text = "0 %"; this.progressBarResult.ThemeName = "VisualStudio2012Light"; this.LabelsQuery.Controls.Add((Control)this.btnClear); this.LabelsQuery.Controls.Add((Control)this.radLabel1); this.LabelsQuery.Location = new Point(0, 450); this.LabelsQuery.Name = "LabelsQuery"; this.LabelsQuery.RootElement.MaxSize = new Size(0, 30); this.LabelsQuery.RootElement.MinSize = new Size(0, 30); this.LabelsQuery.Size = new Size(767, 30); this.LabelsQuery.SizeInfo.AutoSizeScale = new SizeF(0.0f, -0.1355878f); this.LabelsQuery.SizeInfo.MaximumSize = new Size(0, 30); this.LabelsQuery.SizeInfo.MinimumSize = new Size(0, 30); this.LabelsQuery.SizeInfo.SplitterCorrection = new Size(0, -82); this.LabelsQuery.TabIndex = 4; this.LabelsQuery.TabStop = false; this.LabelsQuery.Text = "splitPanel8"; this.LabelsQuery.ThemeName = "VisualStudio2012Light"; this.btnClear.Dock = DockStyle.Right; this.btnClear.Image = (Image)Resources.clear_icon; this.btnClear.Location = new Point(701, 0); this.btnClear.Name = "btnClear"; this.btnClear.Padding = new Padding(5, 0, 5, 0); this.btnClear.Size = new Size(66, 30); this.btnClear.TabIndex = 6; this.btnClear.Text = "Clear"; this.btnClear.TextAlignment = ContentAlignment.MiddleRight; this.btnClear.ThemeName = "VisualStudio2012Light"; this.btnClear.Click += new EventHandler(this.btnClear_Click); this.radLabel1.Dock = DockStyle.Left; this.radLabel1.Font = new Font("Segoe UI", 8.25f, FontStyle.Bold | FontStyle.Italic); this.radLabel1.Location = new Point(0, 0); this.radLabel1.Name = "radLabel1"; this.radLabel1.Size = new Size(71, 30); this.radLabel1.TabIndex = 0; this.radLabel1.Text = "Query result"; this.radLabel1.ThemeName = "VisualStudio2012Light"; this.ResultQueryPanel.Controls.Add((Control)this.txtResult); this.ResultQueryPanel.Location = new Point(0, 483); this.ResultQueryPanel.Name = "ResultQueryPanel"; this.ResultQueryPanel.RootElement.MaxSize = new Size(0, 150); this.ResultQueryPanel.RootElement.MinSize = new Size(0, 150); this.ResultQueryPanel.Size = new Size(767, 150); this.ResultQueryPanel.SizeInfo.MaximumSize = new Size(0, 150); this.ResultQueryPanel.SizeInfo.MinimumSize = new Size(0, 150); this.ResultQueryPanel.TabIndex = 5; this.ResultQueryPanel.TabStop = false; this.ResultQueryPanel.Text = "splitPanel1"; this.ResultQueryPanel.ThemeName = "VisualStudio2012Light"; this.txtResult.AutoSize = false; this.txtResult.Dock = DockStyle.Fill; this.txtResult.Location = new Point(0, 0); this.txtResult.Multiline = true; this.txtResult.Name = "txtResult"; this.txtResult.ScrollBars = ScrollBars.Vertical; this.txtResult.Size = new Size(767, 150); this.txtResult.TabIndex = 0; this.saveFileDialog1.DefaultExt = "sql"; this.saveFileDialog1.FileName = "export"; this.saveFileDialog1.Filter = "Archivo SQL|*.sql|Todos los archivos|*.*"; this.saveFileDialog1.Title = "Save data"; this.btnToggleSelect.Dock = DockStyle.Left; this.btnToggleSelect.Image = (Image)Resources.tool_icon; this.btnToggleSelect.Location = new Point(272, 5); this.btnToggleSelect.Name = "btnToggleSelect"; this.btnToggleSelect.Padding = new Padding(5, 0, 5, 0); this.btnToggleSelect.Size = new Size(116, 35); this.btnToggleSelect.TabIndex = 7; this.btnToggleSelect.Text = "Un/Select All"; this.btnToggleSelect.TextAlignment = ContentAlignment.MiddleRight; this.btnToggleSelect.ThemeName = "VisualStudio2012Light"; this.btnToggleSelect.Click += new EventHandler(this.btnToggleSelect_Click); this.AutoScaleDimensions = new SizeF(6f, 13f); this.AutoScaleMode = AutoScaleMode.Font; this.ClientSize = new Size(767, 633); this.Controls.Add((Control)this.radSplitContainer1); this.Icon = (Icon)componentResourceManager.GetObject("$this.Icon"); this.Name = "SingleWindow"; this.RootElement.ApplyShapeToControl = true; this.Text = "Migration Tool PostgreSQL - Optimized for Odoo"; this.ThemeName = "VisualStudio2012Light"; this.WindowState = FormWindowState.Maximized; this.btnSetSourceServer.EndInit(); this.radSplitContainer1.EndInit(); this.radSplitContainer1.ResumeLayout(false); this.HeaderPanel.EndInit(); this.HeaderPanel.ResumeLayout(false); this.HeaderPanel.PerformLayout(); this.srcTableDropdown.EndInit(); this.refreshButton.EndInit(); this.radLabel2.EndInit(); this.btnSetDestinationServer.EndInit(); this.TablesPanel.EndInit(); this.TablesPanel.ResumeLayout(false); this.gridFields.MasterTemplate.EndInit(); this.gridFields.EndInit(); this.ButtonsQueryPanel.EndInit(); this.ButtonsQueryPanel.ResumeLayout(false); this.btnSaveSQL.EndInit(); this.btnExecute.EndInit(); this.btnEnableConst.EndInit(); this.btnDisableConst.EndInit(); this.ProgressPanel.EndInit(); this.ProgressPanel.ResumeLayout(false); this.progressBarResult.EndInit(); this.LabelsQuery.EndInit(); this.LabelsQuery.ResumeLayout(false); this.LabelsQuery.PerformLayout(); this.btnClear.EndInit(); this.radLabel1.EndInit(); this.ResultQueryPanel.EndInit(); this.ResultQueryPanel.ResumeLayout(false); this.txtResult.EndInit(); this.btnToggleSelect.EndInit(); this.EndInit(); this.ResumeLayout(false); }
/// <summary> /// 初始化ViewModel /// <remarks> /// 统一在此处创建并注册CollectionView集合。 /// </remarks> /// </summary> private void InitializeVM() { CurAnnuals = new QueryableDataServiceCollectionView<AnnualDTO>(_context, _context.Annuals); _annualDescriptor = new FilterDescriptor("IsOpen", FilterOperator.IsEqualTo, true); CurAnnuals.FilterDescriptors.Add(_annualDescriptor); CurAnnuals.LoadedData += (sender, e) => { if (CurAnnuals.Count != 0) { _curAnnual = CurAnnuals.First(); _planDescriptor.Value = _curAnnual.Year; if (!Plans.AutoLoad) Plans.AutoLoad = true; else Plans.Load(true); RefreshCommandState(); } }; Plans = _service.CreateCollection(_context.Plans); _planDescriptor = new FilterDescriptor("Year", FilterOperator.IsEqualTo, -1); var sort = new SortDescriptor {Member = "VersionNumber", SortDirection = ListSortDirection.Ascending}; Plans.SortDescriptors.Add(sort); Plans.FilterDescriptors.Add(_planDescriptor); Plans.LoadedData += (sender, e) => { CurPlan = new ObservableCollection<PlanDTO> {Plans.OrderBy(p => p.VersionNumber).LastOrDefault()}; SelPlan = CurPlan.FirstOrDefault(); if (SelPlan != null) { _planHistoryDescriptor.Value = SelPlan.Id; if (!CurPlanHistories.AutoLoad) CurPlanHistories.AutoLoad = true; else CurPlanHistories.Load(true); } RefreshCommandState(); }; _service.RegisterCollectionView(Plans); //注册查询集合 CurPlanHistories = _service.CreateCollection(_context.PlanHistories); _planHistoryDescriptor = new FilterDescriptor("PlanId", FilterOperator.IsEqualTo, Guid.Empty); CurPlanHistories.FilterDescriptors.Add(_planHistoryDescriptor); CurPlanHistories.LoadedData += (o, e) => { foreach (var ph in CurPlanHistories.SourceCollection.Cast<PlanHistoryDTO>()) { ph.ActionCategories.AddRange(ph.ActionCategories); ph.AircraftCategories.AddRange(_service.GetAircraftCategoriesForPlanHistory(ph)); ph.AircraftTypes.AddRange(_service.GetAircraftTypesForPlanHistory(ph)); _context.ChangeState(ph, EntityStates.Unchanged); } }; _service.RegisterCollectionView(CurPlanHistories); //注册查询集合 }
/// <summary> /// The change grouping. /// </summary> /// <param name="groupDescriptorMemberPath"> /// The group descriptor member path. /// </param> private void ChangeGrouping(GroupDescriptorPath groupDescriptorMemberPath) { if (!this.isSorting) this.SortDirection = null; this.isSorting = false; this.GroupedItems.GroupDescriptors.Clear(); string memberString = groupDescriptorMemberPath.ToString(); this.GroupedItems.GroupDescriptors.Add(new GroupDescriptor { Member = memberString }); if (groupDescriptorMemberPath == GroupDescriptorPath.Access) { SortDescriptor desc = new SortDescriptor() { Member = "Access" }; this.GroupedItems.SortDescriptors.Add(desc); } }
protected DataSourceSortDescriptorBuilder Add(SortDescriptor descriptor) { descriptors.Add(descriptor); return(new DataSourceSortDescriptorBuilder(descriptor)); }
public SortDescriptorTests() { descriptor = new SortDescriptor(); }
public static Expression CreateGroupedMethodExpression(this DataSourceRequest request, Expression ex) { if (request.Groups == null || request.Groups.Count == 0) { throw new ArgumentException("Groups are required."); } var filters = new List <IFilterDescriptor>(); if (request.Filters != null) { filters.AddRange(request.Filters); } if (filters.Any()) { ex = ex.Where(filters); } var sort = new List <SortDescriptor>(); if (request.Sorts != null) { sort.AddRange(request.Sorts); } var temporarySortDescriptors = new List <SortDescriptor>(); IList <GroupDescriptor> groups = new List <GroupDescriptor>(request.Groups); var aggregates = new List <AggregateDescriptor>(); if (request.Aggregates != null) { aggregates.AddRange(request.Aggregates); } if (aggregates.Any()) { groups.Each(g => { g.AggregateFunctions.Clear(); g.AggregateFunctions.AddRange(aggregates.SelectMany(a => a.Aggregates)); }); } if (!sort.Any()) { // The Entity Framework provider demands OrderBy before calling Skip. SortDescriptor sortDescriptor = new SortDescriptor { Member = ex.GetUnderlyingElementType().FirstSortableProperty() }; sort.Add(sortDescriptor); temporarySortDescriptors.Add(sortDescriptor); } groups.Reverse().Each(groupDescriptor => { var sortDescriptor = new SortDescriptor { Member = groupDescriptor.Member, SortDirection = groupDescriptor.SortDirection }; sort.Insert(0, sortDescriptor); temporarySortDescriptors.Add(sortDescriptor); }); ex = ex.GetSortExpression(sort); var notPagedData = ex; ex = ex.GetPageExpression(request.Page - 1, request.PageSize); ex = ex.GetGroupByExpression(notPagedData, groups); //ex = Expression.Call(typeof(Enumerable), "ToList", new Type[] { typeof(AggregateFunctionsGroup) }, ex); temporarySortDescriptors.Each(sortDescriptor => sort.Remove(sortDescriptor)); return(ex); }
public async Task <DatasourceResult <List <T> > > GetResult() { var aggs = new Dictionary <string, AggregationContainer>(); if (_aggregations.Count > 0) { foreach (var aggregation in _aggregations) { switch (aggregation.AggregationType) { case AggregationType.MAX: { var aggregationContainer = new AggregationContainer(); aggregationContainer.Max = new MaxAggregation(aggregation.ColumnName + "_max", aggregation.ColumnName); aggs.Add(aggregation.ColumnName + "_max", aggregationContainer); break; } case AggregationType.MIN: { var aggregationContainer = new AggregationContainer(); aggregationContainer.Min = new MinAggregation(aggregation.ColumnName + "_min", aggregation.ColumnName); aggs.Add(aggregation.ColumnName + "_min", aggregationContainer); break; } case AggregationType.AVG: { var aggregationContainer = new AggregationContainer(); aggregationContainer.Average = new AverageAggregation(aggregation.ColumnName + "_avg", aggregation.ColumnName); aggs.Add(aggregation.ColumnName + "_avg", aggregationContainer); break; } case AggregationType.SUM: { var aggregationContainer = new AggregationContainer(); aggregationContainer.Sum = new SumAggregation(aggregation.ColumnName + "_sum", aggregation.ColumnName); aggs.Add(aggregation.ColumnName + "_sum", aggregationContainer); break; } } } } //sort var sortDescriptor = new SortDescriptor <T>(); foreach (var sort in _esSort) { sortDescriptor.Field(sort.SortKey, (SortOrder)sort.Order); } var responseQuery = await _esClient.SearchAsync <T>(s => s .From(_from > 0 ? _from : QueryConstant.DefaultOffset) .Size(_size > QueryConstant.MaxLimit ? QueryConstant.MaxLimit : (_size > 0 ? _size : QueryConstant.MaxLimit)) .Query(q => { return(_boolQuery); }) .Aggregations(aggs) .Sort(so => { return(sortDescriptor); }) ); if (responseQuery.OriginalException != null || !responseQuery.IsValid) { throw new Exception((responseQuery.OriginalException != null ? responseQuery.OriginalException.Message : "Query is invalid") + ", switching to MongoDB"); } DatasourceResult <List <T> > result = new DatasourceResult <List <T> > { From = _from, Size = _size }; result.Total = responseQuery.Total; result.Data = responseQuery.Documents.ToList(); foreach (var item in responseQuery.Aggregations) { if (item.Value is ValueAggregate) { var valueAggregate = (ValueAggregate)item.Value; result.AggsResult.Add(item.Key, valueAggregate.Value.Value); } else { result.AggsResult.Add(item.Key, null); } } return(result); }
/// <summary> /// Construct the sort descriptor using the user inputted sort tuple /// </summary> /// <typeparam name="T"></typeparam> /// <param name="sortDescriptor">Pre-existing SortDescriptor</param> /// <param name="sort">User-inputted sort tuple</param> public static SortDescriptor <T> ConstructSortDescriptor <T>( this SortDescriptor <T> sortDescriptor, (string, string)?sort) where T : class
public PagerData <CommentEs> QueryCommentFromEs( string user_product_id = null, string user_uid = null, string q = null, int page = 1, int pagesize = 10) { var data = new PagerData <CommentEs>(); var client = ElasticsearchClientManager.Instance.DefaultClient.CreateClient(); var temp = new CommentEs(); var tag_temp = new TagEs(); var sd = new SearchDescriptor <CommentEs>(); sd = sd.Index(INDEX_NAME); #region where var query = new QueryContainer(); if (ValidateHelper.IsPlumpString(user_product_id)) { query &= new TermQuery() { Field = nameof(temp.UserProductUID), Value = user_product_id }; } if (ValidateHelper.IsPlumpString(user_uid)) { query &= new TermQuery() { Field = nameof(temp.UserUID), Value = user_uid }; } if (ValidateHelper.IsPlumpString(q)) { query &= new MatchQuery() { Field = nameof(temp.Comment), Query = q, Operator = Operator.Or, MinimumShouldMatch = "100%" }; } sd = sd.Query(_ => query); #endregion #region order var sort = new SortDescriptor <CommentEs>(); sort = sort.Descending(x => x.CreateTime); sd = sd.Sort(_ => sort); #endregion #region aggs sd = sd.Aggregations(x => x .Terms("tags", av => av.Field($"{nameof(temp.Tags)}.{nameof(tag_temp.TagName)}").Size(10)) .Terms("shops", av => av.Field(f => f.TraderUID).Size(10)) .Average("score", av => av.Field(f => f.Score))); #endregion #region pager sd = sd.QueryPage_(page, pagesize); #endregion var response = client.Search <CommentEs>(_ => sd); response.ThrowIfException(); data.ItemCount = (int)response.Total; data.DataList = response.Documents.ToList(); var tags_agg = response.Aggs.Terms("tags"); var shops_agg = response.Aggs.Terms("shops"); var score_agg = response.Aggs.Average("score"); return(data); }
public static ListYearOutcomeFromCategory Version2(IKey categoryKey, YearModel year, SortDescriptor <OutcomeOverviewSortType> sortDescriptor = null, int?pageIndex = null) { return(new ListYearOutcomeFromCategory(categoryKey, year, sortDescriptor, pageIndex, 2)); }
public ListYearOutcomeFromCategory(IKey categoryKey, YearModel year, SortDescriptor <OutcomeOverviewSortType> sortDescriptor = null, int?pageIndex = null) : this(categoryKey, year, sortDescriptor, pageIndex, 1) { }
private void radRadioButton_CheckStateChanged(object sender, EventArgs e) { RadRadioButton radioButton = sender as RadRadioButton; RadRadioButton button = radioButton?.Parent.Controls.OfType <RadRadioButton>() .FirstOrDefault(n => n.IsChecked); if (button == null) { return; } gridViewDecks.GroupDescriptors.Clear(); gridViewDecks.FilterDescriptors.Clear(); gridViewDecks.SortDescriptors.Clear(); FilterDescriptor fDescriptor = new FilterDescriptor(); GroupDescriptor gDescriptor = new GroupDescriptor(); SortDescriptor sDescriptor = new SortDescriptor(); switch (button.Name) { case "rbFree": fDescriptor.Operator = FilterOperator.IsEqualTo; fDescriptor.Value = 0; fDescriptor.IsFilterEditor = true; gridViewDecks.Columns["MyDust"].FilterDescriptor = fDescriptor; sDescriptor.PropertyName = "Tier"; sDescriptor.Direction = ListSortDirection.Ascending; gridViewDecks.MasterTemplate.SortDescriptors.Add(sDescriptor); sDescriptor = new SortDescriptor(); sDescriptor.PropertyName = "Dust"; sDescriptor.Direction = ListSortDirection.Descending; gridViewDecks.MasterTemplate.SortDescriptors.Add(sDescriptor); break; case "rbClass": gDescriptor.GroupNames.Add("Class", ListSortDirection.Ascending); gridViewDecks.GroupDescriptors.Add(gDescriptor); sDescriptor.PropertyName = "MyDust"; sDescriptor.Direction = ListSortDirection.Ascending; gridViewDecks.MasterTemplate.SortDescriptors.Add(sDescriptor); sDescriptor = new SortDescriptor(); sDescriptor.PropertyName = "Tier"; sDescriptor.Direction = ListSortDirection.Ascending; gridViewDecks.MasterTemplate.SortDescriptors.Add(sDescriptor); sDescriptor = new SortDescriptor(); sDescriptor.PropertyName = "Dust"; sDescriptor.Direction = ListSortDirection.Descending; gridViewDecks.MasterTemplate.SortDescriptors.Add(sDescriptor); fDescriptor.Operator = FilterOperator.IsEqualTo; fDescriptor.Value = DeckType.Standard; fDescriptor.IsFilterEditor = true; gridViewDecks.Columns["DeckType"].FilterDescriptor = fDescriptor; fDescriptor = new FilterDescriptor(); fDescriptor.Operator = FilterOperator.IsLessThanOrEqualTo; fDescriptor.Value = 1; fDescriptor.IsFilterEditor = true; gridViewDecks.Columns["MissingCardNo"].FilterDescriptor = fDescriptor; break; case "rbSource": gDescriptor.GroupNames.Add("Source", ListSortDirection.Ascending); gridViewDecks.GroupDescriptors.Add(gDescriptor); sDescriptor.PropertyName = "Tier"; sDescriptor.Direction = ListSortDirection.Ascending; gridViewDecks.MasterTemplate.SortDescriptors.Add(sDescriptor); sDescriptor = new SortDescriptor(); sDescriptor.PropertyName = "MyDust"; sDescriptor.Direction = ListSortDirection.Ascending; gridViewDecks.MasterTemplate.SortDescriptors.Add(sDescriptor); break; } if (gridViewDecks.SelectedRows.Count > 0) { gridViewDecks.SelectedRows[0].IsCurrent = false; } gridViewDecks.MasterTemplate.ExpandAllGroups(); }
public CustomersViewModel() { NorthwindDomainContext context = new NorthwindDomainContext(); EntityQuery<DistinctValue> contactTitlesQuery = context.GetDistinctValuesQuery("ContactTitle"); context.Load<DistinctValue>(contactTitlesQuery , LoadBehavior.RefreshCurrent , this.OnDistinctContactTitlesLoaded , this.contactTitles); EntityQuery<Customer> getCustomersQuery = context.GetCustomersQuery(); this.view = new QueryableDomainServiceCollectionView<Customer>(context, getCustomersQuery); this.view.PageSize = 10; this.view.AutoLoad = true; this.view.PropertyChanged += this.OnViewPropertyChanged; this.view.LoadedData += this.OnViewLoadedData; this.loadCommand = new DelegateCommand(this.ExecuteLoadCommand, this.LoadCommandCanExecute); this.countrySortDescriptor = new SortDescriptor() { Member = "Country" }; this.citySortDescriptor = new SortDescriptor() { Member = "City" }; this.contactTitles = new RadObservableCollection<string>(); this.contactTitles.Add(CustomersViewModel.ClearSelectionString); this.contactTitleFilterDescriptor = new FilterDescriptor("ContactTitle", FilterOperator.IsEqualTo, FilterDescriptor.UnsetValue); this.view.FilterDescriptors.Add(this.contactTitleFilterDescriptor); }
public SearchOutcomes(string text, SortDescriptor <OutcomeOverviewSortType> sortDescriptor, int pageIndex) : this(text, sortDescriptor, pageIndex, 1) { }
private static DataSourceResult CreateDataSourceResult <TModel, TResult>(this IQueryable queryable, DataSourceRequest request, ModelStateDictionary modelState, Func <TModel, TResult> selector) { var result = new DataSourceResult(); var data = queryable; var filters = new List <IFilterDescriptor>(); if (request.Filters != null) { filters.AddRange(request.Filters); } if (filters.Any()) { data = data.Where(filters); } var sort = new List <SortDescriptor>(); if (request.Sorts != null) { sort.AddRange(request.Sorts); } var temporarySortDescriptors = new List <SortDescriptor>(); IList <GroupDescriptor> groups = new List <GroupDescriptor>(); if (request.Groups != null) { groups.AddRange(request.Groups); } var aggregates = new List <AggregateDescriptor>(); if (request.Aggregates != null) { aggregates.AddRange(request.Aggregates); } if (aggregates.Any()) { var dataSource = data.AsQueryable(); var source = dataSource; if (filters.Any()) { source = dataSource.Where(filters); } result.AggregateResults = source.Aggregate(aggregates.SelectMany(a => a.Aggregates)); if (groups.Any() && aggregates.Any()) { groups.Each(g => g.AggregateFunctions.AddRange(aggregates.SelectMany(a => a.Aggregates))); } } result.Total = data.Count(); if (!sort.Any() && queryable.Provider.IsEntityFrameworkProvider()) { // The Entity Framework provider demands OrderBy before calling Skip. SortDescriptor sortDescriptor = new SortDescriptor { Member = queryable.ElementType.FirstSortableProperty() }; sort.Add(sortDescriptor); temporarySortDescriptors.Add(sortDescriptor); } if (groups.Any()) { groups.Reverse().Each(groupDescriptor => { var sortDescriptor = new SortDescriptor { Member = groupDescriptor.Member, SortDirection = groupDescriptor.SortDirection }; sort.Insert(0, sortDescriptor); temporarySortDescriptors.Add(sortDescriptor); }); } if (sort.Any()) { data = data.Sort(sort); } var notPagedData = data; data = data.Page(request.Page - 1, request.PageSize); if (groups.Any()) { data = data.GroupBy(notPagedData, groups); } result.Data = data.Execute(selector); if (modelState != null && !modelState.IsValid) { result.Errors = modelState.SerializeErrors(); } temporarySortDescriptors.Each(sortDescriptor => sort.Remove(sortDescriptor)); return(result); }
public static SortDescriptor <Data.Smlouva> GetSort(OrderResult order) { SortDescriptor <Data.Smlouva> s = new SortDescriptor <Data.Smlouva>().Field(f => f.Field("_score").Descending()); switch (order) { case OrderResult.DateAddedDesc: s = new SortDescriptor <Data.Smlouva>().Field(m => m.Field(f => f.casZverejneni).Descending()); break; case OrderResult.DateAddedAsc: s = new SortDescriptor <Data.Smlouva>().Field(m => m.Field(f => f.casZverejneni).Ascending()); break; case OrderResult.DateSignedDesc: s = new SortDescriptor <Data.Smlouva>().Field(m => m.Field(f => f.datumUzavreni).Descending()); break; case OrderResult.DateSignedAsc: s = new SortDescriptor <Data.Smlouva>().Field(m => m.Field(f => f.datumUzavreni).Ascending()); break; case OrderResult.PriceAsc: s = new SortDescriptor <Data.Smlouva>().Field(m => m.Field(f => f.CalculatedPriceWithVATinCZK).Ascending()); break; case OrderResult.PriceDesc: s = new SortDescriptor <Data.Smlouva>().Field(m => m.Field(f => f.CalculatedPriceWithVATinCZK).Descending()); break; case OrderResult.FastestForScroll: s = new SortDescriptor <Data.Smlouva>().Field(f => f.Field("_doc")); break; case OrderResult.ConfidenceDesc: s = new SortDescriptor <Data.Smlouva>().Field(f => f.Field(ff => ff.ConfidenceValue).Descending()); break; case OrderResult.CustomerAsc: s = new SortDescriptor <Data.Smlouva>().Field(f => f.Field(ff => ff.Platce.ico).Ascending()); break; case OrderResult.ContractorAsc: s = new SortDescriptor <Data.Smlouva>().Field(f => f.Field("prijemce.ico").Ascending()); break; case OrderResult.LastUpdate: s = new SortDescriptor <Data.Smlouva>().Field(f => f.Field("lastUpdate").Descending()); break; case OrderResult.ClassificationRelevance: s = new SortDescriptor <Data.Smlouva>().Field(f => f.Field("classification.types.classifProbability").Descending()); break; case OrderResult.Relevance: default: break; } return(s); }
private static int sortingOrder(SortDescriptor sortDescriptor) { return sortDescriptor.asc ?? false ? 1 : -1; }
void SetAxisSort(AreaType area, SortDescriptor sort) { if (DataManager != null) { if (area == AreaType.ColumnsArea) { if (PivotGrid.AxisIsRotated == false) DataManager.Axis0_MeasuresSort = sort; else DataManager.Axis1_MeasuresSort = sort; } if (area == AreaType.RowsArea) { if (PivotGrid.AxisIsRotated == false) DataManager.Axis1_MeasuresSort = sort; else DataManager.Axis0_MeasuresSort = sort; } } }
private static int sortingOrderDesc(SortDescriptor sortDescriptor) { return sortDescriptor.asc ?? false ? -1 : 1; }
public ListMonthOutcomeFromCategory(IKey categoryKey, MonthModel month, SortDescriptor <OutcomeOverviewSortType> sortDescriptor = null, int?pageIndex = null) : this(categoryKey, month, sortDescriptor, pageIndex, 1) { }
/// <summary> /// Creates a new instance which returns object in version 2. /// </summary> /// <param name="categoryKey">A key of the category.</param> /// <param name="month">A month to find outcomes from.</param> /// <param name="sortDescriptor">A sorting descriptor.</param> /// <param name="pageIndex">A page index to load. If <c>null</c>, load all results.</param> public static ListMonthOutcomeFromCategory Version2(IKey categoryKey, MonthModel month, SortDescriptor <OutcomeOverviewSortType> sortDescriptor = null, int?pageIndex = null) { return(new ListMonthOutcomeFromCategory(categoryKey, month, sortDescriptor, pageIndex, 2)); }
public ActionResult Interventions_Read([DataSourceRequest] DataSourceRequest request, string filtreAnnee) { Nullable <DateTime> dateDebut; Nullable <DateTime> dateFin; MentoratNetCore.Extensions.CscExtensionsMethodes.AttribuerDateDebutDateFinAnneeFinanciereProjet(filtreAnnee, out dateDebut, out dateFin); List <Intervention> interventions; var strMessageDatasource = ""; //on filtre selon l'année financière sélectionner par le combobox...par défaut on affiche tout. if (dateDebut == null || dateFin == null) { interventions = db.Interventions.ToList(); strMessageDatasource = ""; } else { interventions = db.Interventions.Where(b => b.Date_Intervention >= dateDebut && b.Date_Intervention <= dateFin).ToList(); strMessageDatasource = "(" + DateTime.Parse(dateDebut.ToString()).ToShortDateString() + " au " + DateTime.Parse(dateFin.ToString()).ToShortDateString() + ")"; } if (request.Groups.Count > 0) { GroupDescriptor monGroup = request.Groups.Where(g => g.Member == "No_Mentore_Intervention").FirstOrDefault(); if (monGroup != null) { monGroup.Member = "Mentore.NomComplet_Mentore"; // monGroup.SortDirection = System.ComponentModel.ListSortDirection.Ascending; monGroup.DisplayContent = "No_Mentore_Intervention"; } monGroup = request.Groups.Where(g => g.Member == "No_Mentor_Intervention").FirstOrDefault(); if (monGroup != null) { monGroup.Member = "Mentor.NomCompletMentor"; monGroup.DisplayContent = "No_Mentor_Intervention"; // monGroup.SortDirection = System.ComponentModel.ListSortDirection.Ascending; } } if (request.Sorts.Count == 0) // par défaut le tri est par la date { request.Sorts.Add(new SortDescriptor("Date_Intervention", ListSortDirection.Descending)); } else { SortDescriptor monsort = request.Sorts.Where(w => w.Member == "No_Mentore_Intervention").FirstOrDefault(); if (monsort != null) {//Le tri est la le combobox alors on va trier sur le nom du Mentore var sort1 = new SortDescriptor("Mentore.NomComplet_Mentore", monsort.SortDirection); request.Sorts.Insert(request.Sorts.IndexOf(monsort), sort1); } monsort = request.Sorts.Where(w => w.Member == "No_Mentor_Intervention").FirstOrDefault(); if (monsort != null) {//Le tri est la le combobox alors on va trier sur le nom du Mentor var sort1 = new SortDescriptor("Mentor.NomCompletMentor", monsort.SortDirection); request.Sorts.Insert(request.Sorts.IndexOf(monsort), sort1); } } DataSourceResult result = interventions.ToDataSourceResult(request, intervention => new Intervention { No_Intervention = intervention.No_Intervention, Date_Intervention = intervention.Date_Intervention, No_Mentor_Intervention = intervention.No_Mentor_Intervention, Mentor = new Mentor { NoMentor = intervention.Mentor.NoMentor, PrenomMentor = intervention.Mentor.PrenomMentor, NomMentor = intervention.Mentor.NomMentor }, No_Mentore_Intervention = intervention.No_Mentore_Intervention, Mentore = new Mentore { No_Mentore = intervention.Mentore.No_Mentore, Nom_Mentore = intervention.Mentore.Nom_Mentore, Prenom_Mentore = intervention.Mentore.Prenom_Mentore }, Duree_Intervention = intervention.Duree_Intervention, Description_Intervention = intervention.Description_Intervention }); var resultModif = new MentoratNetCore.Extensions.KendoDataSourceResult(result); resultModif.MessageDataSource = strMessageDatasource; return(Json(resultModif)); }
public ActionResult List([DataSourceRequest] DataSourceRequest request) { int total = 0; SortDescriptor sortDescriptor = (request.Sorts != null && request.Sorts.Count > 0) ? request.Sorts.FirstOrDefault() : new SortDescriptor("CreatedDate", ListSortDirection.Descending); sortDescriptor.Member = sortDescriptor.Member ?? "ContactName"; Func <IQueryable <crm_Contacts>, IOrderedQueryable <crm_Contacts> > order; var data = new List <crm_Contacts>(); switch (sortDescriptor.Member) { case "ContactName": if (sortDescriptor.SortDirection == ListSortDirection.Ascending) { order = x => x.OrderBy(y => (y.FirstName + " " + y.LastName)); } else { order = x => x.OrderByDescending(y => (y.FirstName + " " + y.LastName)); } break; case "ContactAddress": if (sortDescriptor.SortDirection == ListSortDirection.Ascending) { order = x => x.OrderBy(y => y.Address); } else { order = x => x.OrderByDescending(y => y.Address); } break; default: if (sortDescriptor.SortDirection == ListSortDirection.Ascending) { order = x => x.OrderBy(y => y.CreatedDate); } else { order = x => x.OrderByDescending(y => y.CreatedDate); } break; } data = _contactService.Select(null, order, null, request.Page, request.PageSize).ToList(); total = _contactService.Select(null, order, null, null, null).Count(); var _lstContactModel = new List <ContactModel>(); var _customer = new crm_Customers(); var _contactModel = new ContactModel(); foreach (var item in data) { _contactModel = item.ToModel(); if (_contactModel != null) { _contactModel.DisplayName = item.FirstName + " " + item.LastName; _contactModel.Address = item.Address; _contactModel.CreatedDate = item.CreatedDate; _contactModel.Email = item.Email; if (item.CustomerId == null) { _contactModel.Customer = ""; } else { _contactModel.Customer = _customerService.GetCustomerByID(item.CustomerId.Value).CustomerName; } } _lstContactModel.Add(_contactModel); } ViewBag.total = total; var result = new DataSourceResult() { Data = _lstContactModel, Total = total }; return(Json(result)); }
public SortDescriptor <QueryableTransaction> GetSortDescriptor(SortDescriptor <QueryableTransaction> descriptor) { return(descriptor .Descending(f => f.TransactionDate)); }
/// <summary> /// 初始化ViewModel /// <remarks> /// 统一在此处创建并注册CollectionView集合。 /// </remarks> /// </summary> private void InitializeVM() { var sort = new SortDescriptor {Member = "CreateDate", SortDirection = ListSortDirection.Ascending}; var group = new GroupDescriptor {Member = "ProgrammingName", SortDirection = ListSortDirection.Ascending}; CaacProgrammings = _service.CreateCollection(_context.CaacProgrammings, o => o.CaacProgrammingLines); CaacProgrammings.SortDescriptors.Add(sort); CaacProgrammings.GroupDescriptors.Add(group); CaacProgrammings.LoadedData += (o, e) => { if (SelCaacProgramming == null) SelCaacProgramming = CaacProgrammings.FirstOrDefault(); }; _service.RegisterCollectionView(CaacProgrammings); //注册查询集合 ProgrammingFiles = _service.CreateCollection(_context.ProgrammingFiles); ProgrammingFiles.SortDescriptors.Add(sort); ProgrammingFiles.GroupDescriptors.Add(group); ProgrammingFiles.FilterDescriptors.Add(new FilterDescriptor("Type", FilterOperator.IsEqualTo, 1)); _service.RegisterCollectionView(ProgrammingFiles); //注册查询集合 Programmings = new QueryableDataServiceCollectionView<ProgrammingDTO>(_context, _context.Programmings); AircraftCategories = new QueryableDataServiceCollectionView<AircraftCategoryDTO>(_context, _context.AircraftCategories); IssuedUnits = new QueryableDataServiceCollectionView<IssuedUnitDTO>(_context, _context.IssuedUnits); }
/// <summary> /// 初始化ViewModel /// <remarks> /// 统一在此处创建并注册CollectionView集合。 /// </remarks> /// </summary> private void InitializeVM() { Annuals = _service.CreateCollection(_context.Annuals); var sort = new SortDescriptor {Member = "Year", SortDirection = ListSortDirection.Descending}; Annuals.SortDescriptors.Add(sort); var group = new GroupDescriptor {Member = "ProgrammingName", SortDirection = ListSortDirection.Descending}; Annuals.GroupDescriptors.Add(group); Annuals.LoadedData += (sender, e) => { _curAnnual = e.Entities.Cast<AnnualDTO>().FirstOrDefault(p => p.IsOpen); _loadedAnnuals = true; SetSelAnnual(); RefreshCommandState(); }; _service.RegisterCollectionView(Annuals); //注册查询集合 AllPlans = _service.CreateCollection(_context.Plans); AllPlans.LoadedData += (sender, e) => { _loadedPlans = true; SetSelAnnual(); }; _service.RegisterCollectionView(AllPlans); AllPlanHistories = _service.CreateCollection(_context.PlanHistories); AllPlanHistories.LoadedData += (sender, e) => { foreach (var ph in AllPlanHistories.SourceCollection.Cast<PlanHistoryDTO>()) { ph.ActionCategories.AddRange(_service.GetActionCategoriesForPlanHistory(ph)); ph.AircraftCategories.AddRange(_service.GetAircraftCategoriesForPlanHistory(ph)); ph.AircraftTypes.AddRange(_service.GetAircraftTypesForPlanHistory(ph)); _context.ChangeState(ph, EntityStates.Unchanged); } RaisePropertyChanged(() => SelPlan); }; _service.RegisterCollectionView(AllPlanHistories); PlanAircrafts = _service.CreateCollection(_context.PlanAircrafts); PlanAircrafts.FilterDescriptors.Add(new FilterDescriptor("AircraftId", FilterOperator.IsEqualTo, null)); _service.RegisterCollectionView(PlanAircrafts); }
protected override object GetItemKey(GridViewRowInfo item, SortDescriptor descriptor) { return(this.dataView.ItemsSource.GetValue(item.DataBoundItem, descriptor.PropertyIndex)); }
/// <summary> /// 初始化ViewModel /// <remarks> /// 统一在此处创建并注册CollectionView集合。 /// </remarks> /// </summary> private void InitializeVm() { // 创建并注册CollectionView AirStructureDamages = _service.CreateCollection(_context.AirStructureDamages); AirStructureDamages.PageSize = 20; _service.RegisterCollectionView(AirStructureDamages); AirStructureDamages.PropertyChanged += (sender, e) => { if (e.PropertyName.Equals("IsAddingNew", StringComparison.OrdinalIgnoreCase)) { AirStructureDamage = AirStructureDamages.CurrentAddItem as AirStructureDamageDTO; if (AirStructureDamage != null) { AirStructureDamage.Id = RandomHelper.Next(); var firstOrDefault = Aircrafts.FirstOrDefault(); if (firstOrDefault != null) AirStructureDamage.AircraftId = firstOrDefault.Id; DocumentName = "添加附件"; _document.DocumentId = new Guid(); _document.Name = string.Empty; } } else if (e.PropertyName.Equals("HasChanges", StringComparison.OrdinalIgnoreCase)) { CanSelectAirStructureDamage = !AirStructureDamages.HasChanges; } }; Aircrafts = new QueryableDataServiceCollectionView<AircraftDTO>(_context, _context.Aircrafts); var sort = new SortDescriptor {Member = "RegNumber", SortDirection = ListSortDirection.Ascending}; Aircrafts.SortDescriptors.Add(sort); }
/// <summary> /// 初始化ViewModel /// <remarks> /// 统一在此处创建并注册CollectionView集合。 /// </remarks> /// </summary> private void InitializeVM() { Requests = _service.CreateCollection(_context.Requests.Expand(p => p.RelatedDocs), o => o.ApprovalHistories, o => o.RelatedDocs); var cfd = new CompositeFilterDescriptor {LogicalOperator = FilterCompositionLogicalOperator.And}; var requestDescriptor = new FilterDescriptor("Title", FilterOperator.IsNotEqualTo, "指标飞机申请(系统添加)"); cfd.FilterDescriptors.Add(requestDescriptor); var statusDateDescriptor = new FilterDescriptor("Status", FilterOperator.IsLessThan, (int) RequestStatus.已审批); cfd.FilterDescriptors.Add(statusDateDescriptor); Requests.FilterDescriptors.Add(cfd); Requests.LoadedData += (o, e) => { if (SelRequest == null) SelRequest = Requests.FirstOrDefault(); }; _service.RegisterCollectionView(Requests); Annuals = new QueryableDataServiceCollectionView<AnnualDTO>(_context, _context.Annuals); Annuals.LoadedData += (sender, e) => { if (Annuals.Count != 0 && Annuals.FirstOrDefault(p => p.IsOpen) != null) { _planDescriptor.Value = Annuals.First(p => p.IsOpen).Year; if (!Plans.AutoLoad) Plans.AutoLoad = true; else Plans.Load(true); RefreshCommandState(); } }; Plans = new QueryableDataServiceCollectionView<PlanDTO>(_context, _context.Plans); _planDescriptor = new FilterDescriptor("Year", FilterOperator.IsEqualTo, -1); var sort = new SortDescriptor {Member = "VersionNumber", SortDirection = ListSortDirection.Ascending}; Plans.SortDescriptors.Add(sort); Plans.FilterDescriptors.Add(_planDescriptor); Plans.LoadedData += (sender, e) => { var curPlan = Plans.OrderBy(p => p.VersionNumber).LastOrDefault(); if (curPlan != null) { _planHistoryDescriptor.Value = curPlan.Id; if (!CurPlanHistories.AutoLoad) CurPlanHistories.AutoLoad = true; else CurPlanHistories.Load(true); } RefreshCommandState(); _approvalHistoryCaches = new List<ApprovalHistoryCache>(); }; CurPlanHistories = _service.CreateCollection(_context.PlanHistories); _planHistoryDescriptor = new FilterDescriptor("PlanId", FilterOperator.IsEqualTo, Guid.Empty); var group = new GroupDescriptor {Member = "CanRequest", SortDirection = ListSortDirection.Ascending}; CurPlanHistories.GroupDescriptors.Add(group); CurPlanHistories.FilterDescriptors.Add(_planHistoryDescriptor); _service.RegisterCollectionView(CurPlanHistories); PlanAircrafts = _service.CreateCollection(_context.PlanAircrafts); _service.RegisterCollectionView(PlanAircrafts); }
MdxExpression SortExpression(MdxExpression expr, SortDescriptor descr) { if (descr == null) return expr; if (!String.IsNullOrEmpty(descr.SortBy)) { String orderType = String.Empty; if (descr.Type == SortTypes.Ascending) orderType = "BASC"; if (descr.Type == SortTypes.Descending) orderType = "BDESC"; if (!String.IsNullOrEmpty(orderType)) { expr = new MdxFunctionExpression("ORDER", new MdxExpression[] { expr, new MdxObjectReferenceExpression(String.Format("({0})", descr.SortBy)), new MdxConstantExpression(orderType) }); } } return expr; }
/// <summary> /// 搜索日志 /// </summary> /// <param name="highlight"></param> /// <param name="start"></param> /// <param name="end"></param> /// <param name="keyword"></param> /// <param name="logger_name"></param> /// <param name="page"></param> /// <param name="pagesize"></param> /// <returns></returns> public static async Task <PagerData <ESLogLine, QueryExtData> > Search( bool highlight = true, DateTime?start = null, DateTime?end = null, string keyword = null, string logger_name = null, int page = 1, int pagesize = 10) { var sd = new SearchDescriptor <ESLogLine>(); sd = sd.Index(IndexName); var query = new QueryContainer(); if (start != null) { query &= new DateRangeQuery() { Field = nameof(temp.UpdateTime), GreaterThanOrEqualTo = start.Value }; } if (end != null) { query &= new DateRangeQuery() { Field = nameof(temp.UpdateTime), LessThan = end.Value }; } if (ValidateHelper.IsPlumpString(keyword)) { query &= new MatchQuery() { Field = nameof(temp.Message), Query = keyword, Operator = Operator.Or, MinimumShouldMatch = "100%" }; } if (ValidateHelper.IsPlumpString(logger_name)) { query &= new TermQuery() { Field = nameof(temp.LoggerName), Value = logger_name }; } //查询条件 sd = sd.Query(_ => query); //聚合 sd = sd.Aggregations(x => x.Terms(nameof(temp.LoggerName), av => av.Field(nameof(temp.LoggerName)).Size(1000)) .Terms(nameof(temp.Level), av => av.Field(nameof(temp.Level)).Size(1000)) .Terms(nameof(temp.Domain), av => av.Field(nameof(temp.Domain)).Size(1000))); //高亮 if (highlight) { sd = sd.AddHighlightWrapper("<em class='kwd'>", "</em>", x => x.Field(nameof(temp.Message))); } //排序 var sort = new SortDescriptor <ESLogLine>(); sort = sort.Descending(x => x.UpdateTime); sort = sort.Descending(new Field("", boost: null)); sd = sd.Sort(_ => sort); //分页 sd = sd.QueryPage_(page, pagesize); //请求服务器 var client = new ElasticClient(ElasticsearchClientManager.Instance.DefaultClient); var re = await client.SearchAsync <ESLogLine>(_ => sd); re.ThrowIfException(); var data = new PagerData <ESLogLine, QueryExtData>(); data.ItemCount = (int)re.Total; data.DataList = re.Hits.Select(x => x.Source).ToList(); //聚合数据 data.ExtData = new QueryExtData(); return(data); }
public AxisInfo() { HideEmpty = false; MeasuresSort = null; }
public static SearchOutcomes Version2(string text, SortDescriptor <OutcomeOverviewSortType> sortDescriptor, int pageIndex) { return(new SearchOutcomes(text, sortDescriptor, pageIndex, 2)); }
public Selector <T> Sort(Expression <Func <T, object> > selector, bool asc) { sortContainerDescriptor = sortContainerDescriptor.Field(selector, asc ? SortOrder.Ascending : SortOrder.Descending); return(this); }
public void Initialize(PivotTableSortTypes sortType, SortDescriptor sortDescriptor) { SortType = sortType; m_SortDescriptor = sortDescriptor; // Инициализируем как сортируем if (sortDescriptor == null) { rbNone.IsChecked = true; } else { switch (sortDescriptor.Type) { case SortTypes.Ascending: rbAscending.IsChecked = true; break; case SortTypes.Descending: rbDescending.IsChecked = true; break; default: rbNone.IsChecked = true; break; } } // Инициализируем по чем сортируем switch (sortType) { case PivotTableSortTypes.SortByProperty: SelectProperty(sortDescriptor != null ? sortDescriptor.SortBy : String.Empty); break; case PivotTableSortTypes.SortAxisByMeasure: SelectMeasure(sortDescriptor != null ? sortDescriptor.SortBy : String.Empty); break; case PivotTableSortTypes.SortByValue: InitializeTuple(sortDescriptor as SortByValueDescriptor); break; } }
public void AddSortDescriptor(SortDescriptor sortDescriptor) { _sortDescriptors.Add(sortDescriptor); }
/// <summary> /// 初始化维修成本信息。 /// </summary> private void InitialVm() { #region 维修成本 ApuMaintainCosts = _service.CreateCollection(_context.ApuMaintainCosts); ApuMaintainCosts.LoadedData += (sender, e) => { _loadedApuMaintainCost = true; LoadMaintainCostComplete(); }; FhaMaintainCosts = _service.CreateCollection(_context.FhaMaintainCosts); FhaMaintainCosts.LoadedData += (sender, e) => { _loadedFhaMaintainCost = true; LoadMaintainCostComplete(); }; NonFhaMaintainCosts = _service.CreateCollection(_context.NonFhaMaintainCosts); NonFhaMaintainCosts.LoadedData += (sender, e) => { _loadedNonFhaMaintainCost = true; LoadMaintainCostComplete(); }; RegularCheckMaintainCosts = _service.CreateCollection(_context.RegularCheckMaintainCosts); RegularCheckMaintainCosts.LoadedData += (sender, e) => { _loadedRegularCheckMaintainCost = true; LoadMaintainCostComplete(); }; SpecialRefitMaintainCosts = _service.CreateCollection(_context.SpecialRefitMaintainCosts); SpecialRefitMaintainCosts.LoadedData += (sender, e) => { _loadedSpecialRefitMaintainCost = true; LoadMaintainCostComplete(); }; UndercartMaintainCosts = _service.CreateCollection(_context.UndercartMaintainCosts); UndercartMaintainCosts.LoadedData += (sender, e) => { _loadedUndercartMaintainCost = true; LoadMaintainCostComplete(); }; #endregion #region 维修发票 ApuMaintainInvoices = _service.CreateCollection(_context.APUMaintainInvoices); ApuMaintainInvoices.LoadedData += (sender, e) => { _loadApuMaintainInvoice = true; LoadMaintainInvoiceComplete(); }; EngineMaintainInvoices = _service.CreateCollection(_context.EngineMaintainInvoices); EngineMaintainInvoices.LoadedData += (sender, e) => { _loadEngineMaintainInvoice = true; LoadMaintainInvoiceComplete(); }; AirframeMaintainInvoices = _service.CreateCollection(_context.AirframeMaintainInvoices); AirframeMaintainInvoices.LoadedData += (sender, e) => { _loadAirframeMaintainInvoice = true; LoadMaintainInvoiceComplete(); }; UndercartMaintainInvoices = _service.CreateCollection(_context.UndercartMaintainInvoices); UndercartMaintainInvoices.LoadedData += (sender, e) => { _loadUndercartMaintainInvoice = true; LoadMaintainInvoiceComplete(); }; SpecialRefitInvoices = _service.CreateCollection(_context.SpecialRefitInvoices); SpecialRefitInvoices.LoadedData += (sender, e) => { _loadSpecialRefitInvoice = true; LoadMaintainInvoiceComplete(); }; #endregion Annuals = new QueryableDataServiceCollectionView<AnnualDTO>(_fleetPlanService.Context, _fleetPlanService.Context.Annuals); var sort = new SortDescriptor {Member = "Year", SortDirection = ListSortDirection.Ascending}; Annuals.SortDescriptors.Add(sort); Annuals.LoadedData += (o, e) => { #region 维修成本 _maintainCostReports = new ObservableCollection<MaintainCost>(); _loadedApuMaintainCost = false; ApuMaintainCosts.Load(true); _loadedFhaMaintainCost = false; FhaMaintainCosts.Load(true); _loadedNonFhaMaintainCost = false; NonFhaMaintainCosts.Load(true); _loadedRegularCheckMaintainCost = false; RegularCheckMaintainCosts.Load(true); _loadedSpecialRefitMaintainCost = false; SpecialRefitMaintainCosts.Load(true); _loadedUndercartMaintainCost = false; UndercartMaintainCosts.Load(true); #endregion #region 维修发票 Data = new ObservableCollection<MaintainItemData>(); _loadApuMaintainInvoice = false; ApuMaintainInvoices.Load(true); _loadUndercartMaintainInvoice = false; UndercartMaintainInvoices.Load(true); _loadEngineMaintainInvoice = false; EngineMaintainInvoices.Load(true); _loadAirframeMaintainInvoice = false; AirframeMaintainInvoices.Load(true); _loadSpecialRefitInvoice = false; SpecialRefitInvoices.Load(true); #endregion }; }
public DataSourceSortDescriptorBuilder(SortDescriptor descriptor) { Descriptor = descriptor; }
void SetAxisByMeasureSort(MemberControl member, SortDescriptor sort) { if (member is ColumnMemberControl) SetAxisSort(AreaType.ColumnsArea, sort); if (member is RowMemberControl) SetAxisSort(AreaType.RowsArea, sort); }
public IList <Movie> FindMovies(Expression <Func <Movie, bool> > predicate, SortDescriptor sort) { return(sort.MovieSort(dbSet.Where(predicate)).ToList()); }
void PivotGrid_ExecuteMemberAction(object sender, MemberActionEventArgs args) { // Определяем нужно ли выполнить экшен по умолчанию if (args.Action == MemberActionType.Default) { var MemberAction = (ColumnTitleClickBehavior)(int)DefaultMemberAction; if (args.Axis == 0) if (this.ColumnTitleClickBehavior != ColumnTitleClickBehavior.SameAsRows) { MemberAction = this.ColumnTitleClickBehavior; } switch (MemberAction) { case ColumnTitleClickBehavior.None: return; case ColumnTitleClickBehavior.DrillDown: args.Action = MemberActionType.DrillDown; break; case ColumnTitleClickBehavior.ExpandCollapse: if (args.Member != null && args.Member.ChildCount > 0 && !args.Member.IsCalculated) { args.Action = MemberActionType.Expand; if (args.Member.DrilledDown) args.Action = MemberActionType.Collapse; break; } return; case ColumnTitleClickBehavior.SortByValue: if (args.Member.Children.Count > 0) return; args.Action = MemberActionType.SortByValue; break; case ColumnTitleClickBehavior.SortByProperty: if (args.Member != null && (args.Axis == 0 || args.Axis == 1)) { SortDescriptor new_descr = new SortDescriptor(); new_descr.SortBy = "Caption"; new_descr.Type = SortTypes.Ascending; SortDescriptor descr = PivotGrid.GetAxisPropertySort(args.Axis, args.Member); if (descr != null) { if (!String.IsNullOrEmpty(descr.SortBy)) { new_descr.SortBy = descr.SortBy; } switch (descr.Type) { case SortTypes.None: new_descr.Type = SortTypes.Ascending; break; case SortTypes.Ascending: new_descr.Type = SortTypes.Descending; break; case SortTypes.Descending: new_descr.Type = SortTypes.None; break; } } m_CellSetProvider.Sort(args.Axis, args.Member.HierarchyUniqueName, new_descr); try { IsWaiting = true; PivotGrid.Initialize(m_CellSetProvider); } finally { IsWaiting = false; } } return; } } if (args.Axis == 0 || args.Axis == 1) { ExportSizeInfo(); PerformMemberAction(args); } }
public SortDescriptor <QueryableAsset> GetSortDescriptor(SortDescriptor <QueryableAsset> descriptor) { return(descriptor .Ascending(f => f.Id.Suffix("keyword"))); }
public GridSortDescriptorBuilder(SortDescriptor descriptor) { Guard.IsNotNull(descriptor, "descriptor"); Descriptor = descriptor; }
//public string FindWorkerNameByCaseWorkerID(int caseWorkerID) //{ // return context.CaseWorker.Join(context.Worker, left => left.WorkerID, right => right.ID, (left, right) => new { left, right }).Where(item => item.left.ID == caseWorkerID).Select(item =>item.right.FirstName +" "+item.right.LastName).FirstOrDefault(); //} // public DataSourceResult Search(WorkerSearchViewModel searchParameters, DataSourceRequest paramDSRequest) // { // bool IsCurrentUserNotAdminRole = (CurrentLoggedInWorkerRoleIDs.IndexOf(1) == -1); // string hasEditPermission = (workerroleactionpermissionnewRepository.HasPermission(CurrentLoggedInWorkerRoleIDs, Constants.Areas.WorkerManagement, Constants.Controllers.Worker, Constants.Actions.Edit, true)).ToDisplayStyle(); // string hasDeletePermission = (workerroleactionpermissionnewRepository.HasPermission(CurrentLoggedInWorkerRoleIDs, Constants.Areas.WorkerManagement, Constants.Controllers.Worker, Constants.Actions.Delete, true)).ToDisplayStyle(); // DataSourceRequest dsRequest = paramDSRequest; // if (dsRequest == null) // { // dsRequest = new DataSourceRequest(); // } // if (dsRequest.Filters == null || (dsRequest.Filters != null && dsRequest.Filters.Count == 0)) // { // if (dsRequest.Filters == null) // { // dsRequest.Filters = new List<IFilterDescriptor>(); // } // } // if (dsRequest.Sorts == null || (dsRequest.Sorts != null && dsRequest.Sorts.Count == 0)) // { // if (dsRequest.Sorts == null) // { // dsRequest.Sorts = new List<SortDescriptor>(); // } // SortDescriptor defaultSortExpression = new SortDescriptor("LastUpdateDate", System.ComponentModel.ListSortDirection.Descending); // dsRequest.Sorts.Add(defaultSortExpression); // } // if (dsRequest.PageSize == 0) // { // dsRequest.PageSize = Constants.CommonConstants.DefaultPageSize; // } // StringBuilder sqlQuery = new StringBuilder(@"SELECT DISTINCT // W.ID,W.EmailAddress,W.IsActive, [W].[FirstName] + ' ' + [W].[LastName] [Name], // '" + hasDeletePermission + @"' [HasPermissionToDelete], // '" + hasEditPermission + @"' [HasPermissionToEdit] // FROM Worker AS [W] // LEFT JOIN WorkerInRoleNew WIR on W.ID = WIR.WorkerID // LEFT JOIN WorkerRolePermissionNew WRP on WIR.WorkerRoleID = WRP.WorkerRoleID // LEFT JOIN Permission AS P ON WRP.PermissionID = P.ID // LEFT JOIN PermissionRegion AS PR ON P.ID = PR.PermissionID // LEFT JOIN PermissionSubProgram AS PSP ON PR.ID = PSP.PermissionRegionID // LEFT JOIN PermissionJamatkhana AS PJK ON PR.ID = PJK.PermissionRegionID // WHERE [W].[ID] > 0 "); // if (IsCurrentUserNotAdminRole) // { // sqlQuery.Append(" AND [W].[ID] <> " + CurrentLoggedInWorker.ID + " "); // } // if (searchParameters.RegionID > 0) // { // searchParameters.RegionID = searchParameters.RegionID; // sqlQuery.Append(" AND [PR].[RegionID] =" + searchParameters.RegionID + ""); // } // //else if (IsCurrentLoggedInWorkerRegionalAdministrator) //<JL:Comment:06/11/2017> // else if (IsCurrentUserNotAdminRole) //<JL:Add:06/11/2017> // { // StringBuilder regionquery = new StringBuilder(); // regionquery.Append("SELECT DISTINCT PR.RegionID "); // regionquery.Append("FROM Worker AS [W] "); // regionquery.Append("LEFT JOIN WorkerInRoleNew WIR on W.ID = WIR.WorkerID "); // regionquery.Append("LEFT JOIN WorkerRolePermissionNew WRP on WIR.WorkerRoleID = WRP.WorkerRoleID "); // regionquery.Append("LEFT JOIN Permission AS P ON WRP.PermissionID = P.ID "); // regionquery.Append("LEFT JOIN PermissionRegion AS PR ON P.ID = PR.PermissionID "); // //regionquery.Append("WHERE [W].ID = " + CurrentLoggedInWorker.ID + " AND WIR.WorkerRoleID = " + SiteConfigurationReader.RegionalAdministratorRoleID); //<JL:Comment:06/11/2017> // regionquery.Append("WHERE [W].ID = " + CurrentLoggedInWorker.ID); //<JL:Add:06/11/2017> // searchParameters.RegionID = searchParameters.RegionID; // //sqlQuery.Append(" AND [PR].[RegionID] = (SELECT RegionID FROM WorkerInRoleNew WIR WHERE WorkerRoleID = " + SiteConfigurationReader.RegionalAdministratorRoleID + " AND WorkerID = " + CurrentLoggedInWorker.ID + ")"); // sqlQuery.Append(" AND [PR].[RegionID] IN (" + regionquery.ToString() + ")"); // sqlQuery.Append(" AND [W].[ID] !=1"); // } // if (searchParameters.FirstName.IsNotNullOrEmpty()) // { // searchParameters.FirstName = searchParameters.FirstName.Trim(); // sqlQuery.Append(" AND [W].[FirstName] LIKE '%" + searchParameters.FirstName + "%'"); // } // if (searchParameters.LastName.IsNotNullOrEmpty()) // { // searchParameters.LastName = searchParameters.LastName.Trim(); // sqlQuery.Append(" AND [W].[LastName] LIKE '%" + searchParameters.LastName + "%'"); // } // if (searchParameters.RoleID > 0) // { // sqlQuery.Append(" AND [W].[ID] IN (SELECT [WorkerID] FROM WorkerInRoleNew WHERE WorkerRoleID = " + searchParameters.RoleID + ")"); // } // if (searchParameters.ProgramID > 0) // { // sqlQuery.Append(" AND [PR].[ProgramID] =" + searchParameters.ProgramID + ""); // } // else if (IsCurrentUserNotAdminRole) //<JL:Add:06/11/2017> // { // StringBuilder programquery = new StringBuilder(); // programquery.Append("SELECT DISTINCT PR.ProgramID "); // programquery.Append("FROM Worker AS [W] "); // programquery.Append("INNER JOIN WorkerInRoleNew WIR on W.ID = WIR.WorkerID "); // programquery.Append("INNER JOIN WorkerRolePermissionNew WRP on WIR.WorkerRoleID = WRP.WorkerRoleID "); // programquery.Append("INNER JOIN Permission AS P ON WRP.PermissionID = P.ID "); // programquery.Append("INNER JOIN PermissionRegion AS PR ON P.ID = PR.PermissionID "); // programquery.Append("WHERE [W].ID = " + CurrentLoggedInWorker.ID); // searchParameters.ProgramID = searchParameters.ProgramID; // sqlQuery.Append(" AND [PR].[ProgramID] IN (" + programquery.ToString() + ")"); // sqlQuery.Append(" AND [W].[ID] !=1"); // } // if (IsCurrentUserNotAdminRole) //<JL:Add:06/11/2017> // { // StringBuilder subprogramquery = new StringBuilder(); // subprogramquery.Append("SELECT DISTINCT PSP.SubProgramID "); // subprogramquery.Append("FROM Worker AS [W] "); // subprogramquery.Append("INNER JOIN WorkerInRoleNew WIR on W.ID = WIR.WorkerID "); // subprogramquery.Append("INNER JOIN WorkerRolePermissionNew WRP on WIR.WorkerRoleID = WRP.WorkerRoleID "); // subprogramquery.Append("INNER JOIN Permission AS P ON WRP.PermissionID = P.ID "); // subprogramquery.Append("INNER JOIN PermissionRegion AS PR ON P.ID = PR.PermissionID "); // subprogramquery.Append("INNER JOIN PermissionSubProgram AS PSP ON PR.ID = PSP.PermissionRegionID "); // subprogramquery.Append("WHERE [W].ID = " + CurrentLoggedInWorker.ID); // sqlQuery.Append(" AND [PSP].[SubProgramID] IN (" + subprogramquery.ToString() + ")"); // sqlQuery.Append(" AND [W].[ID] !=1"); // StringBuilder jkquery = new StringBuilder(); // jkquery.Append("SELECT DISTINCT PJK.JamatkhanaID "); // jkquery.Append("FROM Worker AS [W] "); // jkquery.Append("INNER JOIN WorkerInRoleNew WIR on W.ID = WIR.WorkerID "); // jkquery.Append("INNER JOIN WorkerRolePermissionNew WRP on WIR.WorkerRoleID = WRP.WorkerRoleID "); // jkquery.Append("INNER JOIN Permission AS P ON WRP.PermissionID = P.ID "); // jkquery.Append("INNER JOIN PermissionRegion AS PR ON P.ID = PR.PermissionID "); // jkquery.Append("LEFT JOIN PermissionJamatkhana AS PJK ON PR.ID = PJK.PermissionRegionID "); // jkquery.Append("WHERE [W].ID = " + CurrentLoggedInWorker.ID); // sqlQuery.Append(" AND [PJK].[JamatkhanaID] IN (" + jkquery.ToString() + ")"); // } // DataSourceResult dataSourceResult = context.Database.SqlQuery<WorkerListViewModel>(sqlQuery.ToString()).AsEnumerable().GroupBy(m=>m.ID).Select(m=>m.First()).ToDataSourceResult(dsRequest); // DataSourceRequest dsRequestTotalCountQuery = new DataSourceRequest(); // dsRequestTotalCountQuery.Filters = dsRequest.Filters; // dataSourceResult.Total = context.Database.SqlQuery<WorkerListViewModel>(sqlQuery.ToString()).AsEnumerable().ToDataSourceResult(dsRequestTotalCountQuery).Data.AsQueryable().Count(); // return dataSourceResult; // } public DataSourceResult Search(WorkerSearchViewModel searchParameters, DataSourceRequest paramDSRequest) { bool IsCurrentUserNotAdminRole = (CurrentLoggedInWorkerRoleIDs.IndexOf(1) == -1); string hasEditPermission = (workerroleactionpermissionnewRepository.HasPermission(CurrentLoggedInWorkerRoleIDs, Constants.Areas.WorkerManagement, Constants.Controllers.Worker, Constants.Actions.Edit, true)).ToDisplayStyle(); string hasDeletePermission = (workerroleactionpermissionnewRepository.HasPermission(CurrentLoggedInWorkerRoleIDs, Constants.Areas.WorkerManagement, Constants.Controllers.Worker, Constants.Actions.Delete, true)).ToDisplayStyle(); DataSourceRequest dsRequest = paramDSRequest; if (dsRequest == null) { dsRequest = new DataSourceRequest(); } if (dsRequest.Filters == null || (dsRequest.Filters != null && dsRequest.Filters.Count == 0)) { if (dsRequest.Filters == null) { dsRequest.Filters = new List <IFilterDescriptor>(); } } if (dsRequest.Sorts == null || (dsRequest.Sorts != null && dsRequest.Sorts.Count == 0)) { if (dsRequest.Sorts == null) { dsRequest.Sorts = new List <SortDescriptor>(); } SortDescriptor defaultSortExpression = new SortDescriptor("LastUpdateDate", System.ComponentModel.ListSortDirection.Descending); dsRequest.Sorts.Add(defaultSortExpression); } if (dsRequest.PageSize == 0) { dsRequest.PageSize = Constants.CommonConstants.DefaultPageSize; } StringBuilder sqlQuery; sqlQuery = new StringBuilder(@"SELECT DISTINCT W.ID,W.EmailAddress,W.IsActive, [W].[FirstName] + ' ' + [W].[LastName] [Name], '" + hasDeletePermission + @"' [HasPermissionToDelete], '" + hasEditPermission + @"' [HasPermissionToEdit] FROM Worker AS [W] "); if (IsCurrentUserNotAdminRole) { sqlQuery.Append(" INNER JOIN WorkerInRoleNew WIR on W.ID = WIR.WorkerID"); sqlQuery.Append(" INNER JOIN WorkerRolePermissionNew WRP on WIR.WorkerRoleID = WRP.WorkerRoleID"); if (searchParameters.RegionID > 0 || searchParameters.ProgramID > 0) { sqlQuery.Append(" INNER JOIN PermissionRegion AS PR ON WRP.PermissionID = PR.PermissionID"); if (searchParameters.RegionID > 0) { sqlQuery.Append(" AND [PR].[RegionID] =" + searchParameters.RegionID + ""); } if (searchParameters.ProgramID > 0) { sqlQuery.Append(" AND [PR].[ProgramID] =" + searchParameters.ProgramID + ""); } } sqlQuery.Append(" INNER JOIN ("); sqlQuery.Append(" SELECT WRP.PermissionID"); sqlQuery.Append(" FROM WorkerInRoleNew AS WIR "); sqlQuery.Append(" INNER JOIN WorkerRolePermissionNew WRP ON WIR.WorkerRoleID = WRP.WorkerRoleID"); sqlQuery.Append(" WHERE [WIR].WorkerID = " + CurrentLoggedInWorker.ID + " "); sqlQuery.Append(" ) AS CW ON [WRP].[PermissionID] = CW.PermissionID"); } else { sqlQuery.Append(" LEFT JOIN WorkerInRoleNew WIR on W.ID = WIR.WorkerID"); sqlQuery.Append(" LEFT JOIN WorkerRolePermissionNew WRP on WIR.WorkerRoleID = WRP.WorkerRoleID"); if (searchParameters.RegionID > 0 || searchParameters.ProgramID > 0) { sqlQuery.Append(" LEFT JOIN PermissionRegion AS PR ON WRP.PermissionID = PR.PermissionID"); if (searchParameters.RegionID > 0) { sqlQuery.Append(" AND [PR].[RegionID] =" + searchParameters.RegionID + ""); } if (searchParameters.ProgramID > 0) { sqlQuery.Append(" AND [PR].[ProgramID] =" + searchParameters.ProgramID + ""); } } } sqlQuery.Append(" WHERE [W].[ID] > 0 "); if (IsCurrentUserNotAdminRole) { sqlQuery.Append(" AND [W].[ID] NOT IN (" + CurrentLoggedInWorker.ID + ",1) "); } if (searchParameters.FirstName.IsNotNullOrEmpty()) { searchParameters.FirstName = searchParameters.FirstName.Trim(); sqlQuery.Append(" AND [W].[FirstName] LIKE '%" + searchParameters.FirstName + "%'"); } if (searchParameters.LastName.IsNotNullOrEmpty()) { searchParameters.LastName = searchParameters.LastName.Trim(); sqlQuery.Append(" AND [W].[LastName] LIKE '%" + searchParameters.LastName + "%'"); } if (searchParameters.RoleID > 0) { sqlQuery.Append(" AND [W].[ID] IN (SELECT [WorkerID] FROM WorkerInRoleNew WHERE WorkerRoleID = " + searchParameters.RoleID + ")"); } DataSourceResult dataSourceResult = context.Database.SqlQuery <WorkerListViewModel>(sqlQuery.ToString()).AsEnumerable().GroupBy(m => m.ID).Select(m => m.First()).ToDataSourceResult(dsRequest); DataSourceRequest dsRequestTotalCountQuery = new DataSourceRequest(); dsRequestTotalCountQuery.Filters = dsRequest.Filters; dataSourceResult.Total = context.Database.SqlQuery <WorkerListViewModel>(sqlQuery.ToString()).AsEnumerable().ToDataSourceResult(dsRequestTotalCountQuery).Data.AsQueryable().Count(); return(dataSourceResult); }
public static DataSourceRequest ConvertToKendoFromCustomRequest(CustomDataSourceRequest customDataSourceRequest) { try { DataSourceRequest req = new DataSourceRequest(); req.Page = customDataSourceRequest.Page; req.PageSize = customDataSourceRequest.PageSize; List <SortDescriptor> sorts = new List <SortDescriptor>(); if (customDataSourceRequest.Sorts != null) { foreach (var item in customDataSourceRequest.Sorts) { SortDescriptor newSort = new SortDescriptor(); newSort.Member = item.Member; newSort.SortCompare = null; //item.SortCompare; newSort.SortDirection = (ListSortDirection)item.SortDirection; sorts.Add(newSort); } } req.Sorts = sorts; List <IFilterDescriptor> filters = new List <IFilterDescriptor>(); foreach (var item in customDataSourceRequest.Filters) { if (item.FilterType == "FilterDescriptor") { var filItem = item.FilterDescriptors.FirstOrDefault(); FilterDescriptor filterDescriptor = new FilterDescriptor(filItem.Member, (FilterOperator)(filItem.Operator), filItem.Value); filters.Add(filterDescriptor); } if (item.FilterType == "CompositeFilter") { CompositeFilterDescriptor compositeFilter = new CompositeFilterDescriptor(); compositeFilter.LogicalOperator = (FilterCompositionLogicalOperator)item.LogicalOperator; foreach (var filterItem in item.FilterDescriptors) { FilterDescriptor filterDescriptor = new FilterDescriptor(filterItem.Member, (FilterOperator)(filterItem.Operator), filterItem.Value); compositeFilter.FilterDescriptors.Add(filterDescriptor); } filters.Add(compositeFilter); } } req.Filters = filters; return(req); } catch (Exception ex) { throw ex; } }
public static GridModel ToGridModel(this IQueryable queryable, int page, int pageSize, IList <SortDescriptor> sortDescriptors, IEnumerable <IFilterDescriptor> filterDescriptors, IEnumerable <GroupDescriptor> groupDescriptors) { IQueryable data = queryable; #if MVC3 if (queryable.ElementType.IsDynamicObject()) { var firstItem = queryable.Cast <object>().FirstOrDefault(); if (firstItem != null) { if (filterDescriptors.Any()) { filterDescriptors.SetMemberTypeFrom(firstItem); } if (groupDescriptors.Any()) { groupDescriptors.SetMemberTypeFrom(firstItem); } } } #endif if (filterDescriptors.Any()) { data = data.Where(filterDescriptors); } GridModel result = new GridModel(); result.Total = data.Count(); IList <SortDescriptor> temporarySortDescriptors = new List <SortDescriptor>(); if (!sortDescriptors.Any() && queryable.Provider.IsEntityFrameworkProvider()) { // The Entity Framework provider demands OrderBy before calling Skip. SortDescriptor sortDescriptor = new SortDescriptor { Member = queryable.ElementType.FirstSortableProperty() }; sortDescriptors.Add(sortDescriptor); temporarySortDescriptors.Add(sortDescriptor); } if (groupDescriptors.Any()) { groupDescriptors.Reverse().Each(groupDescriptor => { SortDescriptor sortDescriptor = new SortDescriptor { Member = groupDescriptor.Member, SortDirection = groupDescriptor.SortDirection }; sortDescriptors.Insert(0, sortDescriptor); temporarySortDescriptors.Add(sortDescriptor); }); } if (sortDescriptors.Any()) { data = data.Sort(sortDescriptors); } var notPagedData = data; data = data.Page(page - 1, pageSize); if (groupDescriptors.Any()) { data = data.GroupBy(notPagedData, groupDescriptors); } result.Data = data; temporarySortDescriptors.Each(sortDescriptor => sortDescriptors.Remove(sortDescriptor)); return(result); }
public SortDescriptor <T> GetSortDescriptor(SortDescriptor <T> descriptor) { return(descriptor); }