Пример #1
0
        private void InspectionTestInstruction_btn_Click(object sender, EventArgs e)
        {
            int selectedrowindex             = InspectionItem_dgv.SelectedCells[0].RowIndex;
            InspectionItemVo InspectionAddVo = (InspectionItemVo)InspectionItem_dgv.Rows[selectedrowindex].DataBoundItem;

            InspectionTestInstructionVo inVo = new InspectionTestInstructionVo();

            inVo.InspectionTestInstructionId   = InspectionAddVo.InspectionTestInstructionId;
            inVo.InspectionTestInstructionCode = InspectionAddVo.InspectionTestInstructionCode;
            inVo.InspectionItemId   = InspectionAddVo.InspectionItemId;
            inVo.InspectionItemCode = InspectionAddVo.InspectionItemCode;
            inVo.InspectionItemName = InspectionAddVo.InspectionItemName;

            AddInspectionTestInstructionForItemForm newAddForm = new AddInspectionTestInstructionForItemForm(CommonConstants.MODE_ADD, inVo);

            newAddForm.InspectionProcessId = InspectionProcessId;
            newAddForm.ShowDialog();
            if (newAddForm.InspectionItemId > 0)
            {
                InspectionFormatProcessBuzzLogic getprocessid = new InspectionFormatProcessBuzzLogic();
                InspectionReturnVo invo = new InspectionReturnVo();
                invo.InspectionItemId = newAddForm.InspectionItemId;
                InspectionReturnVo getInspectionVo = getprocessid.RefreshAllFormGrid(invo);
                if (getInspectionVo != null && getInspectionVo.InspectionProcessId > 0)
                {
                    InspectionProcessId = getInspectionVo.InspectionProcessId;
                    //LoadInspectionProcessCombo();
                    //InspectionProcess_cmb.SelectedValue = InspectionProcessId;
                }
            }

            GridBind();

            if (InspectionItem_dgv.Rows.Count > 0 && InspectionItem_dgv.Columns.Count > 0 && InspectionItem_dgv.Columns["ColInspectionItemId"] != null)
            {
                int searchItemId;
                if (newAddForm.InspectionItemId > 0)
                {
                    searchItemId = newAddForm.InspectionItemId;
                }
                else
                {
                    searchItemId = InspectionAddVo.InspectionItemId;
                }

                DataGridViewRow row = InspectionItem_dgv.Rows
                                      .Cast <DataGridViewRow>()
                                      .FirstOrDefault(r => r.Cells["ColInspectionItemId"].Value.ToString().Equals(searchItemId.ToString()));

                if (row == null)
                {
                    return;
                }

                InspectionItem_dgv.Rows[row.Index].Selected = true;
                InspectionItem_dgv_CellClick(sender, new DataGridViewCellEventArgs(0, row.Index));
                InspectionItem_dgv.FirstDisplayedScrollingRowIndex = row.Index;
            }
        }
Пример #2
0
        private void InspectionTestInstruction_btn_Click(object sender, EventArgs e)
        {
            int selectedrowindex             = InspectionItem_dgv.SelectedCells[0].RowIndex;
            InspectionItemVo InspectionAddVo = (InspectionItemVo)InspectionItem_dgv.Rows[selectedrowindex].DataBoundItem;
            AddInspectionTestInstructionForItemForm newAddForm = new AddInspectionTestInstructionForItemForm(CommonConstants.MODE_ADD, null);

            newAddForm.ShowDialog();
        }