Ejemplo n.º 1
0
    protected void ADDProjectOutcome_Click(object sender, EventArgs e)
    {
        if (GridViewProjectsOutcome.Rows.Count == 0)
        {
            //BindGridview();
        }


        else
        {
            int rowIndex = 0;

            if (ViewState["ImpactFactorDetails"] != null)
            {
                DataTable dt           = (DataTable)ViewState["ImpactFactorDetails"];
                DataRow   drCurrentRow = null;
                if (dt.Rows.Count > 0)
                {
                    for (int i = 1; i <= dt.Rows.Count; i++)
                    {
                        TextBox impactYear           = (TextBox)GridViewProjectsOutcome.Rows[rowIndex].Cells[1].FindControl("txtYear");
                        TextBox OneImpactFactor      = (TextBox)GridViewProjectsOutcome.Rows[rowIndex].Cells[2].FindControl("txtImpactFactor");
                        TextBox FiveYearImpactFactor = (TextBox)GridViewProjectsOutcome.Rows[rowIndex].Cells[3].FindControl("txtFiveYearImpactFactor");
                        drCurrentRow = dt.NewRow();


                        if (impactYear.Text != "")
                        {
                            dt.Rows[i - 1]["Year"] = impactYear.Text;
                        }
                        if (OneImpactFactor.Text != "")
                        {
                            dt.Rows[i - 1]["ImpactFactor"] = OneImpactFactor.Text;
                        }
                        if (FiveYearImpactFactor.Text != "")
                        {
                            dt.Rows[i - 1]["FiveImpFact"] = FiveYearImpactFactor.Text;
                        }
                        rowIndex++;
                    }
                    dt.Rows.Add(drCurrentRow);
                    ViewState["ImpactFactorDetails"]   = dt;
                    GridViewProjectsOutcome.DataSource = dt;
                    GridViewProjectsOutcome.DataBind();
                }
            }

            else
            {
                Response.Write("ViewState Value is Null");
            }

            SetOldDataProjectOutcomeDetails();
        }
    }
Ejemplo n.º 2
0
    protected void GridViewProjectsOutcome_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        SetRowDataProjectOutcome();
        if (ViewState["ImpactFactorDetails"] != null)
        {
            DataTable dt           = (DataTable)ViewState["ImpactFactorDetails"];
            DataRow   drCurrentRow = null;
            int       rowIndex     = Convert.ToInt32(e.RowIndex);
            if (dt.Rows.Count > 1 && rowIndex != 0)
            {
                dt.Rows.Remove(dt.Rows[rowIndex]);
                drCurrentRow = dt.NewRow();
                ViewState["ImpactFactorDetails"]   = dt;
                GridViewProjectsOutcome.DataSource = dt;
                GridViewProjectsOutcome.DataBind();

                SetOldDataProjectOutcomeDetails();
                // gridAmtChanged(sender, e);
            }
        }
    }
Ejemplo n.º 3
0
    private void SetExistingimpactFactorDetails(JournalData JournalValueObj)
    {
        Business b = new Business();

        DataTable dyPO = b.SelectImpactFactorDetails(JournalValueObj);

        if (dyPO.Rows.Count != 0)
        {
            ViewState["ImpactFactorDetails"]   = dyPO;
            GridViewProjectsOutcome.DataSource = dyPO;
            GridViewProjectsOutcome.DataBind();
            GridViewProjectsOutcome.Visible = true;

            int rowIndex2 = 0;

            DataTable table         = (DataTable)ViewState["ImpactFactorDetails"];
            DataRow   drCurrentRow2 = null;
            if (table.Rows.Count > 0)
            {
                for (int i = 1; i <= table.Rows.Count; i++)
                {
                    TextBox impactYear           = (TextBox)GridViewProjectsOutcome.Rows[rowIndex2].Cells[1].FindControl("txtYear");
                    TextBox OneImpactFactor      = (TextBox)GridViewProjectsOutcome.Rows[rowIndex2].Cells[2].FindControl("txtImpactFactor");
                    TextBox FiveYearImpactFactor = (TextBox)GridViewProjectsOutcome.Rows[rowIndex2].Cells[3].FindControl("txtFiveYearImpactFactor");
                    drCurrentRow2             = table.NewRow();
                    impactYear.Text           = table.Rows[i - 1]["Year"].ToString();
                    OneImpactFactor.Text      = table.Rows[i - 1]["ImpactFactor"].ToString();
                    FiveYearImpactFactor.Text = table.Rows[i - 1]["FiveImpFact"].ToString();
                    rowIndex2++;
                }


                ViewState["ImpactFactorDetails"] = table;
            }
        }
        else
        {
            SetRowDataProjectOutcome();
        }
    }
Ejemplo n.º 4
0
    private void SetintialRowDataProjectOutcome()
    {
        DataTable dy = new DataTable();

        dy.Columns.Add("Year", typeof(string));
        dy.Columns.Add("ImpactFactor", typeof(string));
        dy.Columns.Add("FiveImpFact", typeof(string));
        DataRow dr = dy.NewRow();

        dr["Year"]         = string.Empty;
        dr["ImpactFactor"] = string.Empty;
        dr["FiveImpFact"]  = string.Empty;
        dy.Rows.Add(dr);
        ViewState["ImpactFactorDetails"]   = dy;
        GridViewProjectsOutcome.DataSource = dy;
        GridViewProjectsOutcome.DataBind();
        TextBox impactYear           = (TextBox)GridViewProjectsOutcome.Rows[0].Cells[1].FindControl("txtYear");
        TextBox OneImpactFactor      = (TextBox)GridViewProjectsOutcome.Rows[0].Cells[2].FindControl("txtImpactFactor");
        TextBox FiveYearImpactFactor = (TextBox)GridViewProjectsOutcome.Rows[0].Cells[3].FindControl("txtFiveYearImpactFactor");

        impactYear.Text           = "";
        OneImpactFactor.Text      = "";
        FiveYearImpactFactor.Text = "";
    }