Пример #1
0
    protected void KpisRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "ViewKPI")
        {
            Session["KpiId"] = e.CommandArgument.ToString();
            Response.Redirect("~/Kpis/KpiDetails.aspx");
            return;
        }

        if (e.CommandName == "ExportKPI")
        {
            return;
        }

        if (e.CommandName == "DeleteKPI")
        {
            try
            {
                int kpiId       = Convert.ToInt32(e.CommandArgument);
                int dashboardId = DashboardId;
                int userId      = UserId;
                KpiDashboardBLL.DeleteKpiDashboard(dashboardId, userId, kpiId);
                if (KpiDeleted != null)
                {
                    KpiDeleted();
                }
                LoadKpis();
            }
            catch (Exception ex)
            {
                log.Error("error deleting kpi from Dashboard", ex);
            }
        }
    }
Пример #2
0
 public void LoadKpis()
 {
     try
     {
         KpisRepeater.DataSource = KpiDashboardBLL.GetKpiDashboard(DashboardId, UserId);
         KpisRepeater.DataBind();
     }
     catch (Exception ex)
     {
         log.Error("Error loading KPIs to dashboard", ex);
     }
 }
Пример #3
0
 protected void DashboardRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "DeleteDashboard")
     {
         try
         {
             int dashboardId = Convert.ToInt32(e.CommandArgument);
             int userId      = Convert.ToInt32(UserIdHiddenField.Value);
             int kpiId       = Convert.ToInt32(KpiIdHiddenField.Value);
             KpiDashboardBLL.DeleteKpiDashboard(dashboardId, userId, kpiId);
             IsAddedInMainDashboard.Value = "false";
             DashboardRepeater.DataBind();
             DashboardsComboBox.DataBind();
         }
         catch (Exception ex)
         {
             log.Error("Error deleting kpi from dashboard", ex);
         }
     }
 }
Пример #4
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        try
        {
            int kpiId       = Convert.ToInt32(KpiIdHiddenField.Value);
            int dashboardId = Convert.ToInt32(DashboardsComboBox.SelectedValue);
            int userId      = Convert.ToInt32(UserIdHiddenField.Value);
            KpiDashboardBLL.InsertKpiToDashboard(kpiId, dashboardId, userId);
            DashboardRepeater.DataBind();
            DashboardsComboBox.DataBind();
        }
        catch (Exception ex)
        {
            log.Error("Error saving KPI in dashboard", ex);
            return;
        }

        Session["KpiId"] = KpiIdHiddenField.Value;
        Response.Redirect("~/Kpis/KpiDetails.aspx");
    }