/// <summary> /// Fills all user records to gridview control /// </summary> protected void GridBind(InspectionFormatVo conditionInVo) { if (conditionInVo == null) { return; } Process_btn.Enabled = false; Update_btn.Enabled = false; Delete_btn.Enabled = false; InspectionFormatDetails_dgv.DataSource = null; ValueObjectList <InspectionFormatVo> outVo = null; try { outVo = (ValueObjectList <InspectionFormatVo>)base.InvokeCbm(new GetInspectionFormatMasterMntCbm(), conditionInVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } if (outVo == null || outVo.GetList() == null || outVo.GetList().Count == 0) { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); return; } InspectionFormatDetails_dgv.AutoGenerateColumns = false; BindingSource bindingSource1 = new BindingSource(outVo.GetList(), null); if (bindingSource1 != null && bindingSource1.Count > 0) { InspectionFormatDetails_dgv.DataSource = bindingSource1; } else { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); } ChangeGridDataColorForRelationDataCheck(); InspectionFormatDetails_dgv.ClearSelection(); }
/// <summary> /// binds datasource /// </summary> /// <param name="outVo"></param> private void BindDataSource(List <InspectionFormatVo> outVo) { InspectionFormatDetails_dgv.AutoGenerateColumns = false; BindingSource bindingSource1 = new BindingSource(outVo, null); if (bindingSource1 != null && bindingSource1.Count > 0) { InspectionFormatDetails_dgv.DataSource = bindingSource1; } else { messageData = new MessageData("tpci00006", Properties.Resources.mmci00006, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); } InspectionFormatDetails_dgv.ClearSelection(); }
private void InspectionFormatDetails_dgv_MouseClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right || InspectionFormatDetails_dgv.RowCount == 0 || InspectionFormatDetails_dgv.SelectedCells.Count == 0) { return; } DataGridView.HitTestInfo hti = InspectionFormatDetails_dgv.HitTest(e.X, e.Y); if (hti.RowIndex < 0 || hti.ColumnIndex < 0) { return; } if (InspectionFormatDetails_dgv.CurrentRow.Cells["colInspectionFormatId"].Value != null) { FormatCopy_cntxMnu.Items.Clear(); FormatCopy_cntxMnu.Items.Add("Copy"); Point relativeMousePosition = InspectionFormatDetails_dgv.PointToClient(Cursor.Position); FormatCopy_cntxMnu.Show(InspectionFormatDetails_dgv, relativeMousePosition); } }