public override string ToString() { string tokenTypeString = (Type + " ").Substring(0, 16); string location = $"{FromLine.ToString()}:{FromCol.ToString()}-{ToLine.ToString()}:{ToCol.ToString()}"; location = (location + " ").Substring(0, 10); return($"{tokenTypeString} - {location} - '{this.Text ?? ""}'"); }
private void Line_UpdateButton_Click(object sender, RoutedEventArgs e) { using (var db = new MTSDB()) { var tl = (from t in db.ToLine where t.SMN == Line_TrackingCodeTextBox.Text select t).SingleOrDefault(); if (tl == null) { MessageBox.Show("Part Not Found!! Please Verify", "Error", MessageBoxButton.OK, MessageBoxImage.Error); Line_TrackingCodeTextBox.Clear(); return; } CurrentPart = tl.Part; int qty = 0; if (int.TryParse(Line_ReturnQtyTextBox.Text, out qty) == false || (qty == 0)) { MessageBox.Show("Please Verify Quantity", "Alert", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } FromLine fl = new FromLine(); fl.ToLineRecord = tl; fl.Quantity = qty; fl.Part = tl.Part; fl.Timestamp = DateTime.Now; tl.Balance -= qty; tl.Part.Quantity += qty; tl.Part.FromLineRecords.Add(fl); db.SaveChanges(); MessageBox.Show("Inventory Updated", "Information", MessageBoxButton.OK, MessageBoxImage.Information); this.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { Line_ReturnQtyTextBox.Clear(); Line_TrackingCodeTextBox.Clear(); DisplayParts.Clear(); Stores_PartGrid.DataContext = null; Stores_PartGrid.DataContext = DisplayParts; })); } }
/// <summary> /// Formats the location according to script preferences /// </summary> /// <param name="script">The script.</param> public string FormatLocation(Script script) { if (IsClrLocation) { return("[clr]"); } if (FromLine == ToLine) { if (FromChar == ToChar) { return($"(Line {FromLine.ToString()}, Position {FromChar.ToString()})"); } return($"(Line {FromLine.ToString()}, Position {FromChar.ToString()}-{ToChar.ToString()})"); } return($"(Line {FromLine.ToString()}, Position {FromChar.ToString()}-{ToLine.ToString()},{ToChar.ToString()})"); }
/// <summary> /// Returns a <see cref="System.String" /> that represents this instance. /// </summary> /// <returns> /// A <see cref="System.String" /> that represents this instance. /// </returns> public override string ToString() { return($"{(IsStepStop ? "*" : " ")} ({FromLine.ToString()}, {FromChar.ToString()}) -> ({ToLine.ToString()}, {ToChar.ToString()})"); }