private void btnEdit_Click(object sender, EventArgs e)
        {
            AddressDialog dlgAddress = new AddressDialog();

            dlgAddress.FillInCombo();
            int AddressId = (int)(dgvAddressBook.SelectedRows[0].Cells[0].Value);

            dlgAddress.StateName = (dgvAddressBook.SelectedRows[0].Cells[2].Value).ToString();
            dlgAddress.UserName  = (dgvAddressBook.SelectedRows[0].Cells[4].Value).ToString();
            dlgAddress.FirstName = (dgvAddressBook.SelectedRows[0].Cells[5].Value).ToString();
            dlgAddress.LastName  = (dgvAddressBook.SelectedRows[0].Cells[6].Value).ToString();
            dlgAddress.EmailId   = (dgvAddressBook.SelectedRows[0].Cells[7].Value).ToString();
            dlgAddress.PhoneNo   = (dgvAddressBook.SelectedRows[0].Cells[8].Value).ToString();
            dlgAddress.Address1  = (dgvAddressBook.SelectedRows[0].Cells[9].Value).ToString();
            dlgAddress.Address2  = (dgvAddressBook.SelectedRows[0].Cells[10].Value).ToString();
            dlgAddress.Street    = (dgvAddressBook.SelectedRows[0].Cells[11].Value).ToString();
            dlgAddress.City      = (dgvAddressBook.SelectedRows[0].Cells[12].Value).ToString();
            dlgAddress.ZipCode   = (long)(dgvAddressBook.SelectedRows[0].Cells[13].Value);
            dlgAddress.IsActive  = (bool)(dgvAddressBook.SelectedRows[0].Cells[14].Value);
            AddressData objAddressdata = new AddressData();

            if (dlgAddress.ShowDialog() == DialogResult.OK)
            {
                objAddressdata.PKAddressId = AddressId;
                objAddressdata.FKStateId   = (int)(dgvAddressBook.SelectedRows[0].Cells[1].Value);
                objAddressdata.FKUserId    = (int)(dgvAddressBook.SelectedRows[0].Cells[3].Value);
                objAddressdata.FirstName   = dlgAddress.FirstName;
                objAddressdata.LastName    = dlgAddress.LastName;
                objAddressdata.EmailId     = dlgAddress.EmailId;
                objAddressdata.PhoneNo     = dlgAddress.PhoneNo;
                objAddressdata.Address1    = dlgAddress.Address1;
                objAddressdata.Address2    = dlgAddress.Address2;
                objAddressdata.Street      = dlgAddress.Street;
                objAddressdata.City        = dlgAddress.City;
                objAddressdata.ZipCode     = dlgAddress.ZipCode;
                objAddressdata.IsActive    = dlgAddress.IsActive;
                AddressBO.UpdateInAddress(objAddressdata);
            }
            else
            {
                MessageBox.Show("please check the Details again");
            }
            dgvAddressBook.DataSource = AddressBO.GetAddress();
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            AddressDialog dlgAddress     = new AddressDialog();
            AddressData   objAddressdata = new AddressData();

            dlgAddress.FillInCombo();
            if (dlgAddress.ShowDialog() == DialogResult.OK)
            {
                objAddressdata.FKStateId = dlgAddress.FKSatteId;
                objAddressdata.FKUserId  = dlgAddress.FKuserID;
                objAddressdata.FirstName = dlgAddress.FirstName;
                objAddressdata.LastName  = dlgAddress.LastName;
                objAddressdata.EmailId   = dlgAddress.EmailId;
                objAddressdata.PhoneNo   = dlgAddress.PhoneNo;
                objAddressdata.Address1  = dlgAddress.Address1;
                objAddressdata.Address2  = dlgAddress.Address2;
                objAddressdata.Street    = dlgAddress.Street;
                objAddressdata.City      = dlgAddress.City;
                objAddressdata.ZipCode   = dlgAddress.ZipCode;
                objAddressdata.IsActive  = dlgAddress.IsActive;
                AddressBO.InsertInAddress(objAddressdata);
                dgvAddressBook.DataSource = AddressBO.GetAddress();
            }
        }