public Item(string name, string barcode, DateTime experirationDate, StorageMedium storageMedium) { this.Name = name; this.Barcode = barcode; this.ExpirationDate = experirationDate; this.StorageMedium = storageMedium; }
public virtual int _GetUniqueIdentifier() { var hashCode = 399326290; hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (FileName?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (FolderPath?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (MaxFileSize?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (AllowedExtensions?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (Blob?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (StorageMedium?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (UploadedBy?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (UploadDateTime?.GetHashCode() ?? 0); return(hashCode); }
void AddButton_Click(object sender, RoutedEventArgs e) { bool ProperlyFilled = true; if (string.IsNullOrEmpty(itemNameTextBox.Text)) { ProperlyFilled = false; itemNameEmpty.Foreground = Brushes.Red; } if (expirationDateSelection.SelectedDate is null) { ProperlyFilled = false; expirationEmpty.Foreground = Brushes.Red; } if (storageMediumSelection.SelectedIndex == -1) { ProperlyFilled = false; storageMediumEmpty.Foreground = Brushes.Red; } if (string.IsNullOrEmpty(itemAmountTextBox.Text)) { ProperlyFilled = false; amountEmpty.Foreground = Brushes.Red; } if (ProperlyFilled) { List <Item> newItems = new List <Item>(); itemName = itemNameTextBox.Text; itemExpirationDate = expirationDateSelection.SelectedDate.Value; itemStorageMedium = (StorageMedium)storageMediumSelection.SelectedIndex; for (int i = 0; i < int.Parse(itemAmountTextBox.Text);) { BarcodeInputWindow barcodeInputWindow = new BarcodeInputWindow(i += 1, itemExpirationDate); if (barcodeInputWindow.ShowDialog().Value) { newItems.Add(new Item(itemName, barcodeInputWindow.Barcode, itemExpirationDate, itemStorageMedium)); } else { Close(); return; } } Storage.Add(newItems); Close(); } }