Esempio n. 1
0
 public static DataGridBuilder <T> WEAGrid <T>(this DataGridBuilder <T> builder)
 {
     return(builder
            .FilterRow(filterRow => filterRow
                       .Visible(false)
                       .ResetOperationText("Sıfırla")
                       .ApplyFilterText("Tətbiq et")
                       .BetweenEndText("Bitmə")
                       .BetweenStartText("Başlama")
                       .ShowAllText("Hamısına bax")
                       .ApplyFilter(GridApplyFilterMode.Auto)
                       .OperationDescriptions(o => o
                                              .Between("Arasında olsun")
                                              .Contains("İbarət olsun")
                                              .EndsWith("Sonlansın")
                                              .StartsWith("Başlasın")
                                              .Equal("Bərabər olsun")
                                              .LessThan("Kiçik olsun")
                                              .LessThanOrEqual("Kiçik yaxud bərabər olsun")
                                              .GreaterThan("Böyük olsun")
                                              .GreaterThanOrEqual("Böyük yaxud bərabər olsun")
                                              .NotContains("İçində olmasın")
                                              .NotEqual("Fərqli olsun")
                                              )
                       )
            .NoDataText("Məlumat yoxdur").LoadPanel(c => c.Text("Yüklənir")));
 }
Esempio n. 2
0
 public SkipsWindow()
 {
     InitializeComponent();
     builder = new SkipDataGridBuilder(dataGrid);
     new DataGridDirector().Create(builder, null);
     groupCb.ItemsSource = GetGroups();
 }
Esempio n. 3
0
 public CoursesWindow()
 {
     InitializeComponent();
     builder = new CourseDataGridBuilder(dataGrid);
     new DataGridDirector().Create(builder, source);
     dataGrid.SelectionChanged += DataGrid_SelectionChanged;
 }
Esempio n. 4
0
        /// <summary>
        /// WARNING: This method is a work-around for the currently missing support for the Editable annotation attribute
        /// on the model.
        /// Once this feature is implemented, this method can be removed.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="gridBuilder"></param>
        /// <returns></returns>
        public static DataGridBuilder <T> FixEditingFromModel <T>(this DataGridBuilder <T> gridBuilder)
        {
            var options = gridBuilder.GetPropertyValue <IDictionary <string, object> >("Options");

            if (options != null)
            {
                var columns = options["columns"] as List <object>;
                columns.ForEach((c) =>
                {
                    var col = c as IDictionary <string, object>;
                    if (col != null && col.ContainsKey("dataField"))
                    {
                        var modelProp = typeof(T).GetProperty(col["dataField"].ToString());
                        if (Attribute.IsDefined(modelProp, typeof(EditableAttribute)))
                        {
                            var attr = Attribute.GetCustomAttribute(modelProp, typeof(EditableAttribute)) as EditableAttribute;
                            if (attr != null)
                            {
                                col["allowEditing"] = attr.AllowEdit;
                            }
                        }
                    }
                });
            }
            return(gridBuilder);
        }
Esempio n. 5
0
        public static DataGridBuilder <T> AdvancedGridOptions <T>(this DataGridBuilder <T> dataGridBuilder)
        {
            dataGridBuilder
            .SearchPanel(opt => opt.Visible(true))
            .FilterPanel(filter => filter.Visible(true))
            .HeaderFilter(filter => filter.Visible(true))
            .AllowColumnResizing(true)
            .ColumnResizingMode(ColumnResizingMode.NextColumn)
            .ColumnAutoWidth(true)
            .AllowColumnReordering(true)
            .CacheEnabled(true)
            .FilterRow(filterRow => filterRow
                       .Visible(true)
                       .ApplyFilter(GridApplyFilterMode.Auto))
            .Sorting(sorting => sorting.Mode(GridSortingMode.Multiple))
            .RowAlternationEnabled(true)
            .Export(export => export.Enabled(true).AllowExportSelectedData(true))
            .ColumnChooser(c => c.Enabled(true).Mode(GridColumnChooserMode.DragAndDrop))
            .Selection(select => select.Mode(SelectionMode.Multiple))
            .Paging(paging => paging.PageSize(10))
            .Pager(pager =>
            {
                pager.ShowPageSizeSelector(true);
                pager.AllowedPageSizes(new[] { 10, 20, 50, 100 });
                pager.ShowInfo(true);
            });

            return(dataGridBuilder);
        }
Esempio n. 6
0
 public MarksWindow(Teacher teacher)
 {
     this.teacher = teacher;
     InitializeComponent();
     builder = new MarkDataGridBuilder(dataGrid);
     new DataGridDirector().Create(builder, null);
     groupCb.ItemsSource = GetGroups();
 }
Esempio n. 7
0
        public MainWindow()
        {
            InitializeComponent();
            var             b   = TableManager.createTable("qwe", new List <Column>(), Model.TableType.timesheet);
            DataGridBuilder qwe = new DataGridBuilder(b);

            qwe.CreateColumns(ref this.phonesGrid);
            //MessageBox.Show(d.GetHashCode().ToString() +"\n" + (d2).GetHashCode().ToString());
            //MessageBox.Show(qwe[2].ToString());
        }
Esempio n. 8
0
        public static DataGridBuilder <T> GridLeftButtons <T>(this DataGridBuilder <T> dataGridBuilder)
        {
            dataGridBuilder.Columns(columns =>
            {
                columns.Add()
                .Type(GridCommandColumnType.Buttons)
                .Width(110)
                .Buttons(b =>
                {
                    b.Add().Name(GridColumnButtonName.Edit);
                    b.Add().Name(GridColumnButtonName.Delete);
                });
            });

            return(dataGridBuilder);
        }
Esempio n. 9
0
        public static DataGridBuilder <T> ConfigureAppGridSettings <T>(this DataGridBuilder <T> gridBuilder,
                                                                       string controller, string keyField,
                                                                       bool enableInsert = true, bool enableUpdate = true, bool enableDelete = true)
        {
            gridBuilder.DataSource(ds =>
            {
                var r = ds.Mvc()
                        .Controller(controller)
                        .LoadAction("Get");
                if (enableInsert)
                {
                    r.InsertAction("Post");
                }
                if (enableUpdate)
                {
                    r.UpdateAction("Put");
                }
                if (enableDelete)
                {
                    r.DeleteAction("Delete");
                }
                r.Key(keyField);
                return(r);
            });
            gridBuilder
            .FilterRow(f => f.Visible(true))
            .Sorting(sorting => sorting.Mode(GridSortingMode.Multiple))
            .RemoteOperations(true)
            .AllowColumnReordering(true)
            .Pager(p => p
                   .ShowPageSizeSelector(true)
                   .AllowedPageSizes(new[] { 5, 10, 20, })
                   )
            //.Editing(e => e
            //	.AllowAdding(enableInsert)
            //	.AllowUpdating(enableUpdate)
            //	.AllowDeleting(enableDelete)
            //)
            ;

            // more settings ...

            return(gridBuilder);
        }
Esempio n. 10
0
        public void ConfigureDatagrid(DataGridBuilder <DataItem> builder)
        {
            builder
            .Property(p => p.Name)
            .HasHeaderText("Name")
            .Property(p => p.Description)
            .HasHeaderText("Description")
            .Property(p => p.Value)
            .HasHeaderText("Value");

            builder
            .If(item => item.IsGroup)
            .HasClass("active", false)
            .Property(p => p.Description)
            .HasColSpan(2)
            .Else()
            .Property(p => p.Value)
            .HasFormatter(item => item.Value + "$")
            .If(item => item.Value % 2 == 0)         // every pair item
            .Property(p => p.Value)
            .HasBackgroundColor("#fcd1d1");          // error/red color
        }
Esempio n. 11
0
 public static DataGridBuilder <T> CommonConfigs <T>(this DataGridBuilder <T> grid)
 {
     return(grid
            .ShowBorders(true)
            .ShowRowLines(true)
            .ShowColumnLines(false)
            .RowAlternationEnabled(true)
            .HoverStateEnabled(true)
            .RemoteOperations(false)
            .WordWrapEnabled(true)
            .ColumnHidingEnabled(true)
            .SearchPanel(DXGridConfigs.ShowSearchPanel())
            .Paging(DXGridConfigs.MasterPaging())
            .Pager(DXGridConfigs.Pager())
            .OnContentReady("dxGrid.handlers.onContentReady")
            .OnToolbarPreparing("dxGrid.handlers.onToolbarPreparing")
            .OnRowInserted("dxGrid.handlers.onRowInserted")
            .OnRowUpdated("dxGrid.handlers.onRowUpdated")
            .OnRowRemoved("dxGrid.handlers.onRowRemoved")
            .OnRowClick("dxGrid.handlers.onRowDoubleClick")
            );
 }
Esempio n. 12
0
        public UsersWindow(UserType user)
        {
            InitializeComponent();
            switch (user)
            {
            case UserType.Student:
                source               = Data.Context.Students.Include(s => s.Group.Faculty).ToList();
                builder              = new StudentDataGridBuilder(dataGrid);
                Title                = "Студенты";
                labelInfoTb.Text     = "Группа:";
                infoPanel.Visibility = Visibility.Visible;
                break;

            case UserType.Teacher:
                source               = Data.Context.Teachers.Include(s => s.Groups).ToList();
                builder              = new TeacherDataGridBuilder(dataGrid);
                Title                = "Преподаватели";
                labelInfoTb.Text     = "Кураторство:";
                infoPanel.Visibility = Visibility.Visible;
                break;

            case UserType.Secretary:
                source  = Data.Context.Secretaries.ToList();
                builder = new SecretaryDataGridBuilder(dataGrid);
                Title   = "Секретари";
                break;

            case UserType.Dean:
                source               = Data.Context.Deans.Include(s => s.Faculties).ToList();
                builder              = new DeanDataGridBuilder(dataGrid);
                Title                = "Зав. отделениями";
                labelInfoTb.Text     = "Факультеты:";
                infoPanel.Visibility = Visibility.Visible;
                break;
            }
            new DataGridDirector().Create(builder, source);
            dataGrid.SelectionChanged += DataGrid_SelectionChanged;
        }
Esempio n. 13
0
        public void ConfigureDatagrid(DataGridBuilder <DataItem> builder)
        {
            builder
            .Property(p => p.Checkbox)
            .HasHeaderText("CB")
            .HasWidth("50px")
            .HasAutoEditor()
            .HasFixedCol()
            .HasBackgroundColor(Color.White)
            .Property(p => p.ActionHere)
            .HasWidth("150px")
            .HasPopup("Title here", "Content here")
            .Property(p => p.Name)
            .HasHeaderText("Name")
            .HasWidth("250px")
            .Property(p => p.Description)
            .HasHeaderText("Description")
            .HasWidth("500px")
            .Property(p => p.Description2).HasHeaderText("Description2")
            .Property(p => p.Description3).HasHeaderText("Description3")
            .Property(p => p.Description4).HasHeaderText("Description4")
            .Property(p => p.Description5).HasHeaderText("Description5")
            .Property(p => p.Description6).HasHeaderText("Description6")
            .Property(p => p.Description7).HasHeaderText("Description7")
            .Property(p => p.Description8).HasHeaderText("Description8")
            .Property(p => p.Description9).HasHeaderText("Description9")
            .Property(p => p.Description12).HasHeaderText("Description12")
            .Property(p => p.Description13).HasHeaderText("Description13")
            .Property(p => p.Description14).HasHeaderText("Description14")
            .Property(p => p.Description15).HasHeaderText("Description15")
            .Property(p => p.Description16).HasHeaderText("Description16")
            .Property(p => p.Description17).HasHeaderText("Description17")
            .Property(p => p.Description18).HasHeaderText("Description18")
            .Property(p => p.Description19).HasHeaderText("Description19")
            .Property(p => p.Description22).HasHeaderText("Description22")
            .Property(p => p.Description23).HasHeaderText("Description23")
            .Property(p => p.Description24).HasHeaderText("Description24")
            .Property(p => p.Description25).HasHeaderText("Description25")
            .Property(p => p.Description26).HasHeaderText("Description26")
            .Property(p => p.Description27).HasHeaderText("Description27")
            .Property(p => p.Description28).HasHeaderText("Description28")
            .Property(p => p.Description29).HasHeaderText("Description29")
            .Property(p => p.Value)
            .HasHeaderText("Value")
            .HasWidth("100px")
            .HasAppendedText("$")
            .HasAutoEditor()
            .HasRightAlignedText();

            builder.HasFilterRow();

            builder
            .If(item => !item.IsTotal)
            .If(item => !item.IsGroup)
            .Property(p => p.Description)
            .HasTextEditor()
            .ElseRow()
            .HasClass("active bold")
            .IsReadOnly()
            .Property(p => p.Description)
            .HasColSpan(2)
            .EndIf()
            .If(item => item.Value % 2 == 0)
            .Property(p => p.Value)
            .If(item => item.Value == 4)
            .HasClass("positive")
            .Else()
            .HasBackgroundColor("#fcd1d1")                     // error/red color
            .EndIf()
            .Property(p => p.Description)
            .HasClass("warning")
            .Property(p => p.Checkbox)
            .IsNotReadOnly()
            .ElseRow()
            .Property(p => p.Description)
            .HasClass("positive");

            builder
            .If(x => x.IsTotal)
            .HasFooterLocation()
            .Property(p => p.Value)
            .HasFormatter(_ => builder.FilteredItems.Sum(x => x.Item.Value).ToString("0.00"));

            builder
            .If(x => !string.IsNullOrEmpty(x.ActionHere))
            .Property(p => p.ActionHere)
            .HasButtonFormatter(() =>
            {
                Console.WriteLine("Clicked!");
            });
        }
Esempio n. 14
0
 public SubjectsWindow()
 {
     InitializeComponent();
     builder = new SubjectDataGridBuilder(dataGrid);
     new DataGridDirector().Create(builder, source);
 }