示例#1
0
 /// <summary>
 /// To either show or hide the approperiate textboxes for entry to the user.
 /// </summary>
 /// <param name="sender">RBtn_PerPound_CheckedChanged</param>
 /// <param name="e">Not Used</param>
 private void RBtn_PerPound_CheckedChanged(object sender, EventArgs e)
 {
     TxtBx_PerItem.Visible = false;
     Lbl_PerItem.Visible   = false;
     TxtBx_PerItem.Clear();
     TxtBx_PerPound.Visible = true;
     Lbl_PerPound.Visible   = true;
     TxtBx_PerPound.Text    = POUND_START;
     TxtBx_PerPound.Focus();
     TxtBx_PerPound.SelectAll();
     sl.SetCategory = SHIP_COST.B;
 }
示例#2
0
 /// <summary>
 /// To test for bad input
 /// </summary>
 /// <returns>Upon bad input, it returns false so the process can stop until good data is entered</returns>
 private bool TestForInvalid()
 {
     Err_Provider.Clear();
     //Condition will test bool if it can prase or not, as well as, if the value is too low
     if (RBtn_PerItem.Checked == true)
     {
         if (!(int.TryParse(TxtBx_PerItem.Text, out _testPerItem)) || _testPerItem <= 0)
         {
             Err_Provider.SetError(TxtBx_PerItem, ERR_ITEMS);
             TxtBx_PerItem.Focus();
             TxtBx_PerItem.SelectAll();
             return(false);
         }
         else
         {
             sl.NumItems = _testPerItem;
             return(true);
         }
     }
     //Condition will test bool if it can prase or not, as well as, if the value is too low
     else if (RBtn_PerPound.Checked == true)
     {
         if (!(double.TryParse(TxtBx_PerPound.Text, out _testPerPound)) || _testPerPound <= 0)
         {
             Err_Provider.SetError(TxtBx_PerPound, ERR_LBS);
             TxtBx_PerPound.Focus();
             TxtBx_PerPound.SelectAll();
             return(false);
         }
         else
         {
             sl.NumPounds = _testPerPound;
             return(true);
         }
     }
     //If everything checks out, it will return true and allow the code to show the message box salesInvoice
     else
     {
         return(true);
     }
 }