Esempio n. 1
0
 /// <summary>
 /// Alissa Duffy
 /// Updated: 2017/04/21
 ///
 /// Initialize the Split Product Lot Window.
 /// Standardized method.
 /// </summary>
 /// <param name="selectedItem"></param>
 public frmSplitProductLot(ProductLot selectedItem)
 {
     InitializeComponent();
     OldQty      = selectedItem.Quantity ?? 0;
     NewQty      = 0;
     txtOld.Text = OldQty.ToString();
     txtNew.Text = NewQty.ToString();
 }
Esempio n. 2
0
        /// <summary>
        /// Alissa Duffy
        /// Updated: 2017/04/21
        ///
        /// Changes Old Text.
        /// Standardized method.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtOld_TextChanged(object sender, TextChangedEventArgs e)
        {
            int value;

            // Already validated
            Int32.TryParse(txtOld.Text, out value);
            int sum = OldQty + NewQty;

            if (value <= sum && value >= 1)
            {
                OldQty = value;
                NewQty = sum - value;

                // detach event handler to avoid call to txtNew_TextChanged
                txtNew.TextChanged -= txtNew_TextChanged;
                txtNew.Text         = NewQty.ToString();
                txtNew.TextChanged += txtNew_TextChanged;
            }
            // Make sure that the text box does not show data which did not pass validation
            txtOld.Text = OldQty.ToString();
        }