protected void Impactgrdvw_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string name, desc, id;
        int    ImpactId;
        int    FlagImpact;

        name      = ((TextBox)Impactgrdvw.Rows[e.RowIndex].Cells[1].Controls[0].FindControl("txtImpactName")).Text;
        desc      = ((TextBox)Impactgrdvw.Rows[e.RowIndex].Cells[2].Controls[0].FindControl("txtImpactdesc")).Text;
        id        = Convert.ToString(Impactgrdvw.Rows[e.RowIndex].Cells[0].Text);
        ImpactId  = Convert.ToInt16(id);
        ImpactObj = ImpactObj.Get_By_id(ImpactId);
        if (ImpactObj.Impactname == name)
        {
            ImpactObj.Impactname  = name;
            ImpactObj.Description = desc;
            ImpactObj.Update();
            Impactgrdvw.EditIndex = -1;
            BindGrid();
            lblerrmsg.Text = Resources.MessageResource.errupdate.ToString();
        }
        else
        {
            FlagImpact = ImpactObj.Get_By_ImpactName(name);
            if ((FlagImpact == 0) && (name != ""))
            {
                ImpactObj.Impactname  = name;
                ImpactObj.Description = desc;
                ImpactObj.Update();
                Impactgrdvw.EditIndex = -1;
                BindGrid();
                lblerrmsg.Text = Resources.MessageResource.errupdate.ToString();
            }
            else if (name == "")
            {
                lblerrmsg.Text = Resources.MessageResource.errnotempty.ToString();
            }
            else
            {
                Impactgrdvw.EditIndex = -1;
                BindGrid();
                lblerrmsg.Text = Resources.MessageResource.errImpactExist.ToString();
            }
        }
    }
    protected void btnImpactadd_Click(object sender, EventArgs e)
    {
        int impactname;

        impactname = ImpactObj.Get_By_ImpactName(txtImpactName.Text.ToString());
        if (impactname == 0)
        {
            ImpactObj.Impactname  = txtImpactName.Text.ToString();
            ImpactObj.Description = txtImpactDesc.Text.ToString();
            ImpactObj.Insert();
            BindGrid();
            lblerrmsg.Text = Resources.MessageResource.erradd.ToString();
        }
        else
        {
            lblerrmsg.Text = Resources.MessageResource.errImpactExist;
        }

        Dispose();
    }
 protected void Impactgrdvw_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     string name, desc, id;
     int ImpactId;
     int FlagImpact;
     name = ((TextBox)Impactgrdvw.Rows[e.RowIndex].Cells[1].Controls[0].FindControl("txtImpactName")).Text;
     desc = ((TextBox)Impactgrdvw.Rows[e.RowIndex].Cells[2].Controls[0].FindControl("txtImpactdesc")).Text;
     id = Convert.ToString(Impactgrdvw.Rows[e.RowIndex].Cells[0].Text);
     ImpactId = Convert.ToInt16(id);
     ImpactObj = ImpactObj.Get_By_id(ImpactId);
         if (ImpactObj.Impactname == name)
         {
             ImpactObj.Impactname = name;
             ImpactObj.Description = desc;
             ImpactObj.Update();
             Impactgrdvw.EditIndex = -1;
             BindGrid();
             lblerrmsg.Text = Resources.MessageResource.errupdate.ToString();
         }
         else
         {
             FlagImpact = ImpactObj.Get_By_ImpactName(name);
             if ((FlagImpact == 0)&&(name!=""))
             {
                 ImpactObj.Impactname = name;
                 ImpactObj.Description = desc;
                 ImpactObj.Update();
                 Impactgrdvw.EditIndex = -1;
                 BindGrid();
                 lblerrmsg.Text = Resources.MessageResource.errupdate.ToString();
             }
             else if(name == "")
             {
                 lblerrmsg.Text = Resources.MessageResource.errnotempty.ToString();
             }
             else
             {
                 Impactgrdvw.EditIndex = -1;
                 BindGrid();
                 lblerrmsg.Text = Resources.MessageResource.errImpactExist.ToString();
             }
         }
 }