private void btnSave_Click(object sender, EventArgs e) { clsAdmin admin = new clsAdmin(); clsHouse house = new clsHouse(); house.Address = txtAddress.Text; house.Area = Convert.ToInt32(txtArea.Text); house.Price = Convert.ToDecimal(txtPrice.Text); house.Floor = Convert.ToInt32(txtFloor.Text); house.NumRoom = Convert.ToInt32(txtRoom.Text); house.NumBath = Convert.ToInt32(txtBath.Text); if (cboAccess.SelectedItem.ToString() == "Yes") { house.Accessible = true; } else { house.Accessible = false; } house.Status = cboStatus.Text; if (Addmode) { if (admin.Add_New_House(house)) { MessageBox.Show("New House on the Address : " + house.Address + " is successfully added", "New House Added"); } else { MessageBox.Show("The house of the Address " + house.Address + " is not added.", "Try Again"); } admin.Refresh_Database(); } else { house.RefHouse = (int)gridAll.Rows[gridAll.CurrentRow.Index].Cells[0].Value; if (admin.Edit_House(house)) { MessageBox.Show("House ID " + house.RefHouse + " is successfully modified", "House Modified"); } else { MessageBox.Show("House ID : " + house.RefHouse + " is not modified.", "Try Again"); } } if (permission != 2) { gridAll.DataSource = admin.Search_All_Houses(); } else { gridAll.DataSource = current.Searched_House_Belong_to_Current_Agent(RefAgent); } ButtonControl(true, true, false, false, true, false); }