private void BindGrid()
        {
            List <CPT_OpportunityMaster> lstOpportunity = new List <CPT_OpportunityMaster>();
            OpportunityMasterBL          clsOpportunity = new OpportunityMasterBL();

            lstOpportunity = clsOpportunity.getOpportunity();

            gvOpportunity.DataSource = lstOpportunity;
            gvOpportunity.DataBind();
        }
        protected void delete(object sender, GridViewDeleteEventArgs e)
        {
            CPT_OpportunityMaster opportunitydetails = new CPT_OpportunityMaster();
            int id = int.Parse(gvOpportunity.DataKeys[e.RowIndex].Value.ToString());

            opportunitydetails.OpportunityID = id;

            OpportunityMasterBL deleteOpportunity = new OpportunityMasterBL();

            deleteOpportunity.Delete(opportunitydetails);
            BindGrid();
        }
        protected void OpportunityAddButton_Click(object sender, EventArgs e)
        {
            try
            {
                CPT_OpportunityMaster opportunitydetails = new CPT_OpportunityMaster();
                opportunitydetails.OpportunityType = OpportunityNameTextBox.Text.Trim();
                opportunitydetails.IsActive        = true;

                OpportunityMasterBL insertOpportunity = new OpportunityMasterBL();
                insertOpportunity.Insert(opportunitydetails);
                BindGrid();
                CleartextBoxes(this);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
 protected void update(object sender, GridViewUpdateEventArgs e)
 {
     try
     {
         CPT_OpportunityMaster opportunitydetails = new CPT_OpportunityMaster();
         int id = int.Parse(gvOpportunity.DataKeys[e.RowIndex].Value.ToString());
         opportunitydetails.OpportunityID = id;
         string opportunityName = ((TextBox)gvOpportunity.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
         opportunitydetails.OpportunityType = opportunityName;
         OpportunityMasterBL updateOpportunity = new OpportunityMasterBL();
         updateOpportunity.Update(opportunitydetails);
         gvOpportunity.EditIndex = -1;
         BindGrid();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }