/// <summary> /// insert the record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Add_btn_Click(object sender, EventArgs e) { AddInspectionTestInstructionDetailForm newAddForm = new AddInspectionTestInstructionDetailForm(CommonConstants.MODE_ADD, null); newAddForm.InspectionTestInstructionId = updateData.InspectionTestInstructionId; newAddForm.InspectionTestInstructionCode = updateData.InspectionTestInstructionCode; newAddForm.InspectionTestInstructionText = updateData.InspectionTestInstructionText; newAddForm.ShowDialog(); if (newAddForm.IntSuccess > 0) { GridBind(); if (InspectionTestInstructionDetail_dgv.Rows.Count > 0) { InspectionTestInstructionDetail_dgv.Rows[InspectionTestInstructionDetail_dgv.Rows.Count - 1].Selected = true; InspectionTestInstructionDetail_dgv_CellClick(sender, new DataGridViewCellEventArgs(0, InspectionTestInstructionDetail_dgv.Rows.Count - 1)); InspectionTestInstructionDetail_dgv.FirstDisplayedScrollingRowIndex = InspectionTestInstructionDetail_dgv.Rows.Count - 1; } messageData = new MessageData("mmci00001", Properties.Resources.mmci00001, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); } }
/// <summary> /// passing update data to update form /// </summary> private void BindUpdateInspectionTestInstructionDetailData() { int selectedrowindex = InspectionTestInstructionDetail_dgv.SelectedCells[0].RowIndex; InspectionTestInstructionVo inspTestInstructionVo = (InspectionTestInstructionVo)InspectionTestInstructionDetail_dgv.Rows[selectedrowindex].DataBoundItem; AddInspectionTestInstructionDetailForm newAddForm = new AddInspectionTestInstructionDetailForm(CommonConstants.MODE_UPDATE, inspTestInstructionVo); newAddForm.InspectionTestInstructionText = updateData.InspectionTestInstructionText; newAddForm.ShowDialog(this); if (newAddForm.InspectionTestInstructionId > 0) { updateData.InspectionTestInstructionId = newAddForm.InspectionTestInstructionId; InspectionTestInstructionId = newAddForm.InspectionTestInstructionId; GetInspTestCode(); } GridBind(); InspectionTestInstructionDetail_dgv.Rows[selectedrowindex].Selected = true; InspectionTestInstructionDetail_dgv_CellClick(this, new DataGridViewCellEventArgs(0, selectedrowindex)); InspectionTestInstructionDetail_dgv.FirstDisplayedScrollingRowIndex = selectedrowindex; //if (newAddForm.IntSuccess > 0) //{ // messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null); // logger.Info(messageData); // popUpMessage.Information(messageData, Text); // GridBind(); //} //else if (newAddForm.IntSuccess == 0) //{ // messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null); // logger.Info(messageData); // popUpMessage.Information(messageData, Text); // GridBind(); //} }