예제 #1
0
        /// <summary>
        /// load add screen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Add_btn_Click(object sender, EventArgs e)
        {
            InspectionItemVo inspectionInVo = new InspectionItemVo();

            inspectionInVo.InspectionProcessId   = InspectionProcessId;
            inspectionInVo.InspectionProcessCode = InspectionProcessCode;
            inspectionInVo.InspectionProcessName = InspectionProcessName;

            AddInspectionItemForProcessForm newAddForm = new AddInspectionItemForProcessForm(CommonConstants.MODE_ADD, inspectionInVo);

            newAddForm.ShowDialog();

            if (newAddForm.IntSuccess > 0)
            {
                messageData = new MessageData("mmci00001", Properties.Resources.mmci00001, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);
            }

            is_Copied = newAddForm.is_Copied;

            GridBind();

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

                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;

                if ((InspectionItem_dgv.Rows[row.Index].Cells["colInsSpecification"].Value != null &&
                     InspectionItem_dgv.Rows[row.Index].Cells["colInsSpecification"].Value.ToString() == Properties.Resources.mmci00024) || is_Copied == true)
                {
                    InspectionSpecification_btn_Click(sender, e);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// selects inspection record for updation and show Inspection form
        /// </summary>
        private void BindUpdateInspectionItemData()
        {
            int selectedrowindex = InspectionItem_dgv.SelectedCells[0].RowIndex;

            InspectionItemVo InspectionUpdateVo = (InspectionItemVo)InspectionItem_dgv.Rows[selectedrowindex].DataBoundItem;

            AddInspectionItemForProcessForm newAddForm = new AddInspectionItemForProcessForm(CommonConstants.MODE_UPDATE, InspectionUpdateVo);

            newAddForm.ShowDialog(this);

            if (newAddForm.IntSuccess > 0)
            {
                messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);
            }
            else if (newAddForm.IntSuccess == 0)
            {
                messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);
            }

            if (newAddForm.ReturnProcessId > 0)
            {
                InspectionProcessId = newAddForm.ReturnProcessId;
            }
            //LoadInspectionProcessCombo();
            //InspectionProcess_cmb.SelectedValue = InspectionProcessId;
            GridBind();

            InspectionItem_dgv.Rows[selectedrowindex].Selected = true;
            InspectionItem_dgv_CellClick(this, new DataGridViewCellEventArgs(0, selectedrowindex));
            InspectionItem_dgv.FirstDisplayedScrollingRowIndex = selectedrowindex;

            if (InspectionItem_dgv.Rows[selectedrowindex].Cells["colInsSpecification"].Value != null &&
                InspectionItem_dgv.Rows[selectedrowindex].Cells["colInsSpecification"].Value.ToString() == Properties.Resources.mmci00024)
            {
                InspectionSpecification_btn_Click(this, new EventArgs());
            }
        }
예제 #3
0
        private void ItemCopy_cntxMnu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (string.IsNullOrEmpty(e.ClickedItem.Text) || InspectionItem_dgv.Rows.Count == 0)
            {
                return;
            }

            if (InspectionItem_dgv.SelectedRows.Count > 0)
            {
                ItemCopy_cntxMnu.Items.Clear();

                this.Cursor = Cursors.WaitCursor;

                int selectedrowindex = InspectionItem_dgv.SelectedCells[0].RowIndex;

                InspectionItemVo InspectionCopyVo = (InspectionItemVo)InspectionItem_dgv.Rows[selectedrowindex].DataBoundItem;

                InspectionItemVo inspectionInVo = new InspectionItemVo();
                inspectionInVo.InspectionProcessId   = InspectionProcessId;
                inspectionInVo.InspectionProcessCode = InspectionProcessCode;
                inspectionInVo.InspectionProcessName = InspectionProcessName;
                inspectionInVo.InspectionItemIdCopy  = InspectionCopyVo.InspectionItemId;
                inspectionInVo.InspectionItemName    = InspectionCopyVo.InspectionItemName;

                AddInspectionItemForProcessForm newAddForm = new AddInspectionItemForProcessForm(CommonConstants.MODE_ADD, inspectionInVo);

                newAddForm.ShowDialog();

                if (newAddForm.IntSuccess > 0)
                {
                    messageData = new MessageData("mmci00001", Properties.Resources.mmci00001, null);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);
                }

                is_Copied = newAddForm.is_Copied;

                GridBind();

                if (InspectionItem_dgv.Rows.Count > 0 && InspectionItem_dgv.Columns.Count > 0 && InspectionItem_dgv.Columns["ColInspectionItemId"] != null)
                {
                    int searchItemId;
                    if (newAddForm.IntSuccess > 0)
                    {
                        searchItemId = newAddForm.IntSuccess;
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                        return;
                    }

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

                    if (row == null)
                    {
                        this.Cursor = Cursors.Default; return;
                    }

                    InspectionItem_dgv.Rows[row.Index].Selected = true;
                    InspectionItem_dgv_CellClick(sender, new DataGridViewCellEventArgs(0, row.Index));
                    InspectionItem_dgv.FirstDisplayedScrollingRowIndex = row.Index;

                    if ((InspectionItem_dgv.Rows[row.Index].Cells["colInsSpecification"].Value != null &&
                         InspectionItem_dgv.Rows[row.Index].Cells["colInsSpecification"].Value.ToString() == Properties.Resources.mmci00024) || is_Copied == true)
                    {
                        InspectionSpecification_btn_Click(sender, e);
                    }
                }
                this.Cursor = Cursors.Default;
            }
        }