コード例 #1
0
        /// <summary>
        /// Takes part of the ischanged function for chkPO, prompts a user to enter the new part order, then saves it in settings
        /// </summary>
        /// <param name="sender">frmMain</param>
        /// <param name="e">mnuEditTech</param>
        private void mnuEditPart_Click(object sender, EventArgs e)
        {
            using (frmPO poForm = new frmPO())
            {
                poForm.ShowDialog();

                if (poForm.po == null || poForm.po == "")
                {
                    MessageBox.Show("Purchase Order cannot be included on the label(s) if the purchase Order field is empty.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Settings.Default.isChkTech = false;
                    Settings.Default.partorder = "";
                }
                else
                {
                    Settings.Default.partorder = poForm.po;
                }
                validateSettings();
            }
        }
コード例 #2
0
        /// <summary>
        /// Handles the checking and unchecking of chkInjector. Asks the user if they would like to change the
        /// PO field. If so, runs a form to take that requested input. notices a P.O. field that is empty
        /// and then force unchecks the box.
        /// </summary>
        /// <param name="sender">frmMain</param>
        /// <param name="e">chkInjector</param>
        /// <seealso cref="mnuEditPart_Click(object, EventArgs)"/>
        private void chkInjector_Click(object sender, EventArgs e)
        {
            if (chkInjector.Checked == true)
            {
                var selection = MessageBox.Show("Do you wish to change the unit's Purchase Order?", "Change Purchase Order?", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                if (selection.Equals(DialogResult.Yes))
                {
                    using (frmPO poForm = new frmPO())
                    {
                        poForm.ShowDialog();

                        if (poForm.po == null || poForm.po == "")
                        {
                            MessageBox.Show("Purchase Order cannot be included on the label if the Purchase Order Field is empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Settings.Default.partorder = "";
                            Settings.Default.isChkInj  = false;
                        }
                        else
                        {
                            Settings.Default.partorder = poForm.po;
                            Settings.Default.isChkInj  = true;
                        }
                    }
                }
                else if (selection == DialogResult.No && txtPO.Text.Equals(""))
                {
                    MessageBox.Show("Purchase Order cannot be included on the label if the Purchase Order Field is empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Settings.Default.isChkInj = false;
                }
                else
                {
                    Settings.Default.isChkInj = true;
                }
            }
            else
            {
                Settings.Default.isChkInj = false;
            }
            validateSettings();
        }