private void CreateClassHeader(FastTrackPage page) { TableRow row = new TableRow(); this.Rows.Add(row); TableCell viewCell = new TableCell(); row.Cells.Add(viewCell); viewCell.BackColor = this.BackColor; TableCell editCell = new TableCell(); row.Cells.Add(editCell); editCell.BackColor = this.BackColor; TableCell deleteCell = new TableCell(); row.Cells.Add(deleteCell); deleteCell.BackColor = this.BackColor; TableCell cell = new TableCell(); Label label = new Label(); label.Text = "Name"; label.ForeColor = Color.Black; row.Cells.Add(cell); cell.Controls.Add(label); cell.BackColor = this.BackColor; }
private void AddControlRow(FastTrackPage page, ArrayList properties, Type type) { int colSpan = properties.Count; if (page.SelectedPropertyName != null && page.SelectedPropertyName != "") { colSpan++; } if (propertyName != null && propertyName != "") { colSpan++; } colSpan += 3; TableRow lastRow = new TableRow(); lastRow.BackColor = Color.White; this.Rows.Add(lastRow); TableCell lastCell = new TableCell(); lastCell.ColumnSpan = colSpan; lastCell.Width = new Unit(100, UnitType.Percentage); lastRow.Controls.Add(lastCell); string typeName = page.GetTypeNameFromType(type); CreateObjectLinkButton createObjectLinkButton = new CreateObjectLinkButton(typeName); lastCell.Controls.Add(createObjectLinkButton); }
protected override void OnClick(EventArgs e) { base.OnClick(e); FastTrackPage page = this.Page as FastTrackPage; if (page != null) { PropertyInfo property = page.GetPropertyInfo(page.SelectedPropertyName); if (property != null) { if (page.IsListProperty(property.Name)) { IList list = (IList)page.GetPropertyValue(property.Name); list.Add(obj); } else { page.SetPropertyValue(property.Name, obj); } page.SaveObject(page.SelectedObject); page.Response.Redirect(page.GetEditUrl(page.SelectedObject, "")); } } }
public void Initialize() { if (initialized) { return; } initialized = true; this.BackColor = Color.LightGray; this.ForeColor = Color.Wheat; this.CellSpacing = 1; FastTrackPage page = this.Page as FastTrackPage; if (page != null) { if ((page.SelectedObjects != null && page.SelectedObjects.Count > 0) || (!string.IsNullOrEmpty(propertyName))) { CreateListTable(page); } else { CreateClassListTable(page); } } }
public void Initialize() { if (initialized) { return; } initialized = true; FastTrackPage page = this.Page as FastTrackPage; if (page != null) { PropertyInfo property = page.GetPropertyInfo(propertyName); if (property != null) { if (page.IsReadOnlyProperty(property.Name)) { this.ReadOnly = true; } } if (!Page.IsPostBack) { object value = page.GetPropertyValue(propertyName); if (value != null) { this.Text = value.ToString(); } } } }
public void Initialize() { if (initialized) { return; } initialized = true; FastTrackPage page = this.Page as FastTrackPage; if (page != null) { TableRow row1 = new TableRow(); this.Rows.Add(row1); TableCell listCell = new TableCell(); row1.Cells.Add(listCell); listCell.ColumnSpan = 3; TableRow row2 = new TableRow(); this.Rows.Add(row2); TableCell selectCell = new TableCell(); TableCell removeCell = new TableCell(); TableCell deleteCell = new TableCell(); row2.Cells.Add(selectCell); row2.Cells.Add(removeCell); row2.Cells.Add(removeCell); ListView list = new ListView(propertyName); listCell.Controls.Add(list); SelectObjectLinkButton selectLink = new SelectObjectLinkButton(this.propertyName); selectCell.Controls.Add(selectLink); } }
public void Save() { FastTrackPage page = this.Page as FastTrackPage; if (page != null) { PropertyInfo property = page.GetPropertyInfo(propertyName); if (property != null) { if (page.IsReadOnlyProperty(property.Name)) { return; } } try { object obj = page.SelectedObject; if (obj != null) { if (property != null) { Type type = property.PropertyType; page.SetPropertyValue(propertyName, Convert.ChangeType(this.Text, type)); } } } catch (Exception ex) { throw ex; } } }
private void CreateHeaderAndRows(FastTrackPage page, IList list, int currPage, string sortProperty, bool descending, Type type) { IList listPage = PageFactory.CreatePage(list, currPage, pageSize); if (listPage != null && listPage.Count > 0) { ArrayList properties = null; foreach (object value in listPage) { properties = CreateHeader(page, sortProperty, descending, properties, value); break; } foreach (object value in listPage) { TableRow row = new TableRow(); this.Rows.Add(row); CreateRow(page, value, row, properties); } if (list.Count > listPage.Count) { AddNavigationTable(page, list, currPage, properties); } AddControlRow(page, properties, type); } }
private void CreateClassListTable(FastTrackPage page) { IList list = null; list = page.GetTypeNames(); CreateClassHeaderAndRows(page, list); }
protected override void OnClick(EventArgs e) { base.OnClick(e); FastTrackPage page = this.Page as FastTrackPage; if (page != null) { page.SaveObject(); } }
protected override void OnClick(EventArgs e) { base.OnClick(e); FastTrackPage page = this.Page as FastTrackPage; if (page != null) { page.Response.Redirect(page.GetViewUrl(obj, "")); } }
protected override void OnClick(EventArgs e) { base.OnClick(e); FastTrackPage page = this.Page as FastTrackPage; if (page != null) { Type type = page.GetTypeFromTypeName(className); page.Response.Redirect(page.GetEditUrl(type, "")); } }
private ArrayList CreateHeader(FastTrackPage page, string sortProperty, bool descending, ArrayList properties, object value) { TableRow row = new TableRow(); this.Rows.Add(row); properties = new ArrayList(value.GetType().GetProperties()); properties.Sort(new PropertyComparer()); if (page.SelectedPropertyName != null && page.SelectedPropertyName != "") { if (page.SelectedObject != null) { TableCell cell = new TableCell(); row.Cells.Add(cell); cell.BackColor = this.BackColor; } } if (propertyName != null && propertyName != "") { TableCell cell = new TableCell(); row.Cells.Add(cell); cell.BackColor = this.BackColor; } TableCell viewCell = new TableCell(); row.Cells.Add(viewCell); viewCell.BackColor = this.BackColor; TableCell editCell = new TableCell(); row.Cells.Add(editCell); editCell.BackColor = this.BackColor; TableCell deleteCell = new TableCell(); row.Cells.Add(deleteCell); deleteCell.BackColor = this.BackColor; foreach (PropertyInfo property in properties) { TableCell cell = new TableCell(); ListColumnHeader header = new ListColumnHeader(property.Name, sortProperty, propertyName, descending); row.Cells.Add(cell); cell.Controls.Add(header); cell.BackColor = this.BackColor; } return(properties); }
public static Control GetPropertyValueEditor(FastTrackPage page, Type type, PropertyInfo property) { Control editor = null; if (page.IsListProperty(type, property.Name)) { editor = new ListEditor(property.Name); } else { Type propertyType = property.PropertyType; if (propertyType.IsEnum) editor = new EnumerationEditor(property.Name); else if (propertyType.IsPrimitive) { if (propertyType == typeof(bool)) editor = new BooleanEditor(property.Name); else if (propertyType == typeof(Int16) || propertyType == typeof(Int32) || propertyType == typeof(Int64) || propertyType == typeof(Byte)) editor = new NumberEditor(property.Name); } else if (propertyType.IsValueType) { if (propertyType == typeof(DateTime)) editor = new DateTimeEditor(property.Name); else if (propertyType == typeof(Decimal)) editor = new NumberEditor(property.Name); } else if (propertyType.IsClass) { if (propertyType == typeof(string)) editor = new StringEditor(property.Name); else if (propertyType == typeof(byte[])) ; //editor = new DateTimeEditor(property.Name); else { editor = new ReferenceEditor(property.Name); } } } return editor; }
private void CreateClassHeaderAndRows(FastTrackPage page, IList list) { CreateClassHeader(page); foreach (string typeName in list) { TableRow row = new TableRow(); this.Rows.Add(row); CreateClassRow(page, typeName, row); } //AddNavigationTable(page, list, currPage, properties); }
public void Save() { FastTrackPage page = this.Page as FastTrackPage; if (page != null) { PropertyInfo property = page.GetPropertyInfo(propertyName); if (property != null) { if (page.IsReadOnlyProperty(property.Name)) return; } page.SetPropertyValue(propertyName, this.SelectedDate); } }
protected override void OnClick(EventArgs e) { base.OnClick(e); FastTrackPage page = this.Page as FastTrackPage; if (page != null) { IList list = (IList)page.GetPropertyValue(propertyName); list.Remove(obj); page.SaveObject(page.SelectedObject); page.Response.Redirect(page.Request.Url.OriginalString); } }
private void CreateListTable(FastTrackPage page) { IList list = null; int currPage = 0; string sortProperty = ""; bool descending = false; Type type = null; if (propertyName != null && propertyName != "") { string pageNr = page.Request.QueryString[propertyName + "Page"]; if (pageNr != null) { int.TryParse(pageNr, out currPage); } list = (IList)page.GetPropertyValue(propertyName); sortProperty = page.Request.QueryString[propertyName + "Sort"]; if (page.Request.QueryString[propertyName + "desc"] != null) { descending = true; } type = page.GetListPropertyItemType(propertyName); } else { currPage = page.CurrentPage; list = page.SelectedObjects; sortProperty = page.SortProperty; descending = page.Descending; type = page.SelectedType; } ArrayList sorted = list as ArrayList; if (sorted != null && sortProperty != null) { ObjectComparer comparer = new ObjectComparer(page.DomainController, sortProperty, descending); sorted.Sort(comparer); list = sorted; } CreateHeaderAndRows(page, list, currPage, sortProperty, descending, type); }
public void Initialize() { if (initialized) { return; } initialized = true; if (propertyName != null && propertyName != "") { FastTrackPage page = GetPage(); if (page != null) { SetupEditor(); } } }
public void Save() { FastTrackPage page = this.Page as FastTrackPage; if (page != null) { PropertyInfo property = page.GetPropertyInfo(propertyName); if (property != null) { if (page.IsReadOnlyProperty(property.Name)) { return; } } page.SetPropertyValue(propertyName, Enum.Parse(property.PropertyType, this.SelectedItem.Text)); } }
public void Save() { FastTrackPage page = this.Page as FastTrackPage; if (page != null) { PropertyInfo property = page.GetPropertyInfo(propertyName); if (property != null) { if (page.IsReadOnlyProperty(property.Name)) { return; } } page.SetPropertyNullStatus(propertyName, this.Checked); } }
protected override void OnClick(EventArgs e) { base.OnClick(e); FastTrackPage page = this.Page as FastTrackPage; if (page != null) { PropertyInfo property = page.GetPropertyInfo(propertyName); if (property != null) { Type type = property.PropertyType; if (page.IsListProperty(property.Name)) { type = page.GetListPropertyItemType(property.Name); } page.Response.Redirect(page.GetListUrl(type, this.listUrl, page.SelectedObject, propertyName)); } } }
protected override void OnClick(EventArgs e) { base.OnClick(e); FastTrackPage page = this.Page as FastTrackPage; if (page != null) { object obj = page.SelectedObject; if (obj != null) { Type type = obj.GetType(); if (type != null) { page.DeleteObject(); page.Response.Redirect(page.GetListUrl(type, "")); } } } }
protected override void OnClick(EventArgs e) { base.OnClick(e); FastTrackPage page = this.Page as FastTrackPage; if (page != null) { Type type = page.SelectedType; if (type != null) { page.CreateObject(type); object obj = page.SelectedObject; if (obj != null) { page.Response.Redirect(page.GetEditUrl(obj, "")); } } } }
public void Initialize() { if (initialized) { return; } initialized = true; FastTrackPage page = this.Page as FastTrackPage; if (page != null) { if (!Page.IsPostBack) { if (page.GetPropertyNullStatus(propertyName)) { this.Checked = true; } } } }
public void Initialize() { if (initialized) { return; } initialized = true; FastTrackPage page = this.Page as FastTrackPage; if (page != null) { if (!Page.IsPostBack) { object value = page.GetPropertyValue(propertyName); PropertyInfo property = page.GetPropertyInfo(propertyName); if (property != null) { Type type = property.PropertyType; Array values = Enum.GetValues(type); foreach (object enumValue in values) { ListItem item = new ListItem(Enum.GetName(type, enumValue), enumValue.ToString()); this.Items.Add(item); if (value != null) { if (value.Equals(enumValue)) { item.Selected = true; } } } } } } }
public void Initialize() { if (initialized) return; initialized = true; FastTrackPage page = this.Page as FastTrackPage; if (page != null) { if (!Page.IsPostBack) { object value = page.GetPropertyValue(propertyName); if (value != null) { this.SelectedDate = Convert.ToDateTime(value); this.VisibleDate = this.SelectedDate; } } } }
private void CreateClassRow(FastTrackPage page, string typeName, TableRow row) { TableCell viewCell = new TableCell(); ViewTypeLinkButton viewLink = new ViewTypeLinkButton(typeName); viewLink.Text = "View"; row.Cells.Add(viewCell); viewCell.Controls.Add(viewLink); viewCell.BackColor = this.ForeColor; TableCell editCell = new TableCell(); EditTypeLinkButton editLink = new EditTypeLinkButton(typeName); editLink.Text = "Edit"; row.Cells.Add(editCell); editCell.Controls.Add(editLink); editCell.BackColor = this.ForeColor; TableCell deleteCell = new TableCell(); //DeleteTypeLinkButton deleteLink = new DeleteTypeLinkButton(typeName); LinkButton deleteLink = new LinkButton(); deleteLink.Text = "Delete"; row.Cells.Add(deleteCell); deleteCell.Controls.Add(deleteLink); deleteCell.BackColor = this.ForeColor; TableCell cell = new TableCell(); Label label = new Label(); label.ForeColor = Color.Black; label.Text = typeName; row.Cells.Add(cell); cell.Controls.Add(label); cell.BackColor = this.ForeColor; }
public void Initialize() { if (initialized) { return; } initialized = true; if (columnPropertyName != null && columnPropertyName != "") { FastTrackPage page = this.Page as FastTrackPage; if (page != null) { this.Text = columnPropertyName; if (sortable) { this.NavigateUrl = UrlFactory.GetListSortUrl(page.Request, columnPropertyName, descending, propertyName); } } } }
public void Initialize() { if (initialized) { return; } initialized = true; FastTrackPage page = this.Page as FastTrackPage; if (page != null) { if (!Page.IsPostBack) { object value = page.GetPropertyValue(propertyName); if (value != null) { this.Checked = Convert.ToBoolean(value); } } } }
public void Initialize() { if (initialized) { return; } initialized = true; FastTrackPage page = this.Page as FastTrackPage; if (page != null) { if (!Page.IsPostBack) { object value = page.GetPropertyValue(propertyName); if (value != null) { this.Text = page.GetObjectName(value); this.NavigateUrl = page.GetEditUrl(value, this.viewUrl); } } } }
public static Control GetPropertyValueEditor(FastTrackPage page, object obj, PropertyInfo property) { return GetPropertyValueEditor(page, obj.GetType(), property); }
private void AddControlRow(FastTrackPage page, ArrayList properties, Type type) { int colSpan = properties.Count; if (page.SelectedPropertyName != null && page.SelectedPropertyName != "") colSpan++; if (propertyName != null && propertyName != "") colSpan++; colSpan += 3; TableRow lastRow = new TableRow(); lastRow.BackColor = Color.White; this.Rows.Add(lastRow); TableCell lastCell = new TableCell(); lastCell.ColumnSpan = colSpan; lastCell.Width = new Unit(100, UnitType.Percentage); lastRow.Controls.Add(lastCell); string typeName = page.GetTypeNameFromType(type); CreateObjectLinkButton createObjectLinkButton = new CreateObjectLinkButton(typeName); lastCell.Controls.Add(createObjectLinkButton); }
private void AddNavigationTable(FastTrackPage page, IList list, int currPage, ArrayList properties) { int colSpan = properties.Count; if (page.SelectedPropertyName != null && page.SelectedPropertyName != "") colSpan++; if (propertyName != null && propertyName != "") colSpan++; colSpan += 3; TableRow lastRow = new TableRow(); lastRow.BackColor = Color.White; this.Rows.Add(lastRow); TableCell lastCell = new TableCell(); lastCell.ColumnSpan = colSpan; lastCell.Width = new Unit(100, UnitType.Percentage); lastRow.Controls.Add(lastCell); Table navTable = new Table(); navTable.Width = new Unit(100, UnitType.Percentage); lastCell.Controls.Add(navTable); TableRow navRow = new TableRow(); navTable.Rows.Add(navRow); TableCell prevCell = new TableCell(); prevCell.HorizontalAlign = HorizontalAlign.Center; prevCell.BackColor = Color.White; prevCell.Width = new Unit(50, UnitType.Percentage); navRow.Cells.Add(prevCell); TableCell pageCell = new TableCell(); pageCell.HorizontalAlign = HorizontalAlign.Center; pageCell.BackColor = Color.White; pageCell.Wrap = false; navRow.Cells.Add(prevCell); TableCell nextCell = new TableCell(); nextCell.HorizontalAlign = HorizontalAlign.Center; nextCell.BackColor = Color.White; nextCell.Width = new Unit(50, UnitType.Percentage); navRow.Cells.Add(nextCell); if (currPage > 0) { HyperLink prevLink = new HyperLink(); prevLink.Text = "Previous"; prevLink.NavigateUrl = UrlFactory.GetListPageUrl(page.Request, currPage, false, propertyName); prevCell.Controls.Add(prevLink); } if (list.Count > pageSize) { HyperLink nextLink = new HyperLink(); nextLink.Text = "Next"; nextLink.NavigateUrl = UrlFactory.GetListPageUrl(page.Request, currPage, true, propertyName); nextCell.Controls.Add(nextLink); } }
private ArrayList CreateHeader(FastTrackPage page, string sortProperty, bool descending, ArrayList properties, object value) { TableRow row = new TableRow(); this.Rows.Add(row); properties = new ArrayList(value.GetType().GetProperties()); properties.Sort(new PropertyComparer()); if (page.SelectedPropertyName != null && page.SelectedPropertyName != "") { if (page.SelectedObject != null) { TableCell cell = new TableCell(); row.Cells.Add(cell); cell.BackColor = this.BackColor; } } if (propertyName != null && propertyName != "") { TableCell cell = new TableCell(); row.Cells.Add(cell); cell.BackColor = this.BackColor; } TableCell viewCell = new TableCell(); row.Cells.Add(viewCell); viewCell.BackColor = this.BackColor; TableCell editCell = new TableCell(); row.Cells.Add(editCell); editCell.BackColor = this.BackColor; TableCell deleteCell = new TableCell(); row.Cells.Add(deleteCell); deleteCell.BackColor = this.BackColor; foreach (PropertyInfo property in properties) { TableCell cell = new TableCell(); ListColumnHeader header = new ListColumnHeader(property.Name, sortProperty, propertyName, descending); row.Cells.Add(cell); cell.Controls.Add(header); cell.BackColor = this.BackColor; } return properties; }
private void CreateListTable(FastTrackPage page) { IList list = null; int currPage = 0; string sortProperty = ""; bool descending = false; Type type = null; if (propertyName != null && propertyName != "") { string pageNr = page.Request.QueryString[propertyName + "Page"]; if (pageNr != null) int.TryParse(pageNr, out currPage); list = (IList)page.GetPropertyValue(propertyName); sortProperty = page.Request.QueryString[propertyName + "Sort"]; if (page.Request.QueryString[propertyName + "desc"] != null) descending = true; type = page.GetListPropertyItemType(propertyName); } else { currPage = page.CurrentPage; list = page.SelectedObjects; sortProperty = page.SortProperty; descending = page.Descending; type = page.SelectedType; } ArrayList sorted = list as ArrayList; if (sorted != null && sortProperty != null) { ObjectComparer comparer = new ObjectComparer(page.DomainController, sortProperty, descending); sorted.Sort(comparer); list = sorted; } CreateHeaderAndRows(page, list, currPage, sortProperty, descending, type); }
private void CreateRow(FastTrackPage page, object value, TableRow row, ArrayList properties) { if (page.SelectedPropertyName != null && page.SelectedPropertyName != "") { if (page.SelectedObject != null) { TableCell cell = new TableCell(); SelectListItemLinkButton link = new SelectListItemLinkButton(value); link.Text = "Select"; row.Cells.Add(cell); cell.Controls.Add(link); cell.BackColor = this.ForeColor ; } } if (propertyName != null && propertyName != "") { TableCell cell = new TableCell(); RemoveListItemLinkButton link = new RemoveListItemLinkButton(value, propertyName); link.Text = "Remove"; row.Cells.Add(cell); cell.Controls.Add(link); cell.BackColor = this.ForeColor; } TableCell viewCell = new TableCell(); ViewListItemLinkButton viewLink = new ViewListItemLinkButton(value); viewLink.Text = "View"; row.Cells.Add(viewCell); viewCell.Controls.Add(viewLink); viewCell.BackColor = this.ForeColor; TableCell editCell = new TableCell(); EditListItemLinkButton editLink = new EditListItemLinkButton(value); editLink.Text = "Edit"; row.Cells.Add(editCell); editCell.Controls.Add(editLink); editCell.BackColor = this.ForeColor; TableCell deleteCell = new TableCell(); DeleteListItemLinkButton deleteLink = new DeleteListItemLinkButton(); deleteLink.Text = "Delete"; row.Cells.Add(deleteCell); deleteCell.Controls.Add(deleteLink); deleteCell.BackColor = this.ForeColor; foreach (PropertyInfo property in properties) { TableCell cell = new TableCell(); Label label = new Label(); label.ForeColor = Color.Black; object propertyValue = page.GetPropertyValue(value, property.Name); if (page.IsListProperty(value, property.Name)) { int count = 0; if (propertyValue != null) count = ((IList)propertyValue).Count; label.Text = count.ToString() + " items"; } else { if (propertyValue != null) label.Text = propertyValue.ToString(); } row.Cells.Add(cell); cell.Controls.Add(label); cell.BackColor = this.ForeColor; } }