private void btnAdd_Click(object sender, EventArgs e) { mode = "add"; if (frmRemax.formToManage == "house") { frmHouse frmH = new frmHouse(); frmH.ShowDialog(); } else if (frmRemax.formToManage == "client") { frmClient frmC = new frmClient(); frmC.ShowDialog(); } else if (frmRemax.formToManage == "employee") { frmEmployee frmE = new frmEmployee(); frmE.ShowDialog(); } }
private void btnEdit_Click(object sender, EventArgs e) { mode = "edit"; string id = dgvResult.Rows[dgvResult.CurrentCell.RowIndex].Cells[0].Value.ToString(); if (frmRemax.formToManage == "house") { house = HouseDB.getHouse(id); if (frmLogin.agent != null) { if (house.IdAgent != frmLogin.agent.Id) { MessageBox.Show("The house added by another agent.You can not edit."); } else { frmHouse frmH = new frmHouse(); frmH.ShowDialog(); } } else { frmHouse frmH = new frmHouse(); frmH.ShowDialog(); } } else if (frmRemax.formToManage == "client") { client = ClientDB.getClient(id); frmClient frmC = new frmClient(); frmC.ShowDialog(); } else if (frmRemax.formToManage == "employee") { agent = EmployeeDB.getAgent(id); frmEmployee frmE = new frmEmployee(); frmE.ShowDialog(); } }