Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        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;
            }
        }