public void grd1_EditCommand(object sender, DataGridCommandEventArgs e)
 {
     contingency _wc = new contingency();
     grd1.ShowFooter = false;
     grd1.EditItemIndex = Convert.ToInt32(e.Item.ItemIndex);
     DataSet dsGridResults = _wc.FetchSubContingencyData(Convert.ToInt32(ViewState["cont_id"].ToString()));
     PopulateDataGrid(dsGridResults, grd1);
 }
 public void grd1_DeleteCommand(object sender, DataGridCommandEventArgs e)
 {
     contingency _wc = new contingency();
     String DetailId = "";
     DetailId = grd1.DataKeys[Convert.ToInt32(e.Item.ItemIndex)].ToString();
     Whitfieldcore _dbClass = new Whitfieldcore();
     _wc.DeleteSubContingency(Convert.ToInt32(DetailId));
     DataSet dsGridResults = _wc.FetchSubContingencyData(Convert.ToInt32(ViewState["cont_id"].ToString()));
     PopulateDataGrid(dsGridResults, grd1);
 }
    public void grdEstimateMaterials_Itemcommand(Object sender, DataGridCommandEventArgs e)
    {
        Int32 cont_id = 0;

        contingency mm = new contingency();
        switch (e.CommandName)
        {

            case "Expand":
                {

                    cont_id = Convert.ToInt32(grdEstimateMaterials.DataKeys[Convert.ToInt32(e.Item.ItemIndex)]);
                    cont_id = Convert.ToInt32(grdEstimateMaterials.DataKeys[e.Item.ItemIndex]);
                    DataSet dsExpand = mm.FetchSubContingencyData(cont_id);
                    PlaceHolder exp = new PlaceHolder();
                    exp = (System.Web.UI.WebControls.PlaceHolder)e.Item.Cells[4].FindControl("ExpandedContent");
                    ImageButton img = new ImageButton();
                    img = (System.Web.UI.WebControls.ImageButton)e.Item.Cells[0].FindControl("btnExpand");
                    // if (dsExpand.HasRows())
                    // {
                    if (img.ImageUrl == "assets/img/Plus.gif")
                    {
                        img.ImageUrl = "assets/img/Minus.gif";
                        exp.Visible = true;
                        ((master_contingency1)(e.Item.FindControl("DynamicTable1"))).Visible = true;
                        ((master_contingency1)(e.Item.FindControl("DynamicTable1"))).cont_id = cont_id;
                        ((master_contingency1)(e.Item.FindControl("DynamicTable1"))).LoadDetails(dsExpand);

                    }
                    else
                    {
                        exp.Visible = false;
                        ((master_contingency1)(e.Item.FindControl("DynamicTable1"))).Visible = false;
                        img.ImageUrl = "assets/img/Plus.gif";
                    }
                    //}
                    break;
                }
            default:
                {
                    break;
                }
        }
    }
 public void grd1_UpdateCommand(object sender, DataGridCommandEventArgs e)
 {
     String DetailId = grd1.DataKeys[Convert.ToInt32(e.Item.ItemIndex)].ToString();
     contingency _wc = new contingency();
     _wc.UpdatesubContingency(Convert.ToInt32(DetailId), ((TextBox)(e.Item.FindControl("txtdesc"))).Text, ((RadioButtonList)(e.Item.FindControl("chkUOM"))).SelectedItem.Value, ((TextBox)(e.Item.FindControl("txtcost"))).Text, ((RadioButtonList)(e.Item.FindControl("chkis_default"))).SelectedItem.Value);
     grd1.EditItemIndex = -1;
     grd1.ShowFooter = true;
     DataSet dsGridResults = _wc.FetchSubContingencyData(Convert.ToInt32(ViewState["cont_id"].ToString()));
     PopulateDataGrid(dsGridResults, grd1);
 }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         contingency mm = new contingency();
         Int32 IsValidInsert = mm.PopulateSubContingency(Convert.ToInt32(ViewState["cont_id"].ToString()), txtdesc.Text.Trim(), ddlUOM.SelectedItem.Value,txtCost.Text.Trim(),ddldefault.SelectedItem.Value);
         DataSet dsGridResults = mm.FetchSubContingencyData(Convert.ToInt32(ViewState["cont_id"].ToString()));
         PopulateDataGrid(dsGridResults, grd1);
     }
     catch (Exception)
     {
         throw;
     }
 }