Esempio n. 1
0
    /// <summary>
    /// Link to page
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void gvNominees_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int       id        = Convert.ToInt32(gvNominees.DataKeys[0].Values[0]);
        Portfolio portfolio = null;

        if (!"".Equals(e.CommandArgument))
        {
            id        = Convert.ToInt32(e.CommandArgument);
            portfolio = PortfolioService.GetPortfolio(id);
        }
        if ("Select".Equals(e.CommandName))
        {
            Response.Redirect("StudentEdit.aspx?id=" + id.ToString());
        }
        if ("DeleteUser".Equals(e.CommandName))
        {
            if (portfolio != null)
            {
                PortfolioService.Delete(portfolio);
                UserService.DeleteUser(portfolio.User);
                LoadApplications();
            }
        }
        if ("ViewPortfolio".Equals(e.CommandName))
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<script language=JavaScript id='openit'>");
            sb.Append("window.open('../ReportView.aspx?report=profile&id=" + portfolio.Id + "', '', '');");
            sb.Append("</script>");
            if (!ClientScript.IsStartupScriptRegistered("openit"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "openit", sb.ToString());
            }
        }
        if ("CertifyStudent".Equals(e.CommandName))
        {
            if (portfolio != null)
            {
                Label lblName     = mdlDlgPrincipal.FindControl("lblName") as Label;
                Label lblId       = mdlDlgPrincipal.FindControl("lblId") as Label;
                Label lblSchool   = mdlDlgPrincipal.FindControl("lblSchool") as Label;
                Label lblCategory = mdlDlgPrincipal.FindControl("lblCategory") as Label;
                lblId.Text       = id.ToString();
                lblName.Text     = portfolio.User.FullName;
                lblSchool.Text   = portfolio.School.Name;
                lblCategory.Text = portfolio.Category.Name;
                mdlDlgPrincipal.ShowModal();
            }
        }
        if ("CheckStatus".Equals(e.CommandName))
        {
            if (portfolio.Status == Status.Certified)
            {
                Label lblId = mdlDlgPrincipal.FindControl("lblId") as Label;
                lblId.Text = portfolio.Id.ToString();
                btnReport_Click(null, null);
            }
        }
    }
Esempio n. 2
0
 public ActionResult Delete(int id)
 {
     try
     {
         PortfolioService.Delete(id, User.GetId());
         return(Ok());
     }
     catch (EntityDoesNotExistException exception)
     {
         Logger.LogWarning(exception, exception.Message);
         return(NotFound());
     }
 }
 private void grdPortfolios_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     PortfolioService.Delete(e.Row.Cells[0].Value.ToString());
 }