private void ownersToolStripMenuItem_Click(object sender, EventArgs e) { if (dgvDetails.SelectedRows.Count > 0) { if (Convert.ToInt32(dgvDetails.SelectedRows[0].Cells["OwnersCnt"].Value.ToString()) > 0) { int detailId = Convert.ToInt32(dgvDetails.SelectedRows[0].Cells["DetailDetailRevId"].Value.ToString()); int revNo = Convert.ToInt32(dgvDetails.SelectedRows[0].Cells["DetailRevNo"].Value.ToString()); FIDetailRev detRev = DetailRevList.Where(i => i.FIDetailId == detailId && i.RevNo == revNo).First(); FIDetail det = new FIDetail(detRev); FIDetailEdit frmShowDetails = new FIDetailEdit(glHeader, det); frmShowDetails.txtDescription.ReadOnly = true; frmShowDetails.txtActionReq.ReadOnly = true; frmShowDetails.txtActionCode.Enabled = false; frmShowDetails.dtpActionDate.Enabled = false; frmShowDetails.dgvOwners.Enabled = false; frmShowDetails.btnSave.Enabled = false; frmShowDetails.ShowDialog(); } else { MessageBox.Show("No Owners found!"); //will never be here! } } }
private void MIeditDetail_Click(object sender, EventArgs e) { if (dgvDetails.SelectedRows.Count > 0) { int DetailId = Convert.ToInt32(dgvDetails.SelectedRows[0].Cells["DetailId"].Value.ToString()); FIDetail selectedDetail = Header_Details.Where(i => i.Id == DetailId).First(); int HeaderId = Convert.ToInt32(dgvHeaders.SelectedRows[0].Cells["HeaderId"].Value.ToString()); FIHeader selectedHeader = Audit_Headers.Where(i => i.Id == HeaderId).First(); FIDetailEdit frmDetailEdit = new FIDetailEdit(selectedHeader, selectedDetail); frmDetailEdit.ShowDialog(); if (frmDetailEdit.success) { Header_Details = SelectDetails(selectedHeader.Id); if (AdminAccess == false) { Header_Details = Header_Details.Where(i => i.IsDeleted == false).ToList(); } FillDetailsDataGridView(dgvDetails, Header_Details); } } }