private void frmTraitsQuarterlyGrading_Load(object sender, EventArgs e)
        {

            if (GlobalClass.user.UserType == "teach")
                btnUnlock.Hide();

            sy = GlobalClass.currentsy;

            txtSy.Text = sy;
            txtTeacherId.Text = teacherId;
            txtTeacherName.Text = teacherName;

            txtGradeLevel.Text = gradeLevel;
            txtSection.Text = section;

            IGradingService gradingService = new GradingService();

            classList = new List<StudentTrait>(gradingService.GetAdvisees(gradeSectionCode));
            gvTraitsGrades.DataSource = classList;

            GroupDescriptor descriptor5 = new GroupDescriptor();
            descriptor5.GroupNames.Add("StudentName", ListSortDirection.Ascending);
            this.gvTraitsGrades.GroupDescriptors.Add(descriptor5);

            gvTraitsGrades.Hide();
        }
Example #2
0
        private void loadList()
        {
            IRegistrationService regService = new RegistrationService();
            stEnrolled = new List<StudentEnrollment>(regService.GetCurrentStudents(sY));
            
            gridView.DataSource = stEnrolled;

            switch (groupedBy)
            {
                case "Religion":
                    GroupDescriptor descriptor2 = new GroupDescriptor();
                    descriptor2.GroupNames.Add("Religion", ListSortDirection.Ascending);
                    this.gridView.GroupDescriptors.Add(descriptor2);
                    break;
                case "Grade Level":
                    GroupDescriptor descriptor4 = new GroupDescriptor();
                    descriptor4.GroupNames.Add("GradeLevel", ListSortDirection.Ascending);
                    this.gridView.GroupDescriptors.Add(descriptor4);
                    break;
                case "Section":
                    GroupDescriptor descriptor5 = new GroupDescriptor();
                    descriptor5.GroupNames.Add("GradeLevel", ListSortDirection.Ascending);
                    GroupDescriptor descriptor6 = new GroupDescriptor();
                    descriptor6.GroupNames.Add("Section", ListSortDirection.Ascending);
                    this.gridView.GroupDescriptors.Add(descriptor5);
                    this.gridView.GroupDescriptors.Add(descriptor6);
                    break;
                case "Gender":
                    GroupDescriptor descriptor3 = new GroupDescriptor();
                    descriptor3.GroupNames.Add("Gender", ListSortDirection.Ascending);
                    this.gridView.GroupDescriptors.Add(descriptor3);
                    break;
            }
        }
 public GroupDescriptorExpressionBuilder(IQueryable queryable, GroupDescriptor groupDescriptor, GroupDescriptorExpressionBuilder childBuilder, IQueryable notPagedData)
     : base(queryable)
 {
     this.groupDescriptor = groupDescriptor;
     this.childBuilder = childBuilder;
     this.notPagedData = notPagedData;
 }
Example #4
0
        private void loadList()
        {
           IPaymentService payService = new PaymentService();

            if (IDnum == "All")
                payment = new List<Payment>(payService.GetAllPayments());
            else
                payment = new List<Payment>(payService.GetAllStudentsPayments(IDnum));
                    

            gridView.DataSource = payment;

            GroupDescriptor descriptor = new GroupDescriptor();
            descriptor.GroupNames.Add("Student", ListSortDirection.Ascending);

 
            this.gridView.GroupDescriptors.Add(descriptor);

            GridViewSummaryItem summaryItem;

            if (IDnum != "All")
                summaryItem = new GridViewSummaryItem("Amount", "Total: {0}  Balance: " + payment[0].Balance, GridAggregateFunction.Sum);
            else
                summaryItem = new GridViewSummaryItem("Amount", "Total: {0}", GridAggregateFunction.Sum);



            GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem();
            summaryRowItem.Add(summaryItem);

            this.gridView.SummaryRowsBottom.Add(summaryRowItem);       

        }
        private static GroupDescriptor CreateDescriptor(IEnumerable<AggregateFunction> aggregateFunctions)
        {
            var groupDescriptor = new GroupDescriptor();
            groupDescriptor.AggregateFunctions.AddRange(aggregateFunctions);

            return groupDescriptor;
        }
        private void AppendGroupIndicator(IHtmlNode div, GroupDescriptor group, GridGroupingData groupingData)
        {
            var groups = new List<GroupDescriptor>(groupingData.GroupDescriptors);

            var indicator = new HtmlElement("div").AddClass(UIPrimitives.Grid.GroupIndicator);

            indicator.AppendTo(div);

            AppendSortLink(indicator, group, groups, groupingData.UrlBuilder, groupingData.GetTitle, groupingData.SortedAscText, groupingData.SortedDescText);

            AppendUngroupButton(indicator, groupingData.UrlBuilder, groups, groupingData.UnGroupText);
        }
Example #7
0
        public void GroupDescriptorChangeBlocked()
        {
            GroupDescriptor group = new GroupDescriptor("StateName");

            this.LoadCities(() => this._dds.GroupDescriptors.Add(group));
            this.ModifyData();

            EnqueueCallback(() =>
            {
                ExceptionHelper.ExpectInvalidOperationException(() => group.PropertyPath = "Name", DomainDataSourceResources.CannotLoadWhenCanLoadIsFalse_Grouping);
            });

            EnqueueTestComplete();
        }
Example #8
0
        private void FrmUbicaciones_Load(object sender, EventArgs e)
        {
            try {
                GroupDescriptor Grupo = new GroupDescriptor();
                Grupo.GroupNames.Add("Almacen", ListSortDirection.Ascending);
                this.gvDatos.GroupDescriptors.Add(Grupo);

                CargaAlmacenes();
                CargaProductos();
                CargarDatos();
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrió un error al cargar la pantalla\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            }
        }
        private GridGroupByExpression CreateGridGroupByExpression(
            GroupDescriptor groupDescription)
        {
            GridGroupByExpression groupByExpression = new GridGroupByExpression();

            for (int index = 0; index < groupDescription.GroupNames.Count; ++index)
            {
                groupByExpression.GroupByFields.Add(new GridGroupByField(groupDescription.GroupNames[index].PropertyName)
                {
                    SortOrder = GridViewHelper.GetSortDirection(groupDescription.GroupNames[index].Direction)
                });
            }
            return(groupByExpression);
        }
Example #10
0
        private void frmFamilias_Load(object sender, EventArgs e)
        {
            try {
                GroupDescriptor Entidades = new GroupDescriptor();
                Entidades.GroupNames.Add("Entidad", ListSortDirection.Ascending);
                this.gvDatos.GroupDescriptors.Add(Entidades);

                LimpiarCampos();
                CargarEntidades();
                CargarDatos();
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrió un error al cargar la pantalla\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            }
        }
Example #11
0
        public static List <GroupDescriptor> ParseGroupString(string groupString)
        {
            List <GroupDescriptor> groupDescriptorList = new List <GroupDescriptor>();

            char[] chArray = new char[1] {
                ';'
            };
            foreach (string str in groupString.Split(chArray))
            {
                GroupDescriptor groupDescriptor = new GroupDescriptor(str.Trim());
                groupDescriptorList.Add(groupDescriptor);
            }
            return(groupDescriptorList);
        }
Example #12
0
        public frmManageCommision()
        {
            InitializeComponent();
            this.radGridView1.EnableCustomGrouping = true;
            this.radGridView1.CustomGrouping      += new GridViewCustomGroupingEventHandler(radGridView1_CustomGrouping);
            GroupDescriptor descriptor = new GroupDescriptor("DalamKota");

            this.radGridView1.GroupDescriptors.Add(descriptor);
            //Add Total info
            this.radGridView1.GroupDescriptors[0].Aggregates.Add("count(commisionid)");
            this.radGridView1.GroupDescriptors[0].Format = "{0} ({1})";

            this.radGridView1.GroupSummaryEvaluate += new GroupSummaryEvaluateEventHandler(radGridView1_GroupSummaryEvaluate);
        }
Example #13
0
        private bool UseDefaultGrouping(int level)
        {
            GroupDescriptor groupDescriptor = this.radGridView.GroupDescriptors[level];

            for (int i = 0; i < groupDescriptor.GroupNames.Count; i++)
            {
                if (groupDescriptor.GroupNames[i].PropertyName.Equals("Country", StringComparison.InvariantCultureIgnoreCase))
                {
                    return(false);
                }
            }

            return(true);
        }
Example #14
0
        private void frmComplementos_Load(object sender, EventArgs e)
        {
            try {
                GroupDescriptor Reflejante = new GroupDescriptor();
                Reflejante.GroupNames.Add("Tipo", ListSortDirection.Ascending);
                this.gvDatos.GroupDescriptors.Add(Reflejante);

                LimpiarCampos();
                CargaColores();
                CargarDatos();
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrió un error al cargar la pantalla\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            }
        }
Example #15
0
        public static List <GroupDescriptor> ParseGroupString(string groupString)
        {
            List <GroupDescriptor> list = new List <GroupDescriptor>();

            char[]   chArray   = new char[] { ';' };
            string[] textArray = groupString.Split(chArray);
            for (int i = 0; i < textArray.Length; i++)
            {
                string          sortText         = textArray[i].Trim();
                GroupDescriptor groupDescription = new GroupDescriptor(sortText);
                list.Add(groupDescription);
            }

            return(list);
        }
        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
            };
        }
Example #17
0
 private void GridViewParts_OnGrouping(object sender, GridViewGroupingEventArgs e)
 {
     if (e.Action == GroupingEventAction.Place)
     {
         e.Cancel = true;
         var           c = (ColumnGroupDescriptor)e.GroupDescriptor;
         CountFunction f = new CountFunction();
         f.Caption = "Count: ";
         GroupDescriptor descriptor = new GroupDescriptor();
         descriptor.Member         = c.Column.UniqueName;
         descriptor.DisplayContent = c.DisplayContent;
         descriptor.AggregateFunctions.Add(f);
         this.GridViewParts.GroupDescriptors.Add(descriptor);
     }
 }
Example #18
0
 private void RadGridView_Grouping(object sender, Telerik.Windows.Controls.GridViewGroupingEventArgs e)
 {
     if (e.Action == GroupingEventAction.Place)
     {
         e.Cancel = true;
         var descriptor = new GroupDescriptor<Club, string, int>
         {
             GroupingExpression = i => i.Name,
             GroupSortingExpression = group => group.ElementAt(0).StadiumCapacity
         };
         descriptor.DisplayContent = ((Telerik.Windows.Data.GroupDescriptorBase)(e.GroupDescriptor)).DisplayContent;
         descriptor.SortDirection = e.GroupDescriptor.SortDirection;
         this.grid.GroupDescriptors.Add(descriptor);
     }
 }
Example #19
0
        private GridGroupDescriptorBuilder <TModel> AddDescriptor(string memberName, Type memberType, ListSortDirection sortDirection)
        {
            Guard.IsNotNullOrEmpty(memberName, "memberName");
            Guard.IsNotNull(memberType, "memberType");

            var descriptor = new GroupDescriptor();

            descriptor.Member        = memberName;
            descriptor.SortDirection = sortDirection;
            descriptor.MemberType    = memberType;

            settings.Groups.Add(descriptor);

            return(new GridGroupDescriptorBuilder <TModel>(descriptor));
        }
Example #20
0
 private void RadGridView_Grouping(object sender, Telerik.Windows.Controls.GridViewGroupingEventArgs e)
 {
     if (e.Action == GroupingEventAction.Place)
     {
         e.Cancel = true;
         var descriptor = new GroupDescriptor <Club, string, int>
         {
             GroupingExpression     = i => i.Name,
             GroupSortingExpression = group => group.ElementAt(0).StadiumCapacity
         };
         descriptor.DisplayContent = ((Telerik.Windows.Data.GroupDescriptorBase)(e.GroupDescriptor)).DisplayContent;
         descriptor.SortDirection  = e.GroupDescriptor.SortDirection;
         this.grid.GroupDescriptors.Add(descriptor);
     }
 }
Example #21
0
        private async Task LoadRangeAsync(GroupDescriptor groupDescriptor, DateTime starDate, DateTime endDate)
        {
            var transactionUri = GetTransactionUri(starDate, endDate);

            var transactions = await _dataRetrieval.GetTransactionsAsync(transactionUri, _authContext.AccessToken);

            foreach (var transaction in transactions.Content)
            {
                Items.Add(new ContentModel(transaction, groupDescriptor));
            }

            if (SelectedItem == null)
            {
                SelectedItem = Items.FirstOrDefault();
            }
        }
Example #22
0
        private void AppendGroupIndicator(IHtmlNode div, GroupDescriptor group, GridGroupingData groupingData)
        {
            var groups = new List<GroupDescriptor>(groupingData.GroupDescriptors);

            var indicator = new HtmlElement("div").AddClass(UIPrimitives.Grid.GroupIndicator);

            indicator.Attribute("data-field", group.Member)
                .Attribute("data-dir", group.SortDirection == ListSortDirection.Ascending ? "asc" : "desc")
                .Attribute("data-title", groupingData.GetTitle(group.Member));

            indicator.AppendTo(div);

            AppendSortLink(indicator, group, groups, groupingData.UrlBuilder, groupingData.GetTitle);

            AppendUngroupButton(indicator, groupingData.UrlBuilder, groups);
        }
Example #23
0
        protected override void GroupingItems()
        {
            //Grouping("Operator");
            this.radGridView1.GroupDescriptors.Clear();
            var radSortOrder = SortDirection == 0 ? ListSortDirection.Ascending : ListSortDirection.Descending;

            var descriptor = new GroupDescriptor();

            descriptor.GroupNames.Add("Current", radSortOrder);
            var descriptor1 = new GroupDescriptor();

            descriptor1.GroupNames.Add("Status", radSortOrder);

            this.radGridView1.GroupDescriptors.Add(descriptor);
            this.radGridView1.GroupDescriptors.Add(descriptor1);
        }
Example #24
0
 public GroupFieldElement(
     TemplateGroupsElement template,
     GroupDescriptor groupDescription,
     SortDescriptor sortDescription)
     : base(template, groupDescription)
 {
     this.sortDescription = sortDescription;
     this.SetSortingIndicator();
     this.column = (GridViewColumn)this.TemplateElement.ViewTemplate.Columns[this.sortDescription.PropertyName ?? string.Empty];
     if (this.column == null)
     {
         return;
     }
     this.UpdateButtonVisibility();
     this.column.PropertyChanged += new PropertyChangedEventHandler(this.column_PropertyChanged);
 }
Example #25
0
        private void frmOrganigrama_Load(object sender, EventArgs e)
        {
            try {
                GroupDescriptor Entidades = new GroupDescriptor();
                Entidades.GroupNames.Add("ENT_Nombre", ListSortDirection.Ascending);
                this.gvDatos.GroupDescriptors.Add(Entidades);

                radCheckBox1.Checked = true;

                LimpiarCampos();
                CargarEntidades();
                CargarElementos_Organigrama();
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrio un error al cargar la pantalla\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            }
        }
 protected override void InsertItem(int index, GroupDescriptor item)
 {
     if (this.owner.MasterTemplate != null && this.owner.MasterTemplate.VirtualMode && this.owner.MasterTemplate.ThrowExceptionOnDataOperationInVirtualMode)
     {
         throw new InvalidOperationException("Grouping operation is not supported in VirtualMode.");
     }
     if (this.OnGroupByChanging(new GridViewCollectionChangingEventArgs(this.owner, NotifyCollectionChangedAction.Add, (object)item, index, -1)))
     {
         return;
     }
     if (item is GridGroupByExpression && !string.IsNullOrEmpty(item.Expression) && item.GroupNames.Count == 0)
     {
         ((GridGroupByExpression)item).Update();
     }
     base.InsertItem(index, item);
 }
Example #27
0
        private void AppendGroupIndicator(IHtmlNode div, GroupDescriptor group, GridGroupingData groupingData)
        {
            var groups = new List <GroupDescriptor>(groupingData.GroupDescriptors);

            var indicator = new HtmlElement("div").AddClass(UIPrimitives.Grid.GroupIndicator);

            indicator.Attribute("data-field", group.Member)
            .Attribute("data-dir", group.SortDirection == ListSortDirection.Ascending ? "asc" : "desc")
            .Attribute("data-title", groupingData.GetTitle(group.Member));

            indicator.AppendTo(div);

            AppendSortLink(indicator, group, groups, groupingData.UrlBuilder, groupingData.GetTitle);

            AppendUngroupButton(indicator, groupingData.UrlBuilder, groups);
        }
Example #28
0
        private void mailsGridView_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
        {
            mailsGridView.Columns["Content"].IsVisible   = false;
            mailsGridView.Columns["Recipient"].IsVisible = false;
            mailsGridView.Columns["Status"].IsVisible    = false;

            mailsGridView.Columns["Sender"].HeaderText   = "FROM";
            mailsGridView.Columns["Subject"].HeaderText  = "SUBJECT";
            mailsGridView.Columns["Received"].HeaderText = "RECEIVED";

            mailsGridView.GroupDescriptors.Clear();
            SortDescriptor  sortDesc  = new SortDescriptor("Received", ListSortDirection.Descending);
            GroupDescriptor groupDesc = new GroupDescriptor(sortDesc);

            mailsGridView.GroupDescriptors.Add(groupDesc);
        }
Example #29
0
        private void frmTeacherLoad_Load(object sender, EventArgs e)
        {
            IGradingService gradingService = new GradingService();
            sy = GlobalClass.currentsy;

            string fname = GlobalClass.user.FirstName;
            string lname = GlobalClass.user.LastName;
            string mname = GlobalClass.user.MiddleName;
            teacher = gradingService.GetTeacher(lname, mname, fname);



            LoadTeacherSubjects();
            GroupDescriptor descriptor5 = new GroupDescriptor();
            descriptor5.GroupNames.Add("TeacherName", ListSortDirection.Ascending);
            this.gvSubjects.GroupDescriptors.Add(descriptor5);
        }
Example #30
0
        private void frmPerfil_Load(object sender, EventArgs e)
        {
            try {
                GroupDescriptor descriptor = new GroupDescriptor();
                descriptor.GroupNames.Add("Grupo", ListSortDirection.Ascending);
                grdDatos.GroupDescriptors.Add(descriptor);

                CargarDeptos();
                CargarEducacion();
                CargarFunciones();
                CargarCompetencias();

                CargarGrid();
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrió un error al cargar la pantalla\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            }
        }
Example #31
0
        private void SetUpDaftarKunjungan()
        {
            string sQuery = "call pGetDataKunjungan(" + dtSales_["salesid"].ToString()
                            + ",'"
                            + DateTime.Parse(dtBulan_["startdate"].ToString()).ToString("yyyy-MM-dd")
                            + "' , '"
                            + DateTime.Parse(dtBulan_["enddate"].ToString()).ToString("yyyy-MM-dd") + "')";
            MySqlDataAdapter adapt = new MySqlDataAdapter(sQuery
                                                          , ConfigurationManager.ConnectionStrings["NB.Properties.Settings.sinarekConnectionString"].ConnectionString);
            DataTable dt = new DataTable("Data");

            adapt.Fill(dt);

            radGridView5.Columns.Clear();
            radGridView5.DataSource = dt;
            radGridView5.ReadOnly   = true;
            radGridView5.Columns["logpelid"].IsVisible  = false;
            radGridView5.Columns["logid"].IsVisible     = false;
            radGridView5.Columns["salesname"].IsVisible = false;
            //radGridView5.Columns["kunjungan"].IsVisible = false;

            radGridView5.Columns["Tanggal"].FormatString = "{0:dd MMM yy}";
            radGridView5.Columns["Tanggal"].Width        = 80;

            radGridView5.Columns["Pelanggan"].Width = 120;

            radGridView5.Columns["DaerahJual"].Width      = 150;
            radGridView5.Columns["DaerahJual"].HeaderText = "Kota";

            radGridView5.Columns["NoSJ"].HeaderText = "NO. SJ";
            radGridView5.Columns["NoSJ"].Width      = 80;

            radGridView5.Columns["Total"].HeaderText   = "Jumlah";
            radGridView5.Columns["Total"].FormatString = "{0:Rp #,##0.00}";
            radGridView5.Columns["Total"].Width        = 150;

            GroupDescriptor g1 = new GroupDescriptor();

            g1.GroupNames.Add("Tanggal", ListSortDirection.Ascending);
            g1.Aggregates.Add("count(logpelid)");
            g1.Aggregates.Add("sum(kunjungan)");
            //g1.Aggregates.Add("count(iif(total < 1,1,0))");
            g1.Format = "{1:ddddd,dd MMM yy} - Total Kunjungan ({2}) - Tidak Belanja ({3}) ";
            this.radGridView5.GroupDescriptors.Add(g1);
        }
Example #32
0
        public void Should_calculate_group_aggregate_on_multiple_groups()
        {
            IEnumerable <Person> people = new[] { new Person {
                                                      ID = 0, Name = "A"
                                                  }, new Person {
                                                      ID = 1, Name = "A"
                                                  }, new Person {
                                                      ID = 2, Name = "B"
                                                  } };
            var queryablePeople = QueryableFactory.CreateQueryable(people);

            var outterGroup = new GroupDescriptor {
                Member = "Name", MemberType = typeof(string)
            };

            outterGroup.AggregateFunctions.Add(new CountFunction());

            var innerGroup = new GroupDescriptor {
                Member = "ID", MemberType = typeof(string)
            };

            innerGroup.AggregateFunctions.Add(new CountFunction());

            var groupDescriptors = new[] { outterGroup, innerGroup };


            var result = queryablePeople.GroupBy(queryablePeople, groupDescriptors);
            var groups = result.Cast <AggregateFunctionsGroup>();

            groups.Count().ShouldEqual(2);

            var firstGroupHeader  = FindGroupHeader(groups, 0);
            var secondGroupHeader = FindGroupHeader(groups, 1);

            firstGroupHeader.GetAggregateResults(outterGroup.AggregateFunctions).First().Value.ShouldEqual(2);
            secondGroupHeader.GetAggregateResults(outterGroup.AggregateFunctions).First().Value.ShouldEqual(1);

            var firstInnerGroupHeader = FindGroupHeader(firstGroupHeader.Items, 0);

            firstInnerGroupHeader.GetAggregateResults(innerGroup.AggregateFunctions).First().Value.ShouldEqual(1);

            var secondInnerGroupHeader = FindGroupHeader(firstGroupHeader.Items, 1);

            secondInnerGroupHeader.GetAggregateResults(innerGroup.AggregateFunctions).First().Value.ShouldEqual(1);
        }
Example #33
0
        internal static void RaiseGroupByChanged(
            GridViewTemplate template,
            GroupDescriptor groupDescription,
            NotifyCollectionChangedAction action)
        {
            GridGroupByExpression fromDescriptor = GridGroupByExpression.CreateFromDescriptor(groupDescription);

            template.EventDispatcher.ResumeEvent(EventDispatcher.GroupByChanging);
            template.EventDispatcher.ResumeEvent(EventDispatcher.GroupByChanged);
            if (action != NotifyCollectionChangedAction.Add && action != NotifyCollectionChangedAction.ItemChanged && (action != NotifyCollectionChangedAction.Batch && action != NotifyCollectionChangedAction.Remove))
            {
                throw new ArgumentException("Invalid action");
            }
            template.MasterTemplate.SynchronizationService.EndDispatch(true);
            GridViewCollectionChangedEventArgs args = new GridViewCollectionChangedEventArgs(template, action, (object)fromDescriptor, (object)null, 0, string.Empty);

            template.EventDispatcher.RaiseEvent <GridViewCollectionChangedEventArgs>(EventDispatcher.GroupByChanged, (object)template, args);
        }
Example #34
0
        protected override void GroupingItems()
        {
            this.radGridView1.GroupDescriptors.Clear();
            // var descriptorGroup = new GroupDescriptor();
            // foreach (var colName in new List<string>{ "Auditor, Auditee" })
            //  descriptorGroup.GroupNames.Add(colName,  ListSortDirection.Ascending);
            // this.radGridView1.GroupDescriptors.Add(descriptorGroup);

            var descriptor = new GroupDescriptor();

            foreach (var colName in new List <string> {
                "Section №", "Section Name", "Part №", "Part Name", "SubPart №", "SubPart Name"
            })
            {
                descriptor.GroupNames.Add(colName, ListSortDirection.Ascending);
            }
            this.radGridView1.GroupDescriptors.Add(descriptor);
        }
Example #35
0
        protected override Group <GridViewRowInfo> GetGroup(
            GroupCollection <GridViewRowInfo> cache,
            Group <GridViewRowInfo> newGroup,
            Group <GridViewRowInfo> parent,
            object key,
            int level)
        {
            GroupDescriptor groupDescriptor = this.CollectionView.GroupDescriptors[level];
            DataGroup       group           = (DataGroup)base.GetGroup(cache, newGroup, parent, key, level);

            if (group.GroupDescriptor != null && group.GroupDescriptor != groupDescriptor)
            {
                group.GroupDescriptor = (GroupDescriptor)null;
                group = (DataGroup)this.CollectionView.GroupFactory.CreateGroup(key, parent);
                group.GroupBuilder = (GroupBuilder <GridViewRowInfo>) this;
            }
            group.GroupDescriptor = groupDescriptor;
            return((Group <GridViewRowInfo>)group);
        }
Example #36
0
        private void frmAltaProducto_Load(object sender, EventArgs e)
        {
            try {
                #region Grupo
                GroupDescriptor Tipo = new GroupDescriptor();
                Tipo.GroupNames.Add("Tipo", ListSortDirection.Ascending);
                this.gvResult.GroupDescriptors.Add(Tipo);
                #endregion

                txtCodigo.Clear();

                CargarEntidades();
                CargaColores();
                CargarReflejantes();
                CargaAccesorios();
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrió un error al cargar la pantalla\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            }
        }
Example #37
0
        private void loadList()
        {
            IPaymentService payService = new PaymentService();

            if (IDnum == "All")
            {
                payment = new List <Payment>(payService.GetAllPayments());
            }
            else
            {
                payment = new List <Payment>(payService.GetAllStudentsPayments(IDnum));
            }


            gridView.DataSource = payment;

            GroupDescriptor descriptor = new GroupDescriptor();

            descriptor.GroupNames.Add("Student", ListSortDirection.Ascending);


            this.gridView.GroupDescriptors.Add(descriptor);

            GridViewSummaryItem summaryItem;

            if (IDnum != "All")
            {
                summaryItem = new GridViewSummaryItem("Amount", "Total: {0}  Balance: " + payment[0].Balance, GridAggregateFunction.Sum);
            }
            else
            {
                summaryItem = new GridViewSummaryItem("Amount", "Total: {0}", GridAggregateFunction.Sum);
            }



            GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem();

            summaryRowItem.Add(summaryItem);

            this.gridView.SummaryRowsBottom.Add(summaryRowItem);
        }
Example #38
0
        public void CollectionManagerCollatesGroupDescriptorEvents()
        {
            GroupDescriptorCollection collection = new GroupDescriptorCollection();
            ObservableCollection <GroupDescription> descriptionCollection = new ObservableCollection <GroupDescription>();
            ExpressionCache cache      = new ExpressionCache();
            GroupDescriptor descriptor = null;

            this.CollectionManagerCollatesTemplate(
                (validationAction) =>
            {
                return(new GroupCollectionManager(collection, descriptionCollection, cache, gd => validationAction()));
            },
                () =>
            {
                collection.Add(new GroupDescriptor());
            },
                () =>
            {
                collection[0].PropertyPath = "First";
            },
                () =>
            {
                collection.Add(new GroupDescriptor());
            },
                () =>
            {
                collection[1].PropertyPath = "Second";
            },
                () =>
            {
                collection[1] = new GroupDescriptor();
            },
                () =>
            {
                descriptor = collection[0];
                collection.Remove(descriptor);
            },
                () =>
            {
                descriptor.PropertyPath = "Removed";
            });
        }
Example #39
0
        private void frmPrecios_Load(object sender, EventArgs e)
        {
            try {
                #region Grupos
                GroupDescriptor Entidades = new GroupDescriptor();
                Entidades.GroupNames.Add("Entidad", ListSortDirection.Ascending);
                this.gvDatos.GroupDescriptors.Add(Entidades);

                GroupDescriptor Familia = new GroupDescriptor();
                Familia.GroupNames.Add("Familia", ListSortDirection.Ascending);
                this.gvDatos.GroupDescriptors.Add(Familia);
                #endregion

                LimpiarCampos();
                CargaMonedas();
                CargarDatos();
            } catch (Exception ex) {
                throw ex;
            }
        }
Example #40
0
        private void frmTeacherLoad_Load(object sender, EventArgs e)
        {
            IGradingService gradingService = new GradingService();

            sy = GlobalClass.currentsy;

            string fname = GlobalClass.user.FirstName;
            string lname = GlobalClass.user.LastName;
            string mname = GlobalClass.user.MiddleName;

            teacher = gradingService.GetTeacher(lname, mname, fname);



            LoadTeacherSubjects();
            GroupDescriptor descriptor5 = new GroupDescriptor();

            descriptor5.GroupNames.Add("TeacherName", ListSortDirection.Ascending);
            this.gvSubjects.GroupDescriptors.Add(descriptor5);
        }
Example #41
0
        private void AppendSortLink(IHtmlNode indicator, GroupDescriptor group, List<GroupDescriptor> groups, IGridUrlBuilder urlBuilder, Func<string, string> title)
        {
            group.CycleSortDirection();

            var a = new HtmlElement("a")
                 .AddClass(UIPrimitives.Link)
                 .Attribute("href", urlBuilder.SelectUrl(GridUrlParameters.Group, GridDescriptorSerializer.Serialize(groups)))
                 .AppendTo(indicator);

            group.CycleSortDirection();

            new HtmlElement("span")
                .AddClass(UIPrimitives.Icon)
                .ToggleClass("k-si-arrow-n", group.SortDirection == ListSortDirection.Ascending)
                .ToggleClass("k-si-arrow-s", group.SortDirection == ListSortDirection.Descending)
                .AppendTo(a);

            groups.Remove(group);

            new TextNode(title(group.Member)).AppendTo(a);
        }
Example #42
0
        public ContentModel(Content source, GroupDescriptor groupDescriptor)
        {
            Source = source;
            GroupDescriptor = groupDescriptor;

            //var badRecepients = Source.RecipientEmails.Where(x => x == null).ToList();
            //foreach (var item in badRecepients)
            //{
            //    Source.RecipientEmails.Remove(item);
            //}

            //var badSenders = Source.SenderEmails.Where(x => x == null).ToList();
            //foreach (var item in badSenders)
            //{
            //    Source.SenderEmails.Remove(item);
            //}

            //var badExtraServices = Source.ExtraServices.Where(x => x == null).ToList();
            //foreach (var item in badExtraServices)
            //{
            //    Source.ExtraServices.Remove(item);
            //}
        }
 public GroupDescriptorExpressionBuilder(IQueryable queryable, GroupDescriptor groupDescriptor, GroupDescriptorExpressionBuilder childBuilder)
     : base(queryable)
 {
     this.groupDescriptor = groupDescriptor;
     this.childBuilder = childBuilder;
 }
        public void Should_calculate_group_aggregate_if_paged()
        {
            IEnumerable<Person> people = new[]{ new Person { Name = "A" }, new Person { Name = "A" },new Person { Name = "B" }};

            var queryablePeople = QueryableFactory.CreateQueryable(people);

            var groupDescriptor = new GroupDescriptor { Member = "Name", MemberType = typeof(string) };
            groupDescriptor.AggregateFunctions.Add(new CountFunction());
            var groupDescriptors = new[] { groupDescriptor };

            var notPagedData = queryablePeople;

            var result = queryablePeople.Page(0, 1).GroupBy(notPagedData, groupDescriptors);
            var groups = result.Cast<AggregateFunctionsGroup>();

            groups.Count().ShouldEqual(1);

            groups.ElementAt(0).GetAggregateResults(groupDescriptor.AggregateFunctions).First().Value.ShouldEqual(2);
        }
        private void SetGroupping()
        {
            gvParameters.GroupDescriptors.Clear();

            GroupDescriptor descriptor = new GroupDescriptor();
            descriptor.Member = "Group";
            gvParameters.GroupDescriptors.Add(descriptor);
        }
 public GroupDescriptorExpressionBuilder(IQueryable queryable, GroupDescriptor groupDescriptor)
     : this(queryable, groupDescriptor, null, queryable)
 {
     this.groupDescriptor = groupDescriptor;
 }
Example #47
0
        /// <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);
        }
Example #48
0
        /// <summary>
        /// 创建计划历史
        /// </summary>
        public RadGridView CreatePlanHistorityGridView()
        {
            RadGridView rgView = new RadGridView();
            rgView.ShowGroupPanel = true;
            rgView.AutoGenerateColumns = false;
            rgView.IsReadOnly = true;
            rgView.Name = "planHistotry";
            rgView.RowIndicatorVisibility = Visibility.Collapsed;
            rgView.IsFilteringAllowed = true;

            GridViewDataColumn gvColumn0 = new GridViewDataColumn();
            gvColumn0.Header = "申报单位";
            gvColumn0.DataMemberBinding = new System.Windows.Data.Binding("Plan.Airlines.ShortName");
            //Telerik.Windows.Data.CountFunction cf = new Telerik.Windows.Data.CountFunction();
            //cf.Caption = "总计(项):";
            //gvColumn0.AggregateFunctions.Add(cf);

            GridViewDataColumn gvColumn1 = new GridViewDataColumn();
            gvColumn1.Header = "执行年份";
            gvColumn1.DataMemberBinding = new System.Windows.Data.Binding("Annual.Year");

            GridViewDataColumn gvColumn2 = new GridViewDataColumn();
            gvColumn2.Header = "执行月份";
            gvColumn2.DataMemberBinding = new System.Windows.Data.Binding("PerformMonth");

            GridViewDataColumn gvColumn3 = new GridViewDataColumn();
            gvColumn3.Header = "活动类别";
            gvColumn3.DataMemberBinding = new System.Windows.Data.Binding("ActionCategoryOperation");

            GridViewDataColumn gvColumn4 = new GridViewDataColumn();
            gvColumn4.Header = "引进/退出方式";
            System.Windows.Data.Binding bingding4 = new System.Windows.Data.Binding("TargetCategory.ActionName");
            gvColumn4.DataMemberBinding = bingding4;

            GridViewDataColumn gvColumn5 = new GridViewDataColumn();
            gvColumn5.Header = "机型";
            gvColumn5.DataMemberBinding = new System.Windows.Data.Binding("AircraftType.Name");

            GridViewDataColumn gvColumn6 = new GridViewDataColumn();
            gvColumn6.Header = "净增座位(座)";
            gvColumn6.DataMemberBinding = new System.Windows.Data.Binding("SeatingCapacity");

            GridViewDataColumn gvColumn7 = new GridViewDataColumn();
            gvColumn7.Header = "净增商载(吨)";
            gvColumn7.DataMemberBinding = new System.Windows.Data.Binding("CarryingCapacity");

            GridViewDataColumn gvColumn8 = new GridViewDataColumn();
            gvColumn8.Header = "备注";
            gvColumn8.DataMemberBinding = new System.Windows.Data.Binding("Note");

            GridViewDataColumn gvColumn9 = new GridViewDataColumn();
            gvColumn9.Header = "申请状态";
            gvColumn9.DataMemberBinding = new System.Windows.Data.Binding("IsApply");

            //默认分组
            GroupDescriptor countryDescriptor = new GroupDescriptor();
            countryDescriptor.Member = "IsApply";
            countryDescriptor.DisplayContent = "申请状态";
            rgView.GroupDescriptors.Add(countryDescriptor);
            rgView.AutoExpandGroups = true;

            SerialColumn gvColumn10 = new SerialColumn();
            ResourceDictionary dictionary = new ResourceDictionary();
            dictionary.Source = new Uri("/CAAC.Infrastructure;component/Resources/CafmStyle.xaml", UriKind.Relative);
            gvColumn10.Header = "序号";
            gvColumn10.CellStyle = (Style)dictionary["style"];

            rgView.Columns.Add(gvColumn10);
            rgView.Columns.Add(gvColumn0);
            rgView.Columns.Add(gvColumn1);
            rgView.Columns.Add(gvColumn2);
            rgView.Columns.Add(gvColumn3);
            rgView.Columns.Add(gvColumn4);
            rgView.Columns.Add(gvColumn5);
            rgView.Columns.Add(gvColumn6);
            rgView.Columns.Add(gvColumn7);
            rgView.Columns.Add(gvColumn8);
            rgView.Columns.Add(gvColumn9);

            return rgView;
        }
        public void Should_calculate_group_aggregate_on_multiple_groups()
        {
            IEnumerable<Person> people = new[] { new Person { ID = 0, Name = "A" }, new Person { ID = 1, Name = "A" }, new Person { ID = 2, Name = "B" } };
            var queryablePeople = QueryableFactory.CreateQueryable(people);

            var outterGroup = new GroupDescriptor { Member = "Name", MemberType = typeof(string) };
            outterGroup.AggregateFunctions.Add(new CountFunction());

            var innerGroup = new GroupDescriptor { Member = "ID", MemberType = typeof(string) };
            innerGroup.AggregateFunctions.Add(new CountFunction());

            var groupDescriptors = new[] { outterGroup, innerGroup };

            var result = queryablePeople.GroupBy(queryablePeople, groupDescriptors);
            var groups = result.Cast<AggregateFunctionsGroup>();

            groups.Count().ShouldEqual(2);

            var firstGroupHeader = FindGroupHeader(groups, 0);
            var secondGroupHeader = FindGroupHeader(groups, 1);

            firstGroupHeader.GetAggregateResults(outterGroup.AggregateFunctions).First().Value.ShouldEqual(2);
            secondGroupHeader.GetAggregateResults(outterGroup.AggregateFunctions).First().Value.ShouldEqual(1);

            var firstInnerGroupHeader = FindGroupHeader(firstGroupHeader.Items, 0);
            firstInnerGroupHeader.GetAggregateResults(innerGroup.AggregateFunctions).First().Value.ShouldEqual(1);

            var secondInnerGroupHeader = FindGroupHeader(firstGroupHeader.Items, 1);
            secondInnerGroupHeader.GetAggregateResults(innerGroup.AggregateFunctions).First().Value.ShouldEqual(1);
        }
Example #50
0
        public bool TryGetGroup(string commonName, out GroupDescriptor group)
        {
            if (commonName.IsNullOrBlank()) throw new ArgumentNullException("commonName");

            using (DirectorySearcher directorySearcher = new DirectorySearcher(Entry) { Filter = String.Format("CN={0}", commonName) })
            {
                SearchResultCollection searchResult = directorySearcher.FindAll();
                if (searchResult.Any())
                {
                    group = GroupDescriptor.Initialize(searchResult.First());
                }
                else
                {
                    group = null;
                }
                return (group != null);
            }
        }
Example #51
0
        /// <summary>
        ///     初始化ViewModel
        ///     <remarks>
        ///         统一在此处创建并注册CollectionView集合。
        ///     </remarks>
        /// </summary>
        private void InitializeVM()
        {
            CurAnnual = _service.CreateCollection(_context.Annuals);
            _annualDescriptor = new FilterDescriptor("IsOpen", FilterOperator.IsEqualTo, true);
            CurAnnual.FilterDescriptors.Add(_annualDescriptor);
            CurAnnual.LoadedData += (sender, e) =>
            {
                if (CurAnnual.Count != 0)
                {
                    _curAnnual = CurAnnual.FirstOrDefault();
                    if (_curAnnual != null)
                    {
                        _planDescriptor.Value = _curAnnual.Year;
                        if (!Plans.AutoLoad)
                            Plans.AutoLoad = true;
                        else
                            Plans.Load(true);
                    }
                    Plans.Load(true);
                }
            };

            Plans = _service.CreateCollection(_context.Plans);
            _planDescriptor = new FilterDescriptor("Year", FilterOperator.IsEqualTo, -1);
            Plans.FilterDescriptors.Add(_planDescriptor);
            Plans.LoadedData += (sender, e) =>
            {
                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();
            };
            _service.RegisterCollectionView(Plans);//注册查询集合

            CurPlanHistories = _service.CreateCollection(_context.PlanHistories);
            _planHistoryDescriptor = new FilterDescriptor("PlanId", FilterOperator.IsEqualTo, Guid.Empty);
            CurPlanHistories.FilterDescriptors.Add(_planHistoryDescriptor);
            CurPlanHistories.LoadedData += (sender, e) =>
            {
                ViewPlanHistories = new ObservableCollection<PlanHistoryDTO>();
                foreach (var ph in CurPlanHistories.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);
                    ViewPlanHistories.Add(ph);
                }
                SelPlanHistory = ViewPlanHistories.FirstOrDefault();
                RefreshCommandState();
            };
            _service.RegisterCollectionView(CurPlanHistories);//注册查询集合

            Aircrafts = _service.CreateCollection(_context.Aircrafts);
            var group = new GroupDescriptor { Member = "OperateStatus", SortDirection = ListSortDirection.Ascending };
            Aircrafts.GroupDescriptors.Add(group);
            _service.RegisterCollectionView(Aircrafts);//注册查询集合

            PlanAircrafts = _service.CreateCollection(_context.PlanAircrafts);
            _service.RegisterCollectionView(PlanAircrafts);

            ActionCategories = new QueryableDataServiceCollectionView<ActionCategoryDTO>(_context, _context.ActionCategories);
            AircraftCategories = new QueryableDataServiceCollectionView<AircraftCategoryDTO>(_context, _context.AircraftCategories);
            AircraftTypes = new QueryableDataServiceCollectionView<AircraftTypeDTO>(_context, _context.AircraftTypes);
        }
Example #52
0
        /// <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);
        }
Example #53
0
        /// <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);
        }
        public void CollectionManagerCollatesGroupDescriptorEvents()
        {
            GroupDescriptorCollection collection = new GroupDescriptorCollection();
            ObservableCollection<GroupDescription> descriptionCollection = new ObservableCollection<GroupDescription>();
            ExpressionCache cache = new ExpressionCache();
            GroupDescriptor descriptor = null;

            this.CollectionManagerCollatesTemplate(
                (validationAction) =>
                {
                    return new GroupCollectionManager(collection, descriptionCollection, cache, gd => validationAction());
                },
                () =>
                {
                    collection.Add(new GroupDescriptor());
                },
                () =>
                {
                    collection[0].PropertyPath = "First";
                },
                () =>
                {
                    collection.Add(new GroupDescriptor());
                },
                () =>
                {
                    collection[1].PropertyPath = "Second";
                },
                () =>
                {
                    collection[1] = new GroupDescriptor();
                },
                () =>
                {
                    descriptor = collection[0];
                    collection.Remove(descriptor);
                },
                () =>
                {
                    descriptor.PropertyPath = "Removed";
                });
        }
        public void GroupDescriptorDefaultsEventsAndRestoration()
        {
            GroupDescriptor descriptor = new GroupDescriptor();

            // Check defaults
            Assert.AreEqual(string.Empty, descriptor.PropertyPath,
                "Default PropertyPath should be empty.");

            // Check change notification
            string propertyPath = "propertyPath";

            this.CheckPropertyChange(() => descriptor.PropertyPath = propertyPath, descriptor.Notifier, "PropertyPath");
            Assert.AreEqual(propertyPath, descriptor.PropertyPath,
                "PropertyPaths should be equal.");

            // Check restoration
            int count = 0;
            descriptor.Notifier.PropertyChanged += (sender, e) => count++;

            ((IRestorable)descriptor).StoreOriginalValue();

            descriptor.PropertyPath = null;

            ((IRestorable)descriptor).RestoreOriginalValue();

            Assert.AreEqual(2, count,
                "2 PropertyChanged events should have occurred.");
            Assert.AreEqual(propertyPath, descriptor.PropertyPath,
                "PropertyPaths should be equal.");
        }
        public void InvalidPropertyPathGroupDescriptor()
        {
            this._dds.AutoLoad = true;
            this._dds.QueryName = "GetCitiesQuery";
            this._dds.DomainContext = new CityDomainContext();

            // The first two cases are acceptable and support the binding scenario
            GroupDescriptor gd = new GroupDescriptor(null);
            this._dds.GroupDescriptors.Add(gd);

            gd.PropertyPath = string.Empty;

            this._dds.GroupDescriptors.Clear();

            // The second two cases throw exceptions for property paths that are not valid
            gd.PropertyPath = "invalid";
            AssertExpectedException(
                new ArgumentException(
                    string.Format(
                        CultureInfo.InvariantCulture,
                        CommonResources.PropertyNotFound,
                        "invalid", "City")),
                () => this._dds.GroupDescriptors.Add(gd));

            AssertExpectedException(
                new ArgumentException(
                    string.Format(
                        CultureInfo.InvariantCulture,
                        CommonResources.PropertyNotFound,
                        "invalid2", "City")),
                    () => gd.PropertyPath = "invalid2");
        }
 public DataSourceGroupDescriptorBuilder(GroupDescriptor descriptor)
 {
     this.descriptor = descriptor;
 }