示例#1
0
        void ReleaseDesignerOutlets()
        {
            if (LocationTableView != null)
            {
                LocationTableView.Dispose();
                LocationTableView = null;
            }

            if (DateColumn != null)
            {
                DateColumn.Dispose();
                DateColumn = null;
            }

            if (LocationColumn != null)
            {
                LocationColumn.Dispose();
                LocationColumn = null;
            }

            if (mainMapView != null)
            {
                mainMapView.Dispose();
                mainMapView = null;
            }
        }
示例#2
0
        protected override void OnPaintSubItem(SubItemPaintEventArgs paintEventArgs)
        {
            switch ((ColumnId)paintEventArgs.SubItemId)
            {
            case ColumnId.Id:
                paintEventArgs.PaintText(DataContext.Id.ToString(CultureInfo.InvariantCulture));
                break;

            case ColumnId.Status:
                paintEventArgs.PaintImageAndText(StatusImage, DataContext.Status.ToString());
                break;

            case ColumnId.Number:
                paintEventArgs.PaintText(DataContext.Number);
                break;

            case ColumnId.StartDate:
                DateColumn.OnPaintSubItem(paintEventArgs, DataContext.StartDate);
                break;

            case ColumnId.WebUrl:
                paintEventArgs.PaintText(DataContext.WebUrl);
                break;
            }
        }
示例#3
0
        void ReleaseDesignerOutlets()
        {
            if (TransactionsTable != null)
            {
                TransactionsTable.Dispose();
                TransactionsTable = null;
            }

            if (DateColumn != null)
            {
                DateColumn.Dispose();
                DateColumn = null;
            }

            if (DescriptionColumn != null)
            {
                DescriptionColumn.Dispose();
                DescriptionColumn = null;
            }

            if (ValueColumn != null)
            {
                ValueColumn.Dispose();
                ValueColumn = null;
            }
        }
示例#4
0
        protected override Size OnMeasureSubItem(SubItemMeasureEventArgs measureEventArgs)
        {
            switch ((ColumnId)measureEventArgs.SubItemId)
            {
            case ColumnId.Id:
                return(measureEventArgs.MeasureText(DataContext.Id.ToString()));

            case ColumnId.Name:
                return(measureEventArgs.MeasureText(DataContext.Name));

            case ColumnId.Description:
                return(measureEventArgs.MeasureText(DataContext.Description));

            case ColumnId.Identifier:
                return(measureEventArgs.MeasureText(DataContext.Identifier));

            case ColumnId.CreatedOn:
                return(DateColumn.OnMeasureSubItem(measureEventArgs, DataContext.CreatedOn));

            case ColumnId.UpdatedOn:
                return(DateColumn.OnMeasureSubItem(measureEventArgs, DataContext.UpdatedOn));

            default:
                return(Size.Empty);
            }
        }
示例#5
0
        protected override void OnPaintSubItem(SubItemPaintEventArgs paintEventArgs)
        {
            switch ((ColumnId)paintEventArgs.SubItemId)
            {
            case ColumnId.Id:
                paintEventArgs.PaintText(DataContext.Id.ToString());
                break;

            case ColumnId.Name:
                paintEventArgs.PaintText(DataContext.Name);
                break;

            case ColumnId.Description:
                paintEventArgs.PaintText(DataContext.Description);
                break;

            case ColumnId.Identifier:
                paintEventArgs.PaintText(DataContext.Identifier);
                break;

            case ColumnId.CreatedOn:
                DateColumn.OnPaintSubItem(paintEventArgs, DataContext.CreatedOn);
                break;

            case ColumnId.UpdatedOn:
                DateColumn.OnPaintSubItem(paintEventArgs, DataContext.UpdatedOn);
                break;
            }
        }
 public UserFilter()
 {
     this.Id        = new IntegerColumn("Id");
     this.FirstName = new TextColumn("FirstName");
     this.LastName  = new TextColumn("LastName");
     this.Type      = new IntegerColumn("UserTypeId");
     this.Create    = new DateColumn("CreateDate");
 }
示例#7
0
 public PostFilter()
 {
     Id          = new IntegerColumn("Id");
     AuthorId    = new IntegerColumn("AuthorId");
     Title       = new TextColumn("Title");
     Status      = new IntegerColumn("StatusId");
     CreatedOn   = new DateColumn("CreateDate");
     PublishedOn = new DateColumn("PublishDate");
 }
示例#8
0
 public static void PaintOptionalContent(DateTime?date, SubItemPaintEventArgs paintEventArgs)
 {
     if (!date.HasValue)
     {
         PaintGrayText(Resources.StrsUnassigned.SurroundWith('<', '>'), paintEventArgs);
     }
     else
     {
         DateColumn.OnPaintSubItem(paintEventArgs, date.Value);
     }
 }
示例#9
0
        private static Size MeasureOptionalContent(DateTime?date, SubItemMeasureEventArgs measureEventArgs)
        {
            string text;

            if (!date.HasValue)
            {
                text = Resources.StrsUnassigned.SurroundWith('<', '>');
                return(measureEventArgs.MeasureText(text));
            }
            else
            {
                return(DateColumn.OnMeasureSubItem(measureEventArgs, date.Value));
            }
        }
        private void OnForecastTypePropertyChanged()
        {
            OnPropertyChanged(() => SelectedForecastType);
            OnPropertyChanged(() => Color);
            OnPropertyChanged(() => Letter);
            OnPropertyChanged(() => ForecastTypeName);

            UpdateDedicatedHours();

            OnPropertyChanged(() => SupportsDedicatedHours);
            DateColumn.CalculateTotal();
            EnableClientHours();
            ForecastTypeRegistrationChanged.OnNext(this);
        }
示例#11
0
        /// <summary>
        /// Raises the <see cref="ColumnChanged" /> event.
        /// </summary>
        /// <param name="column">The <see cref="DateColumn"/> which has raised the event.</param>
        /// <param name="value">The changed value.</param>
        public virtual void OnColumnChanged(DateColumn column, object value)
        {
            if (!SuppressEntityEvents)
            {
                DateEventHandler handler = ColumnChanged;
                if (handler != null)
                {
                    handler(this, new DateEventArgs(column, value));
                }

                // warn the parent list that i have changed
                OnEntityChanged();
            }
        }
示例#12
0
        /// <summary>
        /// Raises the <see cref="ColumnChanging" /> event.
        /// </summary>
        /// <param name="column">The <see cref="DateColumn"/> which has raised the event.</param>
        /// <param name="value">The changed value.</param>
        public virtual void OnColumnChanging(DateColumn column, object value)
        {
            if (IsEntityTracked && EntityState != EntityState.Added && !EntityManager.TrackChangedEntities)
            {
                EntityManager.StopTracking(entityTrackingKey);
            }

            if (!SuppressEntityEvents)
            {
                DateEventHandler handler = ColumnChanging;
                if (handler != null)
                {
                    handler(this, new DateEventArgs(column, value));
                }
            }
        }
        public ActionResult InsertColumn()
        {
            Ext.Net.GridPanel grid = this.GetCmp <Ext.Net.GridPanel>("GridPanel1");

            DateColumn col = new DateColumn
            {
                Text      = "Last Updated",
                Width     = 85,
                Sortable  = true,
                DataIndex = "lastChange",
                Format    = "M/d/yyyy"
            };

            grid.InsertColumn(1, col);

            return(this.Direct());
        }
示例#14
0
        /// <summary>
        /// Determines whether the property value has changed from the original data.
        /// </summary>
        /// <param name="column">The column.</param>
        /// <returns>
        ///     <c>true</c> if the property value has changed; otherwise, <c>false</c>.
        /// </returns>
        public bool IsPropertyChanged(DateColumn column)
        {
            switch (column)
            {
            case DateColumn.Id:
                return(entityData.Id != _originalData.Id);

            case DateColumn.OrgDate:
                return(entityData.OrgDate != _originalData.OrgDate);

            case DateColumn.Complete:
                return(entityData.Complete != _originalData.Complete);

            default:
                return(false);
            }
        }
示例#15
0
        /// <summary>
        /// 构建网格列  DateColumn
        /// </summary>
        /// <param name="column"></param>
        /// <returns></returns>
        private DateColumn IniGridDateColumn(GridColumn column)
        {
            if (column.ColumnType != GridColumnType.Date)
            {
                return(null);
            }
            DateColumn cell = new DateColumn();

            if (string.IsNullOrWhiteSpace(column.ColumnFormt))
            {
                cell.Format = "yyyy-MM-dd HH:mm:ss";
            }
            else
            {
                cell.Format = column.ColumnFormt;
            }
            return(cell);
        }
        private static string Handle(DateColumn column)
        {
            var query = string.Empty;

            if (column.Operator == DateColumn.Operators.None)
            {
                return(query);
            }

            if (column.Operator == DateColumn.Operators.EqualTo)
            {
                query = string.Format(" AND ({0} >= '{1} 00:00:00.000' AND {0} < '{2} 00:00:00.000')", column.Name, column.Value.ToString("yyyy-MM-dd"), column.Value.AddDays(1).ToString("yyyy-MM-dd"));
            }

            if (column.Operator == DateColumn.Operators.Between)
            {
                query = string.Format(" AND ({0} BETWEEN '{1} 00:00:00.000' AND '{2} 00:00:00.000')", column.Name, column.From.ToString("yyyy-MM-dd"), column.To.ToString("yyyy-MM-dd"));
            }

            return(query);
        }
示例#17
0
        protected override Size OnMeasureSubItem(SubItemMeasureEventArgs measureEventArgs)
        {
            switch ((ColumnId)measureEventArgs.SubItemId)
            {
            case ColumnId.Id:
                return(measureEventArgs.MeasureText(DataContext.Id));

            case ColumnId.Status:
                return(measureEventArgs.MeasureImageAndText(StatusImage, DataContext.Status.ToString()));

            case ColumnId.Number:
                return(measureEventArgs.MeasureText(DataContext.Number));

            case ColumnId.StartDate:
                return(DateColumn.OnMeasureSubItem(measureEventArgs, DataContext.StartDate));

            case ColumnId.WebUrl:
                return(measureEventArgs.MeasureText(DataContext.WebUrl));

            default:
                return(Size.Empty);
            }
        }
示例#18
0
 ///<summary>
 /// Initalizes a new Instance of the DateEventArgs class.
 ///</summary>
 public DateEventArgs(DateColumn column, object value)
 {
     this.column = column;
     this.value  = value;
 }
示例#19
0
 ///<summary>
 /// Initalizes a new Instance of the DateEventArgs class.
 ///</summary>
 public DateEventArgs(DateColumn column)
 {
     this.column = column;
 }
示例#20
0
 public ColumnAdder<DateResult> Column(DateColumn column)
 {
     return new ColumnAdder<DateResult>(this, column);
 }
    private void LoadColumnForGrid(DataTable table)
    {
        string[] headerColumn      = ("" + ColumnHeader).Split(',');
        string[] widthList         = ("" + ColumnWidth).Split(',');
        string[] render            = ("" + Render).Split(',');
        int      columnCount       = table.Columns.Count;
        bool     usingHeaderColumn = (headerColumn.Count() == columnCount);

        if (!string.IsNullOrEmpty(LockedColumn))
        {
            Ext.Net.LockingGridView lkv = new LockingGridView()
            {
                ID = "lkv",
            };
            GridPanel1.View.Add(lkv);
        }
        else if (!string.IsNullOrEmpty(GroupField))
        {
            Ext.Net.GroupingView group = new GroupingView()
            {
                ID                = "GroupingView1",
                ForceFit          = false,
                MarkDirty         = false,
                ShowGroupName     = false,
                EnableNoGroups    = true,
                HideGroupedColumn = HideGrouped
            };
            GridPanel1.View.Add(group);
        }
        for (int i = 0; i < columnCount; i++)
        {
            if (table.Columns[i].ColumnName == IDProperty && DisplayPrimaryColumn == false)
            {
                continue;
            }
            switch (table.Columns[i].DataType.ToString())
            {
            case "System.Boolean":
                string _render = GetRender(render, table.Columns[i].ColumnName);
                if (!string.IsNullOrEmpty(_render))
                {
                    Column _column = new Column();
                    _column.ColumnID    = table.Columns[i].ColumnName;
                    _column.DataIndex   = table.Columns[i].ColumnName;
                    _column.Header      = usingHeaderColumn ? headerColumn[i].Trim() : table.Columns[i].ColumnName;
                    _column.Locked      = GetLockingStatus(table.Columns[i].ColumnName);
                    _column.Width       = GetColumnWidth(widthList, table.Columns[i].ColumnName);
                    _column.Renderer.Fn = _render;
                    GridPanel1.ColumnModel.Columns.Add(_column);
                }
                else
                {
                    CheckColumn chkColumn = new CheckColumn();
                    chkColumn.ColumnID  = table.Columns[i].ColumnName;
                    chkColumn.DataIndex = table.Columns[i].ColumnName;
                    chkColumn.Header    = usingHeaderColumn ? headerColumn[i].Trim() : table.Columns[i].ColumnName;
                    chkColumn.Locked    = GetLockingStatus(table.Columns[i].ColumnName);
                    chkColumn.Width     = GetColumnWidth(widthList, table.Columns[i].ColumnName);
                    GridPanel1.ColumnModel.Columns.Add(chkColumn);
                }
                break;

            case "System.DateTime":
                DateColumn dcolumn = new DateColumn();
                dcolumn.ColumnID  = table.Columns[i].ColumnName;
                dcolumn.DataIndex = table.Columns[i].ColumnName;
                dcolumn.Header    = usingHeaderColumn ? headerColumn[i].Trim() : table.Columns[i].ColumnName;
                dcolumn.Format    = "dd/MM/yyyy";
                dcolumn.Locked    = GetLockingStatus(table.Columns[i].ColumnName);
                dcolumn.Width     = GetColumnWidth(widthList, table.Columns[i].ColumnName);
                GridPanel1.ColumnModel.Columns.Add(dcolumn);
                break;

            default:
                Column column = new Column();
                column.ColumnID    = table.Columns[i].ColumnName;
                column.DataIndex   = table.Columns[i].ColumnName;
                column.Header      = usingHeaderColumn ? headerColumn[i].Trim() : table.Columns[i].ColumnName;
                column.Locked      = GetLockingStatus(table.Columns[i].ColumnName);
                column.Width       = GetColumnWidth(widthList, table.Columns[i].ColumnName);
                column.Renderer.Fn = GetRender(render, table.Columns[i].ColumnName);     //"RenderHightLight";
                GridPanel1.ColumnModel.Columns.Add(column);
                break;
            }
        }
    }
示例#22
0
 /// <summary>
 /// Raises the <see cref="ColumnChanged" /> event.
 /// </summary>
 /// <param name="column">The <see cref="DateColumn"/> which has raised the event.</param>
 public virtual void OnColumnChanged(DateColumn column)
 {
     OnColumnChanged(column, null);
     return;
 }
示例#23
0
        void ReleaseDesignerOutlets()
        {
            if (AddMediaCompletion != null)
            {
                AddMediaCompletion.Dispose();
                AddMediaCompletion = null;
            }

            if (AddMediaCreator != null)
            {
                AddMediaCreator.Dispose();
                AddMediaCreator = null;
            }

            if (AddMediaDate != null)
            {
                AddMediaDate.Dispose();
                AddMediaDate = null;
            }

            if (AddMediaLanguage != null)
            {
                AddMediaLanguage.Dispose();
                AddMediaLanguage = null;
            }

            if (AddMediaMedia != null)
            {
                AddMediaMedia.Dispose();
                AddMediaMedia = null;
            }

            if (AddMediaRating != null)
            {
                AddMediaRating.Dispose();
                AddMediaRating = null;
            }

            if (AddMediaTitle != null)
            {
                AddMediaTitle.Dispose();
                AddMediaTitle = null;
            }

            if (CreatorColumn != null)
            {
                CreatorColumn.Dispose();
                CreatorColumn = null;
            }

            if (DateColumn != null)
            {
                DateColumn.Dispose();
                DateColumn = null;
            }

            if (StatusColumn != null)
            {
                StatusColumn.Dispose();
                StatusColumn = null;
            }

            if (DeleteColumn != null)
            {
                DeleteColumn.Dispose();
                DeleteColumn = null;
            }

            if (ForceSyncOption != null)
            {
                ForceSyncOption.Dispose();
                ForceSyncOption = null;
            }

            if (GoodreadsAuthURL != null)
            {
                GoodreadsAuthURL.Dispose();
                GoodreadsAuthURL = null;
            }

            if (GoodreadsLoginName != null)
            {
                GoodreadsLoginName.Dispose();
                GoodreadsLoginName = null;
            }

            if (GoodreadsSyncType != null)
            {
                GoodreadsSyncType.Dispose();
                GoodreadsSyncType = null;
            }

            if (GoodreadsVerify != null)
            {
                GoodreadsVerify.Dispose();
                GoodreadsVerify = null;
            }

            if (HardReset != null)
            {
                HardReset.Dispose();
                HardReset = null;
            }

            if (LanguageColumn != null)
            {
                LanguageColumn.Dispose();
                LanguageColumn = null;
            }

            if (MediaColumn != null)
            {
                MediaColumn.Dispose();
                MediaColumn = null;
            }

            if (MediaTable != null)
            {
                MediaTable.Dispose();
                MediaTable = null;
            }

            if (RatingColumn != null)
            {
                RatingColumn.Dispose();
                RatingColumn = null;
            }

            if (SearchMediaField != null)
            {
                SearchMediaField.Dispose();
                SearchMediaField = null;
            }

            if (SearchMediaSearch != null)
            {
                SearchMediaSearch.Dispose();
                SearchMediaSearch = null;
            }

            if (TitleColumn != null)
            {
                TitleColumn.Dispose();
                TitleColumn = null;
            }

            if (UnlockReset != null)
            {
                UnlockReset.Dispose();
                UnlockReset = null;
            }
        }
示例#24
0
        private void InitModel()
        {
            if (this.ItemType != null)
            {
                Model          item       = new Model();
                PropertyInfo[] infoArray2 = this.ItemType.GetProperties();
                GridFilters    filters    = new GridFilters();
                filters.MenuFilterText = "搜索";
                filters.ID             = "filters" + ID;
                for (int i = 0; i < infoArray2.Length; i++)
                {
                    Func <ColumnBase, bool> predicate = null;
                    PropertyInfo            property  = infoArray2[i];
                    ModelField field = new ModelField
                    {
                        Name = property.Name
                    };
                    #region  射字段类型
                    string fullName = property.PropertyType.FullName;
                    if (fullName.Contains("System.Int"))
                    {
                        var enumDataTypeAttr = AttributeHelper.GetAttribute <EnumDataTypeAttribute>(property);
                        if (enumDataTypeAttr == null)
                        {
                            field.Type = ModelFieldType.Int;
                        }
                    }
                    else if (fullName.Contains("System.DateTime"))
                    {
                        field.Type = ModelFieldType.Date;
                    }
                    else if (fullName.Contains("System.Single"))
                    {
                        field.Type = ModelFieldType.Float;
                    }
                    else if (fullName.Contains("System.Boolean"))
                    {
                        field.Type = ModelFieldType.Boolean;
                    }
                    else if (fullName.Contains("System.String"))
                    {
                        field.Type = ModelFieldType.String;
                    }
                    else if (!property.PropertyType.IsPrimitive)
                    {
                        field.Type = ModelFieldType.Object;
                    }
                    else
                    {
                        field.Type = ModelFieldType.Auto;
                    }
                    #endregion
                    item.Fields.Add(field);

                    if (predicate == null)
                    {
                        predicate = x => x.DataIndex == property.Name;
                    }
                    ColumnBase column = this.ColumnModel.Columns.FirstOrDefault <ColumnBase>(predicate);
                    if (column == null)
                    {
                        ColumnBase base2;
                        DataGridColumnAttribute displayAttr = AttributeHelper.GetAttribute <DataGridColumnAttribute>(property);
                        FilterAttribute         filterAttr  = AttributeHelper.GetAttribute <FilterAttribute>(property);
                        bool       simpleFilterable         = filterAttr != null && filterAttr.Enabled && filterAttr.FilterType == null;
                        GridFilter filter = null;
                        #region  射列类型
                        if (fullName.Contains("System.Int") ||
                            fullName.Contains("System.Single") ||
                            fullName.Contains("System.Decimal") ||
                            fullName.Contains("System.Double"))
                        {
                            NumberColumn column1 = new NumberColumn
                            {
                                Format = this.GetFormat(displayAttr, "0")
                            };
                            base2 = column1;
                            if (simpleFilterable && filterAttr.FilterType == null)
                            {
                                filter = new NumericFilter();
                            }
                        }
                        else if (fullName.Contains("System.DateTime"))
                        {
                            DateColumn column2 = new DateColumn
                            {
                                Format = this.GetFormat(displayAttr, "Y-m-d")
                            };
                            base2 = column2;
                            if (simpleFilterable)
                            {
                                filter = new DateFilter()
                                {
                                    AfterText  = "在这之后",
                                    BeforeText = "在这之前",
                                    OnText     = "在这天"
                                };
                            }
                        }
                        else if (fullName.Contains("System.Boolean"))
                        {
                            string[]      strArray = this.GetFormat(displayAttr, "是|否").Split(new char[] { '|' });
                            BooleanColumn column4  = new BooleanColumn
                            {
                                TrueText  = strArray[0],
                                FalseText = strArray[1]
                            };
                            base2 = column4;
                            if (simpleFilterable)
                            {
                                filter = new BooleanFilter()
                                {
                                    NoText  = strArray[1],
                                    YesText = strArray[0]
                                };
                            }
                        }
                        else if (fullName.Contains("System.String"))
                        {
                            base2 = new Column();
                            if (simpleFilterable)
                            {
                                filter = new StringFilter();
                            }
                        }
                        else if (!property.PropertyType.IsPrimitive)
                        {
                            base2 = new Column();
                            if (simpleFilterable)
                            {
                                filter = new StringFilter();
                            }
                        }
                        else
                        {
                            base2 = new Column();
                            if (simpleFilterable)
                            {
                                filter = new StringFilter();
                            }
                        }
                        #endregion
                        #region 生成外键过滤器
                        if (filterAttr != null && filterAttr.Enabled && filterAttr.FilterType != null)
                        {
                            Store store = new Store();
                            store.ID = "filterStore" + property.Name;
                            if (filterAttr.FilterType.IsEnum)
                            {
                                var valueType = filterAttr.FilterType;
                                var values    = Enum.GetValues(valueType);
                                var names     = Enum.GetNames(valueType);
                                List <KeyValueModel> enumDict = new List <KeyValueModel>();
                                for (int it = 0; it < values.Length; it++)
                                {
                                    var fieldInfo = valueType.GetField(names[it]);
                                    var descAttr  = AttributeHelper.GetAttribute <DescriptionAttribute>(fieldInfo);
                                    if (descAttr == null)
                                    {
                                        throw new Exception("枚举必须要有Description");
                                    }
                                    int key = (int)values.GetValue(it);
                                    enumDict.Add(new KeyValueModel()
                                    {
                                        Id   = key,
                                        Name = descAttr.Description
                                    });
                                }
                                Model model = new Model();
                                model.Fields.Add(new ModelField("Id", ModelFieldType.Int));
                                model.Fields.Add(new ModelField("Name", ModelFieldType.String));
                                store.Model.Add(model);
                                store.DataSource = enumDict;
                                store.DataBind();
                                filter = new ListFilter()
                                {
                                    StoreID    = store.ID,
                                    Single     = true,
                                    IDField    = "Id",
                                    LabelField = "Name"
                                };
                            }
                            else
                            {
                                var filterObject = Activator.CreateInstance(filterAttr.FilterType);
                                var filterGen    = filterObject as ForeignFilterBase;
                                if (filterGen == null)
                                {
                                    throw new ArgumentException("FilterAttribute中的FilterType的类型必须为ForeignFilterBase的子类或枚举类型");
                                }
                                store.Model.Add(filterGen.GetModel());
                                store.DataSource = filterGen.GetData();
                                store.DataBind();
                                filter = new ListFilter()
                                {
                                    StoreID    = store.ID,
                                    Single     = true,
                                    IDField    = filterGen.IdField,
                                    LabelField = filterGen.LabelField
                                };
                            }
                            Bin.Add(store);
                        }
                        #endregion
                        base2.Text      = (displayAttr == null) ? property.Name : displayAttr.DisplayName;
                        base2.DataIndex = property.Name;
                        if (displayAttr != null && displayAttr.Width != -1)
                        {
                            base2.Width = displayAttr.Width;
                        }
                        if (displayAttr != null && displayAttr.ValueType != null)
                        {
                            Type valueType = displayAttr.ValueType;
                            var  values    = Enum.GetValues(valueType);
                            var  names     = Enum.GetNames(valueType);
                            Dictionary <int, string> enumDict  = new Dictionary <int, string>();
                            List <string>            valueList = new List <string>();
                            for (int it = 0; it < values.Length; it++)
                            {
                                var fieldInfo = valueType.GetField(names[it]);
                                var descAttr  = AttributeHelper.GetAttribute <DescriptionAttribute>(fieldInfo);
                                int key       = (int)values.GetValue(it);
                                enumDict.Add(key, descAttr.Description);
                                valueList.Add("values[" + key + "]=\"" + (descAttr != null ? descAttr.Description : names[it]) + "\";");
                            }

                            base2.Renderer.Fn = "function(){var values=Array();" + string.Join(string.Empty, valueList) + "return values[arguments[0]];}";
                        }
                        if (filter != null)
                        {
                            filter.DataIndex = property.Name;
                            filters.Filters.Add(filter);
                        }
                        column = base2;
                        this.ColumnModel.Columns.Add(base2);
                    }
                    column.TabIndex = (short)i;
                }
                Features.Add(filters);
                if (this.ColumnModel.Columns.Count >= 10)
                {
                    this.AutoScroll = true;
                }
                var list = ColumnModel.Columns.OrderBy(x => x.TabIndex).ToList();
                ColumnModel.Columns.Clear();
                ColumnModel.Columns.AddRange(list);
                this._store.Model.Add(item);
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (BlackList != null)
            {
                BlackList.Dispose();
                BlackList = null;
            }

            if (DateColumn != null)
            {
                DateColumn.Dispose();
                DateColumn = null;
            }

            if (FollowList != null)
            {
                FollowList.Dispose();
                FollowList = null;
            }

            if (LikeList != null)
            {
                LikeList.Dispose();
                LikeList = null;
            }

            if (MessageColumn != null)
            {
                MessageColumn.Dispose();
                MessageColumn = null;
            }

            if (MessageTable != null)
            {
                MessageTable.Dispose();
                MessageTable = null;
            }

            if (SectionColumn != null)
            {
                SectionColumn.Dispose();
                SectionColumn = null;
            }

            if (interval != null)
            {
                interval.Dispose();
                interval = null;
            }

            if (maxAutomatic != null)
            {
                maxAutomatic.Dispose();
                maxAutomatic = null;
            }

            if (maxCancel != null)
            {
                maxCancel.Dispose();
                maxCancel = null;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (ActionsColumn != null)
            {
                ActionsColumn.Dispose();
                ActionsColumn = null;
            }

            if (AmountColumn != null)
            {
                AmountColumn.Dispose();
                AmountColumn = null;
            }

            if (AmountForm != null)
            {
                AmountForm.Dispose();
                AmountForm = null;
            }

            if (BalanceTable != null)
            {
                BalanceTable.Dispose();
                BalanceTable = null;
            }

            if (DateColumn != null)
            {
                DateColumn.Dispose();
                DateColumn = null;
            }

            if (DateForm != null)
            {
                DateForm.Dispose();
                DateForm = null;
            }

            if (DescColumn != null)
            {
                DescColumn.Dispose();
                DescColumn = null;
            }

            if (DescForm != null)
            {
                DescForm.Dispose();
                DescForm = null;
            }

            if (InitialLabel != null)
            {
                InitialLabel.Dispose();
                InitialLabel = null;
            }

            if (TotalLabel != null)
            {
                TotalLabel.Dispose();
                TotalLabel = null;
            }
        }
        public ActionResult InsertColumn()
        {
            Ext.Net.GridPanel grid = this.GetCmp<Ext.Net.GridPanel>("GridPanel1");

            DateColumn col = new DateColumn
            {
                Text = "Last Updated",
                Width = 85,
                Sortable = true,
                DataIndex = "lastChange",
                Format = "M/d/yyyy"
            };

            grid.InsertColumn(1, col);

            return this.Direct();
        }
示例#28
0
 public InitializedTestTable()
     : base("MyTable")
 {
     DateColumn = new DateColumn(this, "MyDateColumn");
     DateTimeColumn = new DateTimeColumn(this, "MyDateTimeColumn");
     DecimalColumn = new DecimalColumn(this, "MyDecimalColumn");
     DoubleColumn = new DoubleColumn(this, "MyDoubleColumn");
     IntColumn = new IntColumn(this, "MyIntColumn");
     StringColumn = new StringColumn(this, "MyStringColumn");
 }
示例#29
0
        void ReleaseDesignerOutlets()
        {
            if (ClickedLabel != null)
            {
                ClickedLabel.Dispose();
                ClickedLabel = null;
            }

            if (SectorsTable != null)
            {
                SectorsTable.Dispose();
                SectorsTable = null;
            }

            if (AirlineColumn != null)
            {
                AirlineColumn.Dispose();
                AirlineColumn = null;
            }

            if (FlightNumberColumn != null)
            {
                FlightNumberColumn.Dispose();
                FlightNumberColumn = null;
            }

            if (DateColumn != null)
            {
                DateColumn.Dispose();
                DateColumn = null;
            }

            if (FromColumn != null)
            {
                FromColumn.Dispose();
                FromColumn = null;
            }

            if (ToColumn != null)
            {
                ToColumn.Dispose();
                ToColumn = null;
            }

            if (DistanceColumn != null)
            {
                DistanceColumn.Dispose();
                DistanceColumn = null;
            }

            if (CabinColumn != null)
            {
                CabinColumn.Dispose();
                CabinColumn = null;
            }

            if (SeatColumn != null)
            {
                SeatColumn.Dispose();
                SeatColumn = null;
            }

            if (AircraftColumn != null)
            {
                AircraftColumn.Dispose();
                AircraftColumn = null;
            }
        }
        public void BuildGrid()
        {
            Ext.Net.GridView gridView;
            if (String.IsNullOrEmpty(this.columnExpand))
            {
                gridView = new Ext.Net.GridView();
            }
            else
            {
                gridView = new Ext.Net.GridView
                {
                    Configs = { ForceFit = true }
                };
            }

            if (ReadOnly == true)
            {
                foreach (LookupFormatData fmtData in this.dataTemplate)
                {
                    fmtData.ReadOnly = ReadOnly;
                }
            }

            foreach (LookupFormatData fmtData in this.dataTemplate)
            {
                fmtData.ID = fmtData.ID != "" ? fmtData.ID : fmtData.FieldName;
                if (fmtData.EditControl != null)
                {
                    Column colCbo = new Column
                    {
                        ID        = String.Format("{0}ColID", fmtData.ID),
                        DataIndex = fmtData.FieldName,
                        Text      = fmtData.FieldTitle,
                        Width     = fmtData.ColWidth,
                        Hidden    = fmtData.ColWidth == 0
                    };
                    if (String.Equals(fmtData.FieldName, this.columnExpand))
                    {
                        colCbo.Flex = 1;
                    }
                    //Makeup for option string
                    if (fmtData.IsRenderer)
                    {
                        string           funcRenderer = fmtData.FnRenderer;
                        Ext.Net.Renderer rd           = new Renderer {
                            Fn = SCOPE + "." + funcRenderer
                        };
                        colCbo.Renderer = rd;
                    }

                    if (!fmtData.ReadOnly)
                    {
                        colCbo.Editor.Add(fmtData.EditControl);
                    }
                    this.ColumnModel.Columns.Add(colCbo);
                }
                else if (fmtData.EditControl == null)
                {
                    switch (fmtData.Type)
                    {
                    case ModelFieldType.String:
                        #region String
                        Column colText = new Column
                        {
                            ID        = String.Format("{0}ColID", fmtData.ID),
                            DataIndex = fmtData.FieldName,
                            Text      = fmtData.FieldTitle,
                            Width     = fmtData.ColWidth,
                            Hidden    = fmtData.ColWidth == 0,
                            Align     = Alignment.Left
                        };
                        if (String.Equals(fmtData.FieldName, this.columnExpand))
                        {
                            colText.Flex = 1;
                        }
                        if (fmtData.IsRenderer)
                        {
                            string           funcRenderer = fmtData.FnRenderer;
                            Ext.Net.Renderer rd           = new Renderer {
                                Fn = SCOPE + "." + funcRenderer
                            };
                            colText.Renderer = rd;
                        }
                        if (!fmtData.ReadOnly == true)
                        {
                            TextField textEditor = new TextField
                            {
                                SelectOnFocus = true,
                                //AllowBlank = false,
                                //BlankText = "Not blank",
                                MsgTarget = MessageTarget.Side
                            };

                            if (fmtData.MaxLength > 0)
                            {
                                textEditor.MaxLength     = fmtData.MaxLength;
                                textEditor.MaxLengthText = String.Format("Chiều dài tối đa là {0} kí tự", textEditor.MaxLength);
                            }
                            if (fmtData.AllowBlank == false)
                            {
                                textEditor.AllowBlank = false;
                                textEditor.BlankText  = String.Format("Trường bắt buộc nhập giá trị");
                            }

                            colText.Editor.Add(textEditor);
                        }

                        this.ColumnModel.Columns.Add(colText);
                        #endregion
                        break;

                    case ModelFieldType.Boolean:
                        #region Boolean
                        CheckColumn colBool = new CheckColumn
                        {
                            ID        = String.Format("{0}ColID", fmtData.ID),
                            DataIndex = fmtData.FieldName,
                            Text      = fmtData.FieldTitle,
                            Width     = fmtData.ColWidth,
                            Hidden    = fmtData.ColWidth == 0,
                            Editable  = false,
                            Align     = Alignment.Center
                        };
                        if (String.Equals(fmtData.FieldName, this.columnExpand))
                        {
                            colBool.Flex = 1;
                        }
                        if (!fmtData.ReadOnly == true)
                        {
                            colBool.Editable = true;
                            //TextField cbEditor = new TextField { SelectOnFocus = true };
                            //Ext.Net.Checkbox cbEditor = new Checkbox { Cls = "x-grid-checkheader-editor" };
                            //colBool.Editor.Add(cbEditor);
                        }
                        this.ColumnModel.Columns.Add(colBool);
                        #endregion
                        break;

                    case ModelFieldType.Date:
                        #region Date
                        DateColumn colDate = new DateColumn
                        {
                            ID        = String.Format("{0}ColID", fmtData.ID),
                            DataIndex = fmtData.FieldName,
                            Text      = fmtData.FieldTitle,
                            Width     = fmtData.ColWidth,
                            Hidden    = fmtData.ColWidth == 0,
                            Format    = "dd/MM/yyyy",
                            Align     = Alignment.Center
                        };
                        if (String.Equals(fmtData.FieldName, this.columnExpand))
                        {
                            colDate.Flex = 1;
                        }
                        if (!fmtData.ReadOnly == true)
                        {
                            DateField dateEditor = new DateField
                            {
                                ID            = String.Format("{0}_{1}_dateEditor", this.ClientID, fmtData.FieldName),
                                Format        = "dd/MM/yyyy",
                                Vtype         = "daterange",
                                SelectOnFocus = true
                            };
                            colDate.Editor.Add(dateEditor);
                        }
                        //                            colDate.Renderer.Handler = @"if(value == 'Mon Jan 01 1 07:00:00 GMT+0700 (SE Asia Standard Time)')
                        //                                           {return null;}
                        //                                           else{return Ext.Date.format(value, 'd/m/Y');}";
                        this.ColumnModel.Columns.Add(colDate);
                        #endregion
                        break;

                    case ModelFieldType.Float:
                        #region Float
                        NumberColumn colFloat = new NumberColumn
                        {
                            ID        = String.Format("{0}ColID", fmtData.ID),
                            DataIndex = fmtData.FieldName,
                            Text      = fmtData.FieldTitle,
                            Width     = fmtData.ColWidth,
                            Hidden    = fmtData.ColWidth == 0,
                            Format    = "0.00/i",
                            Align     = Alignment.Right,
                        };
                        if (!String.IsNullOrEmpty(fmtData.Format))
                        {
                            colFloat.Format = fmtData.Format;
                        }
                        if (String.Equals(fmtData.FieldName, this.columnExpand))
                        {
                            colFloat.Flex = 1;
                        }
                        if (!fmtData.ReadOnly == true)
                        {
                            //phongdd-100
                            //TextField textEdit = new TextField { StyleSpec = "text-align:right;vertical-align:bottom", SelectOnFocus = true };
                            NumberField FloatEditInt = new NumberField
                            {
                                StyleSpec        = "text-align:right;vertical-align:bottom",
                                SelectOnFocus    = true,
                                MinValue         = 0,
                                AllowDecimals    = true,
                                DecimalPrecision = 3
                            };
                            //end phongdd-100
                            colFloat.Editor.Add(FloatEditInt);
                        }
                        this.ColumnModel.Columns.Add(colFloat);
                        #endregion
                        break;

                    case ModelFieldType.Int:
                        #region Number
                        NumberColumn colNumber = new NumberColumn
                        {
                            ID        = String.Format("{0}ColID", fmtData.ID),
                            DataIndex = fmtData.FieldName,
                            Text      = fmtData.FieldTitle,
                            Width     = fmtData.ColWidth,
                            Hidden    = fmtData.ColWidth == 0,
                            Align     = Alignment.Right,
                        };
                        if (!String.IsNullOrEmpty(fmtData.Format))
                        {
                            colNumber.Format = fmtData.Format;
                        }
                        if (String.Equals(fmtData.FieldName, this.columnExpand))
                        {
                            colNumber.Flex = 1;
                        }
                        //Bat buoc go dau phay
                        if (!fmtData.ReadOnly == true)
                        {
                            //phongdd-100
                            //TextField textEditInt = new TextField { StyleSpec = "text-align:right;vertical-align:bottom", SelectOnFocus = true };
                            NumberField textEditInt = new NumberField {
                                StyleSpec = "text-align:right;vertical-align:bottom", SelectOnFocus = true, MinValue = 0, AllowDecimals = true
                            };
                            //end phongdd-100
                            colNumber.Editor.Add(textEditInt);
                        }
                        this.ColumnModel.Columns.Add(colNumber);
                        #endregion
                        break;

                    default:
                        #region auto
                        Column colAuto = new Column
                        {
                            ID        = String.Format("{0}ColID", fmtData.ID),
                            DataIndex = fmtData.FieldName,
                            Text      = fmtData.FieldTitle,
                            Width     = fmtData.ColWidth,
                            Hidden    = fmtData.ColWidth == 0,
                            Align     = Alignment.Left
                        };
                        if (String.Equals(fmtData.FieldName, this.columnExpand))
                        {
                            colAuto.Flex = 1;
                        }
                        if (fmtData.ReadOnly == true)
                        {
                            TextField textEditAuto = new TextField {
                                StyleSpec = "text-align:right;vertical-align:bottom", SelectOnFocus = true
                            };
                            colAuto.Editor.Add(textEditAuto);
                        }
                        this.ColumnModel.Columns.Add(colAuto);
                        #endregion
                        break;
                    }
                }
            }
            this.toolTip = new ToolTip
            {
                Delegate   = ".x-grid3-cell",
                TrackMouse = true,
            };
            this.Plugins.Add(new CellEditing {
                ClicksToEdit = 1
            });
            this.ToolTips.Add(toolTip);
            this.SelectionModel.Add(new CellSelectionModel {
            });
            this.View.Add(gridView);
        }
示例#31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:DateComparer"/> class.
 /// </summary>
 /// <param name="column">The column to sort on.</param>
 public DateComparer(DateColumn column)
 {
     this.whichComparison = column;
 }
示例#32
0
        public void CreateGridColumns()
        {
            // ID
            //DataGridViewTextBoxColumn idCol = new DataGridViewTextBoxColumn();
            //idCol.Name = "ID";
            //idCol.Visible = false;

            // Date
            DateColumn dateCol = new DateColumn();

            dateCol.Name = "Date";

            // Account
            DataGridViewTextBoxColumn accCol = new DataGridViewTextBoxColumn();

            accCol.Name    = "Account";
            accCol.Visible = false;

            // Payee
            DataGridViewComboBoxColumn payCol = new DataGridViewComboBoxColumn();

            payCol.ValueType     = typeof(Payee);
            payCol.DisplayMember = "Name";
            payCol.DataSource    = DataHelper.GetPayees();
            payCol.Name          = "Payee";

            // Category
            DataGridViewComboBoxColumn catCol = new DataGridViewComboBoxColumn();

            catCol.ValueType     = typeof(Category);
            catCol.DisplayMember = "Name";
            catCol.DataSource    = DataHelper.GetCategories();
            catCol.Name          = "Category";

            // Outflow
            // TODO: Numerical CellTemplate
            DataGridViewTextBoxColumn outCol = new DataGridViewTextBoxColumn();

            outCol.Name = "Outflow";

            // Inflow
            // TODO: Numerical CellTemplate
            DataGridViewTextBoxColumn inCol = new DataGridViewTextBoxColumn();

            inCol.Name = "Inflow";

            // IsDone
            DataGridViewCheckBoxColumn doneCol = new DataGridViewCheckBoxColumn();

            doneCol.Name = "Done?";

            //this.dgEntries.Columns.Add(idCol);
            this.dgEntries.Columns.Add(dateCol);
            this.dgEntries.Columns.Add(payCol);
            this.dgEntries.Columns.Add(catCol);
            this.dgEntries.Columns.Add(outCol);
            this.dgEntries.Columns.Add(inCol);
            this.dgEntries.Columns.Add(doneCol);

            //this.dgEntries.Columns.AddRange(idCol, dateCol, payCol, catCol, outCol, inCol, doneCol);
        }
示例#33
0
        public virtual ColumnBase CreateColumn()
        {
            ColumnBase column;

            if (HasChildren)
            {
                column = new Column {
                    Text = Header
                };

                if (ConfigureColumnHandler != null)
                {
                    ConfigureColumnHandler(column);
                }

                return(column);
            }

            var editor = CreateEditor();

            if (CreateColumnHandler != null)
            {
                column = CreateColumnHandler(this);
                if (editor != null)
                {
                    column.Editor.Add(editor);
                }

                if (ConfigureColumnHandler != null)
                {
                    ConfigureColumnHandler(column);
                }

                return(column);
            }

            if (IsTreeColumn)
            {
                column = new TreeColumn
                {
                    DataIndex = ColumnNameIndex,
                    Text      = Header,
                    Width     = new Unit(Width),
                    Flex      = string.IsNullOrEmpty(Width) ? Flex : 0,
                    Sortable  = !string.IsNullOrEmpty(Sort),
                };
            }
            else
            {
                switch (ModelFieldType)
                {
                case ModelFieldType.Auto:
                    column = new Column
                    {
                        DataIndex = ColumnNameIndex,
                        Text      = Header,
                        Width     = new Unit(Width),
                        Flex      = string.IsNullOrEmpty(Width) ? Flex : 0,
                        Hidden    = DefaultHidden,
                        Sortable  = !string.IsNullOrEmpty(Sort),
                    };
                    break;

                case ModelFieldType.String:
                    column = new Column
                    {
                        DataIndex = ColumnNameIndex,
                        Text      = Header,
                        Width     = new Unit(Width),
                        Flex      = string.IsNullOrEmpty(Width) ? Flex : 0,
                        Hidden    = DefaultHidden,
                        Wrap      = Wrap ?? true,
                        Sortable  = !string.IsNullOrEmpty(Sort),
                    };
                    break;

                case ModelFieldType.Int:
                    var intColumn = new NumberColumn
                    {
                        DataIndex = ColumnNameIndex,
                        Text      = Header,
                        Width     = new Unit(Width),
                        Flex      = string.IsNullOrEmpty(Width) ? Flex : 0,
                        Hidden    = DefaultHidden,
                        Sortable  = !string.IsNullOrEmpty(Sort),
                    };
                    if (!string.IsNullOrEmpty(Format))
                    {
                        intColumn.Format = GetIntFormat();
                    }
                    intColumn.Align = Alignment.Right;
                    //intColumn.Renderer.Handler = "debugger;return record.raw[metadata.column.dataIndex] == null && !value ? '' : value;";
                    column = intColumn;
                    break;

                case ModelFieldType.Float:
                    var floatColumn = new NumberColumn
                    {
                        DataIndex = ColumnNameIndex,
                        Text      = Header,
                        Flex      = string.IsNullOrEmpty(Width) ? Flex : 0,
                        Hidden    = DefaultHidden,
                        Sortable  = !string.IsNullOrEmpty(Sort),
                    };
                    if (!string.IsNullOrEmpty(Format))
                    {
                        floatColumn.Format = GetFloatFormat();
                    }
                    floatColumn.Align = Alignment.Right;
                    //floatColumn.Renderer.Handler = "debugger;return record.raw[metadata.column.dataIndex] == null && !value ? '' : value;";
                    column = floatColumn;
                    break;

                case ModelFieldType.Boolean:
                    if (EditModeForBool && CanEdit)
                    {
                        column = new CheckColumn
                        {
                            DataIndex     = ColumnNameIndex,
                            Text          = Header,
                            StopSelection = false,
                            Editable      = CanEdit,
                            Width         = new Unit(Width),
                            Flex          = string.IsNullOrEmpty(Width) ? Flex : 0,
                            Hidden        = DefaultHidden,
                            Sortable      = !string.IsNullOrEmpty(Sort),
                        };

                        if (column.Renderer == null)
                        {
                            column.Renderer = new Renderer();
                        }
                        column.Renderer.Handler = string.Format(
                            "if (!record.data.CanEdit) return '<span style=\"font-size:11px\">' + (record.data.{0} ? {1} : {2}) + '</span>'; return (new Ext.ux.CheckColumn()).renderer(record.data.{0});",
                            ColumnNameIndex,
                            JSON.Serialize(TrueText),
                            JSON.Serialize(FalseText));
                    }
                    else
                    {
                        column = new BooleanColumn
                        {
                            DataIndex = ColumnNameIndex,
                            Text      = Header,
                            TrueText  = TrueText,
                            FalseText = FalseText,
                            Width     = new Unit(Width),
                            Flex      = string.IsNullOrEmpty(Width) ? Flex : 0,
                            Hidden    = DefaultHidden,
                            Sortable  = !string.IsNullOrEmpty(Sort),
                        };
                    }

                    break;

                case ModelFieldType.Date:
                    column = new DateColumn
                    {
                        DataIndex = ColumnNameIndex,
                        Text      = Header,
                        Format    = GetDateFormat(),
                        Width     = new Unit(Width),
                        Flex      = string.IsNullOrEmpty(Width) ? Flex : 0,
                        Hidden    = DefaultHidden,
                        Sortable  = !string.IsNullOrEmpty(Sort),
                    };
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                if (SummaryType != null)
                {
                    column.SummaryType     = SummaryType.Value;
                    column.SummaryRenderer = new Renderer {
                        Handler = SummaryRendererHandler
                    };
                    column.CustomSummaryType = CustomSummaryType;
                }
            }

            if (editor != null)
            {
                column.Editor.Add(editor);
            }

            if (!string.IsNullOrEmpty(RendererFunction))
            {
                var handler = RendererFunction.Contains(" ") ?
                              $"function (value, metadata, record, rowIndex, colIndex, store, view) {{\n{RendererFunction}\n}}"
                    : RendererFunction;
                column.Renderer = new Renderer {
                    Handler = handler,
                };
            }

            if (Locked)
            {
                column.Locked = true;
            }

            ConfigureColumnHandler?.Invoke(column);

            return(column);
        }