private void HandleRfid ( [NotNull] string rfid ) { _goodRecord = null; SetStatus(new bool?()); _descriptionBox.Clear(); PodsobRecord podsob = Kladovka.FindPodsobByBarcode(rfid); if (!ReferenceEquals(podsob, null) && !ReferenceEquals(podsob.Record, null)) { _descriptionBox.Text = podsob.Record.Description; bool status = CheckPodsob(rfid, podsob); SetStatus(status); if (status) { } } else { SetStatus(false); } }
private void MainForm_FormClosed ( object sender, FormClosedEventArgs e ) { // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (!ReferenceEquals(Kladovka, null)) { Kladovka.Dispose(); } }
public MainForm() { _bindingList = new BindingList <StatusRecord>(); InitializeComponent(); _bindingSource.DataSource = _bindingList; Log = new TextBoxOutput(_logBox); Kladovka = new Kladovka(Log); IdleManager = new IrbisIdleManager ( Kladovka.Connection, 60 * 1000 ); IdleManager.Idle += IdleManager_Idle; }
private async void _reportButton_Click ( object sender, EventArgs e ) { string place = _placeBox.Text.Trim(); if (string.IsNullOrEmpty(place)) { WriteLine("Не задано место хранения"); return; } ReadRecordCommand.ThrowOnVerify = false; _reportButton.Enabled = false; _confirmButton.Enabled = false; StringBuilder list = new StringBuilder(); Task task = Task.Factory.StartNew ( () => { long[] all = Kladovka.GetAllPodsob(place); long[] marked = Kladovka.GetAllMarked(place); long[] diff = all.Except(marked) .OrderBy(x => x) .ToArray(); Write("Build list (" + diff.Length + "): "); int count = 0; foreach (long number in diff) { count++; if (count % 10 == 1) { Write((count - 1) + " "); } string line = string.Format ( "{0} \tНет описания", number ); int[] mfns = Kladovka.FindRecords ( "\"IN={0}\"", number ); if (mfns.Length == 1) { MarcRecord record = Kladovka.ReadMarcRecord(mfns[0]); line = string.Format ( "{0} \t{1}", number, record.Description ); } list.AppendLine(line); } } ); try { await task; } catch (Exception ex) { ex = ExceptionUtility.Unwrap(ex); ExceptionBox.Show(this, ex); } _reportButton.Enabled = true; _confirmButton.Enabled = true; WriteLine(string.Empty); WriteDelimiter(); string text = list.ToString(); PlainTextForm.ShowDialog(this, text); }