Пример #1
0
        /// <summary>
        /// Checks if the same name is present in the parent node. If so, displays a warning.
        /// </summary>
        private void ItemNameTextBox_TextChanged(object sender, EventArgs e)
        {
            bool   throwError;
            string text = ItemNameTextBox.Text;

            if (parent is null)
            {
                throwError = warehouse.Sections.Exists(x => x.Name == text && x.Name != ignoreName) ||
                             string.IsNullOrWhiteSpace(text);
            }
            else
            {
                throwError = parent.Nodes.ContainsKey(text) && text != ignoreName ||
                             string.IsNullOrWhiteSpace(text);
            }

            if (throwError)
            {
                warning |= ItemWarning.NameRepeated;
            }
            else
            {
                warning &= ~ItemWarning.NameRepeated;
            }
            UpdateWarningMessages();
        }
Пример #2
0
        /// <summary>
        /// Makes the required controls visible when Product RadioButton is checked.
        /// </summary>
        private void ProductItemTypeRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            IsSection = false;

            VendorCodeLabel.Visible      = true;
            PriceLabel.Visible           = true;
            PriceTextBox.Visible         = true;
            LeftInStockLabel.Visible     = true;
            LeftInStockNumericUD.Visible = true;
            DescriptionLabel.Visible     = true;
            DescriptionTextBox.Visible   = true;
            PhotoLabel.Visible           = true;
            AddPhotoButton.Visible       = true;
            ImageDirectoryLabel.Visible  = true;
            if (Photo != null)
            {
                DeletePhotoButton.Visible = true;
            }

            SortingCodeLabel.Visible = false;

            SortingVendorCodeTextBox_TextChanged(sender, e);
            PriceTextBox_TextChanged(sender, e);
            if (parent is null)
            {
                warning |= ItemWarning.ProductOutOfSection;
            }
            UpdateWarningMessages();
        }
Пример #3
0
 /// <summary>
 /// Checks if the sorting or vendor code is empty. If so, displays a warning.
 /// </summary>
 private void SortingVendorCodeTextBox_TextChanged(object sender, EventArgs e)
 {
     if (!IsSection && string.IsNullOrWhiteSpace(SortingVendorCodeTextBox.Text))
     {
         warning |= ItemWarning.InvalidVendorCode;
     }
     else
     {
         warning &= ~ItemWarning.InvalidVendorCode;
     }
     UpdateWarningMessages();
 }
Пример #4
0
 /// <summary>
 /// Checks if the price is a double value. If not, displays a warning.
 /// </summary>
 private void PriceTextBox_TextChanged(object sender, EventArgs e)
 {
     if (double.TryParse(PriceTextBox.Text, out double itemPrice) && itemPrice >= 0 || IsSection)
     {
         Price    = itemPrice;
         warning &= ~ItemWarning.InvalidPrice;
     }
     else
     {
         warning |= ItemWarning.InvalidPrice;
     }
     UpdateWarningMessages();
 }