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; 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(); } } } }
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; 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; } } } }
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); } } } }
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; } }
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; } }
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); }