Ejemplo n.º 1
0
 protected void dgResults_rowDatabound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.Header)
     {
         for (int i = 0; i < e.Row.Cells.Count; i++)
         {
             DataControlFieldHeaderCell obj = (DataControlFieldHeaderCell)e.Row.Cells[i];
             if (!String.IsNullOrEmpty(sortType) && obj.ContainingField.SortExpression == sortType)
             {
                 if (sortDirection == "asc")
                 {
                     obj.Attributes.Add("class", "sortup");
                 }
                 else
                 {
                     obj.Attributes.Add("class", "sortdown");
                 }
                 break;
             }
         }
     }
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         DataRowView dr = e.Row.DataItem as DataRowView;
         if (dr != null)
         {
             string reportUrl = ClearUrlParameters(Request);
             reportUrl = addParameterToUrl(reportUrl, reportParam, dr["Id"].ToString());
             reportUrl = addParameterToUrl(reportUrl, backParam, Request.RawUrl);
             e.Row.Attributes["onclick"] = "window.location=\"" + reportUrl + "\"";
         }
     }
 }
Ejemplo n.º 2
0
        protected virtual String GetFilterCommand()
        {
            String filterCommand = "";

            for (int i = 0; i < this.Columns.Count; i++)
            {
                if (this.Columns[i].HeaderText.EndsWith(" "))
                {
                    DataControlFieldHeaderCell headerCell = (DataControlFieldHeaderCell)this.HeaderRow.Cells[i];
                    TextBox      txtFilter = (TextBox)m_txtFilter[i];
                    DropDownList ddlFilter = (DropDownList)m_ddlFilter[i];
                    BoundField   aColumn;
                    if (!(this.Columns[i] is BoundField) || String.IsNullOrEmpty(ddlFilter.SelectedValue.Trim()))
                    {
                        continue;
                    }
                    aColumn = (BoundField)this.Columns[i];
                    if (String.IsNullOrEmpty(txtFilter.Text))
                    {
                        continue;
                    }
                    if (String.IsNullOrEmpty(filterCommand))
                    {
                        filterCommand = aColumn.DataField + " " + ddlFilter.SelectedValue + " " + txtFilter.Text;
                    }
                    else
                    {
                        filterCommand += " AND " + aColumn.DataField + " " + ddlFilter.SelectedValue + " " + txtFilter.Text;
                    }
                }
            }

            return(filterCommand);
        }
Ejemplo n.º 3
0
 protected void gvNominees_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.Header)
     {
         for (int i = 0; i < e.Row.Cells.Count; i++)
         {
             DataControlFieldHeaderCell obj = (DataControlFieldHeaderCell)e.Row.Cells[i];
             if (!String.IsNullOrEmpty(this.SortColumn) && obj.ContainingField.SortExpression == this.SortColumn)
             {
                 GridHelper.AddSortImage(obj, SortDirection);
             }
         }
     }
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         Portfolio app = e.Row.DataItem as Portfolio;
         if (e.Row.RowState == DataControlRowState.Edit)
         {
             DropDownList ddlEditStatus = e.Row.FindControl("ddlEditStatus") as DropDownList;
             ddlEditStatus.SelectedValue = app.Status.ToString();
         }
         else
         {
             Label labStatus = e.Row.FindControl("labStatus") as Label;
             if (null != labStatus)
             {
                 labStatus.Text = app.Status.ToDescription();
             }
         }
         ListView lv = e.Row.FindControl("lvScores") as ListView;
         lv.DataSource = ScoreService.GetJudgeStatusForPortfolio(app);
         lv.DataBind();
     }
 }
Ejemplo n.º 4
0
    protected override void InitializeRow(GridViewRow row, DataControlField[] fields)
    {
        DataControlFieldCell cell   = new DataControlFieldHeaderCell(fields[0]);
        DataControlCellType  header = DataControlCellType.DataCell;

        fields[0].InitializeCell(cell, header, row.RowState, row.RowIndex);
        row.Cells.Add(cell);
        DataControlField[] newFields = new DataControlField[fields.Length - 1];
        for (int i = 1; i < fields.Length; i++)
        {
            newFields[i - 1] = fields[i];
        }
        base.InitializeRow(row, newFields);
    }
Ejemplo n.º 5
0
 public static void AddSortImage(DataControlFieldHeaderCell obj, SortDirection sortDirection)
 {
     // Create the sorting image based on the sort direction.
     System.Web.UI.WebControls.Image sortImage = new System.Web.UI.WebControls.Image();
     if (SortDirection.Ascending == sortDirection)
     {
         sortImage.ImageUrl = "~/assets/images/ascred.gif";
         sortImage.AlternateText = "Ascending Order";
     }
     else
     {
         sortImage.ImageUrl = "~/assets/images/descred.gif";
         sortImage.AlternateText = "Descending Order";
     }
     // Add the image to the appropriate header cell.
     obj.Controls.Add(sortImage);
 }
Ejemplo n.º 6
0
 public static void AddSortImage(DataControlFieldHeaderCell obj, SortDirection sortDirection)
 {
     // Create the sorting image based on the sort direction.
     System.Web.UI.WebControls.Image sortImage = new System.Web.UI.WebControls.Image();
     if (SortDirection.Ascending == sortDirection)
     {
         sortImage.ImageUrl      = "~/assets/images/ascred.gif";
         sortImage.AlternateText = "Ascending Order";
     }
     else
     {
         sortImage.ImageUrl      = "~/assets/images/descred.gif";
         sortImage.AlternateText = "Descending Order";
     }
     // Add the image to the appropriate header cell.
     obj.Controls.Add(sortImage);
 }
Ejemplo n.º 7
0
    protected void gvNominees_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {
            for (int i = 0; i < e.Row.Cells.Count; i++)
            {
                DataControlFieldHeaderCell obj = (DataControlFieldHeaderCell)e.Row.Cells[i];
                if (!String.IsNullOrEmpty(this.SortColumn) && obj.ContainingField.SortExpression == this.SortColumn)
                {
                    GridHelper.AddSortImage(obj, SortDirection);
                }
            }
        }
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            JudgeStatus js = e.Row.DataItem as JudgeStatus;
            if (null != js)
            {
                Label     labStatus     = e.Row.FindControl("labStatus") as Label;
                Label     labScore      = e.Row.FindControl("labScore") as Label;
                Label     labTotalScore = e.Row.FindControl("labTotalScore") as Label;
                Label     labRanking    = e.Row.FindControl("labRanking") as Label;
                HyperLink btnScores     = e.Row.FindControl("btnScores") as HyperLink;
                labStatus.Text     = js.Phase.ToDescription();
                labScore.Text      = js.Score.ToString("F");
                labTotalScore.Text = js.Portfolio.TotalScore.ToString("F");
                labRanking.Text    = js.Portfolio.Ranking.ToString();
                if (js.Score == 0)
                {
                    labScore.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    //labStatus.Text = js.Application.Status.ToDescription();
                    labScore.Text = ScoreService.ComputeScore(Judge, js.Portfolio).ToString("F");
                }

                //labScore.Attributes.Add("onmouseover", "tooltip.show('" + GetOtherScores(js.Application) + "');");
                //labScore.Attributes.Add("onmouseout", "tooltip.hide();");

                btnScores.Visible = !js.Submitted;
            }
        }
    }
Ejemplo n.º 8
0
 protected void dgSingleImport_rowDatabound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.Header)
     {
         for (int i = 0; i < e.Row.Cells.Count; i++)
         {
             DataControlFieldHeaderCell obj = (DataControlFieldHeaderCell)e.Row.Cells[i];
             if (!String.IsNullOrEmpty(sortType) && obj.ContainingField.SortExpression == sortType)
             {
                 if (sortDirection == "asc")
                 {
                     obj.Attributes.Add("class", "sortup");
                 }
                 else
                 {
                     obj.Attributes.Add("class", "sortdown");
                 }
                 break;
             }
         }
     }
 }
Ejemplo n.º 9
0
 protected void gvNominees_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.Header)
     {
         for (int i = 0; i < e.Row.Cells.Count; i++)
         {
             DataControlFieldHeaderCell obj = (DataControlFieldHeaderCell)e.Row.Cells[i];
             if (!String.IsNullOrEmpty(this.SortColumn) && obj.ContainingField.SortExpression == this.SortColumn)
             {
                 GridHelper.AddSortImage(obj, SortDirection);
             }
         }
     }
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         Portfolio app       = e.Row.DataItem as Portfolio;
         Label     labStatus = e.Row.FindControl("labStatus") as Label;
         if (null != labStatus)
         {
             labStatus.Text = app.Status.ToDescription();
         }
     }
 }
Ejemplo n.º 10
0
    protected void gvUsers_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {
            for (int i = 0; i < e.Row.Cells.Count; i++)
            {
                DataControlFieldHeaderCell obj = (DataControlFieldHeaderCell)e.Row.Cells[i];
                if (!String.IsNullOrEmpty(this.SortColumn) && obj.ContainingField.SortExpression == this.SortColumn)
                {
                    GridHelper.AddSortImage(obj, SortDirection);
                }
            }
        }

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            DisplayUser ds = e.Row.DataItem as DisplayUser;
            if (null != ds)
            {
                Label      labStatus = e.Row.FindControl("labStatus") as Label;
                LinkButton btnDelete = e.Row.FindControl("btnDelete") as LinkButton;
                LinkButton btnStatus = e.Row.FindControl("btnStatus") as LinkButton;
                LinkButton btnUnlock = e.Row.FindControl("btnUnlock") as LinkButton;

                btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this user?');");

                if (null != ds.Status)
                {
                    labStatus.Text = ((Status)Enum.ToObject(typeof(Status), ds.Status)).ToDescription();
                }
                if (ds.Disabled)
                {
                    btnStatus.Text = "Enable";
                }
                else
                {
                    btnStatus.Text = "Disable";
                }
                btnUnlock.Visible = false;
                HyperLink btnView = e.Row.FindControl("btnView") as HyperLink;
                User      u       = UserService.GetUser(ds.Id);
                if (UserService.IsAccountLocked(u))
                {
                    btnUnlock.Visible = true;
                }
                if (ds.Role == RoleType.Nominee)
                {
                    Portfolio portfolio = PortfolioService.GetPortfolioByUser(u);
                    if (null != portfolio)
                    {
                        btnView.NavigateUrl = "~/ReportView.aspx?report=profile&id=" + portfolio.Id.ToString();
                    }
                }
                else if (ds.Role == RoleType.AreaJudge || ds.Role == RoleType.RegionJudge)
                {
                    btnView.Text        = "Create Scores";
                    btnView.NavigateUrl = "~/Admin/BuildScores.aspx?id=" + ds.Id.ToString();
                }
                else
                {
                    btnView.Visible = false;
                }
            }
        }
    }
Ejemplo n.º 11
0
        /// <summary>
        /// Create header row
        /// </summary>
        private void CreateHeaderRow()
        {
            if (ShowHeaderAllways)
            {
                Table maintable = null;
                if (this.Controls.Count == 0)
                {
                    maintable = new Table();
                    maintable.ApplyStyle(this.ControlStyle);
                    this.Controls.Add(maintable);
                }
                else
                {
                    maintable = this.Controls[0] as Table;
                }

                bool IsCreateHeader = false;

                bool IsCreateEmptyRow = false;

                if (maintable.Rows.Count == 0)
                {
                    IsCreateHeader   = true;
                    IsCreateEmptyRow = true;
                }
                else
                {
                    GridViewRow gvr = maintable.Rows[0] as GridViewRow;
                    if (gvr.RowType == DataControlRowType.EmptyDataRow)
                    {
                        maintable.Rows.Clear();
                        IsCreateHeader   = true;
                        IsCreateEmptyRow = true;
                    }
                    else
                    {
                        IsCreateHeader   = false;
                        IsCreateEmptyRow = false;
                    }
                }

                int ColumnCount = 0;

                if (IsCreateHeader)
                {
                    GridViewRow gvr = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal);
                    gvr.ApplyStyle(this.HeaderStyle);
                    for (int i = 0; i < this.Columns.Count; i++)
                    {
                        DataControlField column = this.Columns[i];

                        if (column.ShowHeader)
                        {
                            ColumnCount++;
                            DataControlFieldHeaderCell tc = new DataControlFieldHeaderCell(column);
                            tc.ApplyStyle(column.HeaderStyle);
                            column.InitializeCell(tc, DataControlCellType.Header, DataControlRowState.Normal, 0);
                            gvr.Cells.Add(tc);
                        }
                    }
                    maintable.Rows.AddAt(0, gvr);
                }

                if (IsCreateEmptyRow)
                {
                    if (this.EmptyDataText != string.Empty)
                    {
                        GridViewRow gvr = new GridViewRow(0, 0, DataControlRowType.EmptyDataRow, DataControlRowState.Normal);
                        gvr.ApplyStyle(this.EmptyDataRowStyle);
                        TableCell tc = new TableCell();
                        tc.Text       = this.EmptyDataText;
                        tc.ColumnSpan = ColumnCount;

                        gvr.Cells.Add(tc);

                        maintable.Rows.Add(gvr);
                    }
                }
            }
        }