Пример #1
0
        private void addEditPartInfoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PartInformation opi = new PartInformation(oForm);

            opi.ShowDialog();

            int      index      = 0;
            TreeNode AssNode    = oForm.treeView1.SelectedNode;
            TreeNode SubAssNode = opi.child.TreeView.SelectedNode;

            if (index > 0)
            {
                dgvTolInfo.Visible       = false;
                dgvPartInfo.Visible      = false;
                gbOutput.Visible         = false;
                gbDesignComments.Visible = false;
                gbGNComments.Visible     = false;
            }
            else
            {
                dgvTolInfo.Visible       = true;
                dgvPartInfo.Visible      = true;
                gbOutput.Visible         = true;
                gbDesignComments.Visible = true;
                gbGNComments.Visible     = true;
                if (AssNode != null && SubAssNode != null)
                {
                    dgvTolInfo.Rows.Clear();

                    foreach (PartInfo opinfo in opi.m_lsParts)
                    {
                        index = dgvTolInfo.Rows.Add();
                        dgvTolInfo[0, index].Value = (index + 1).ToString();
                        dgvTolInfo[1, index].Value = opinfo.m_sPTNum;
                        dgvTolInfo[2, index].Value = opinfo.m_sUniTolPlus;
                        dgvTolInfo[3, index].Value = opinfo.m_sUniTolMinus;
                    }
                }
                //MessageBox.Show("index = " + index);
            }

            if (index >= 0)
            {
                PartInfo objpi = opi.m_lsParts[index];

                dgvPartInfo.Rows.Clear();

                string[] sArr1 = { "Part Number Number", "Dash Number", "Part Description", "Part Rev", "Tolerance Status", "Tolerance Source", "Nominal Dimension", "Diametral Tolerance", "Bonus Tolerance" };
                string[] sArr2 = { objpi.m_sPTNum, objpi.m_sDashNum, objpi.m_sPTDesc, objpi.m_sPTRev, objpi.m_sTolStatus, objpi.m_sTolSource, objpi.m_sNominalDim, objpi.m_sDiametricTol, objpi.m_sBonusTol };

                for (int i = 0; i <= sArr1.Length - 1; i++)
                {
                    int index1 = dgvPartInfo.Rows.Add();
                    //ssageBox.Show("index1 = "+index1);
                    dgvPartInfo[0, index1].Value = sArr1[index1];
                    dgvPartInfo[1, index1].Value = sArr2[index1];
                }
            }
        }
Пример #2
0
        private void btnAddPrt_Click(object sender, EventArgs e)
        {
            try
            {
                if (btnAddPrt.Text == "Add Part")
                {
                    PartInfo oPInfo = new PartInfo();

                    index = dataGridView1.Rows.Add();

                    oPInfo.m_sPTNum        = tbPTNum.Text.Trim();
                    oPInfo.m_sDashNum      = tbDNum.Text.Trim();
                    oPInfo.m_sPTDesc       = tbPTDesc.Text.Trim();
                    oPInfo.m_sPTRev        = tbPTRev.Text.Trim();
                    oPInfo.m_sTolStatus    = cbTStat.SelectedText;
                    oPInfo.m_sTolSource    = cbTSrc.SelectedText;
                    oPInfo.m_sNominalDim   = tbNLDim.Text.Trim();
                    oPInfo.m_sDiametricTol = tbDLTlc.Text.Trim();
                    oPInfo.m_sBonusTol     = tbBTlc.Text.Trim();
                    oPInfo.m_sBilateralTol = tbBiTol.Text.Trim();
                    oPInfo.m_sUniTolPlus   = tbUTPlus.Text.Trim();
                    oPInfo.m_sUniTolMinus  = tbUTMinus.Text.Trim();
                    m_lsParts.Add(oPInfo);

                    dataGridView1[0, index].Value = (index + 1).ToString();
                    dataGridView1[1, index].Value = oPInfo.m_sPTNum;
                    dataGridView1[2, index].Value = oPInfo.m_sUniTolPlus;
                    dataGridView1[3, index].Value = oPInfo.m_sUniTolMinus;

                    tbPTNum.Text   = "";
                    tbDNum.Text    = "";
                    tbPTDesc.Text  = "";
                    tbPTRev.Text   = "";
                    tbNLDim.Text   = "";
                    tbDLTlc.Text   = "";
                    tbBTlc.Text    = "";
                    tbBiTol.Text   = "";
                    tbUTPlus.Text  = "";
                    tbUTMinus.Text = "";
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee + "");
            }
        }