public void Scan() { if (Scanned != null) { Scanned.Invoke(this, new ScannedDataEventArgs(new[] { "NO_BARCODE_SCANNER" })); } }
public IncomeForm() { InitializeComponent(); _mode = CarScanMode.BoxScan; scannedDelegate = new Scanned(OnScanned); }
private void PatternScan(byte[] blockData) { var magic = "CWAV".Select(c => (byte)c).ToArray(); var indexes = ScanBuffer(blockData, magic); foreach (int index in indexes) { var sz = BitConverter.ToInt32(blockData, index + 0x0C); // Probably a Mismatch // Or an invalid CWAV File Header // Read to End of Block and pray if (index + sz > blockData.Length) { sz = blockData.Length - index; } byte[] fileData = new byte[sz]; Buffer.BlockCopy(blockData, index, fileData, 0, sz); var cwav = new CwavFile(fileData) { Tag = "0x" + index.ToString("X8") }; Scanned.Add(cwav); } }
public ReturnBoxForm() { InitializeComponent(); //_mode = CarScanMode.BoxScan; scannedDelegate = new Scanned(OnScanned); }
public InventarForm() { InitializeComponent(); scannedDelegate = new Scanned(OnScanned); }
internal ScannedEvent InvokeEvent(ScannedEvent arg) { if (_api.ValidateEvent(arg)) { Scanned?.Invoke(_api, arg); } return(arg); }
/// <summary> /// Manually initiate the scan /// </summary> /// <remarks> /// The scanned barcode will be received in the <see cref="ScannedDataEventArgs.Data"/> /// parameter when the <see cref="IBarcodeScanner.Scanned"/> event is fired /// </remarks> public void Scan() { if (Scanned != null) { Scanned.Invoke(this, new ScannedDataEventArgs(new[] { new BarcodeData { Text = "NO_BARCODE_SCANNER" } })); } }
private void OnBarcodeRead(object sender, BarcodeReadEventArgs bre) { scannedData[0] = bre.strDataBuffer; if (Scanned != null) { Scanned.Invoke(this, new ScannedDataEventArgs(scannedData)); } reader.ScannerOn = false; scannerStatus = ScannerStatus.Opened; }
public IHttpActionResult ScanItemWithSetPriceForQtyWithLimit(int id, double weight, int requiredQty, double setPrice, int limit) { var lineItem = items.FirstOrDefault((p) => p.Id == id); if (lineItem == null) { return(NotFound()); } Scanned scanned = new Scanned(lineItem, weight, requiredQty, setPrice, limit, true); Receipt.Sum(); return(Ok(Receipt.OrderTotal)); }
private void HandleData(ReaderData reader) { List <string> list = new List <string>(); list.Add(reader.Text); if (Scanned != null) { Scanned.Invoke(this, new ScannedDataEventArgs(list.ToArray())); } scannerStatus = ScannerStatus.Opened; }
// GET: api/Items/{id} public IHttpActionResult ScanItem(int id) { var lineItem = items.FirstOrDefault((p) => p.Id == id); if (lineItem == null) { return(NotFound()); } Scanned scanned = new Scanned(lineItem); Receipt.Sum(); return(Ok(Receipt.OrderTotal)); }
private void HandleData(ReaderData data) { if (Scanned != null) { var barcodeData = new BarcodeData { Text = data.Text, BarcodeType = (BarcodeTypes)data.Type }; Scanned.Invoke(this, new ScannedDataEventArgs(new[] { barcodeData })); } scannerStatus = ScannerStatus.Opened; }
// Buy N items get M at %X off. public IHttpActionResult ScanItemBuyNGetMAtX(int id, double weight, int requiredQty, double percentOff, int discountedQty) { var lineItem = items.FirstOrDefault((p) => p.Id == id); if (lineItem == null) { return(NotFound()); } Scanned scanned = new Scanned(lineItem, weight, requiredQty, percentOff, discountedQty); Receipt.Sum(); return(Ok(Receipt.OrderTotal)); }
private void InventarForm_Load(object sender, EventArgs e) { this.Width = 235; this.Height = 295; textBox1.Focus(); if (_currentMode == InventarFormMode.SimpleIncome) { this.label1.Text = "Введите № накладной"; this.Text = "Накладные"; } //string invId = ActionsClass.Action.FindOpenInventar(); //ActionsClass.Action.BeginScan(); //ActionsClass.Action.OnActionCompleted += new ActionsClass.ActionCompleted(Action_OnActionCompleted); ScanClass.Scaner.InitScan(); //ScanClass.Scaner.OnScanned += new Scanned(Scanned); this.Refresh(); ScanClass.Scaner.OnScanned += scannedDelegate; TSDServer.Scanned del = new Scanned(OnScanned); enableScan = true; if (_currentMode == InventarFormMode.DefaultInventar) { if ( //Program.СurrentInvId != string.Empty || (Program.СurrentInvId = ActionsClass.Action.FindOpenInventar()) != string.Empty ) { this.BeginInvoke(del, Program.СurrentInvId); //OnScanned(Program.СurrentInvId); } } else { if ( //Program.СurrentInvId != string.Empty || (Program.СurrentIncomeId = ActionsClass.Action.FindOpenInventar(InventarFormMode.SimpleIncome)) != string.Empty ) { this.BeginInvoke(del, Program.СurrentIncomeId); //OnScanned(Program.СurrentInvId); } } _mevt.Set(); }
// Marked-down public IHttpActionResult ScanItemWithMarkdown(int id, double weight, double markdown) { var lineItem = items.FirstOrDefault((p) => p.Id == id); if (lineItem == null) { return(NotFound()); } if (lineItem.Eaches) { weight = 1.00; } Scanned scanned = new Scanned(lineItem, weight, markdown); Receipt.Sum(); return(Ok(Receipt.OrderTotal)); }
private void GetScannerStatusWorker() { running = true; try { while (running) { SystemLibNet.Api.SysWaitForEvent(Handle, OBReadLibNet.Def.OBR_NAME_EVENT, 2000 /*timeout SystemLibNet.Def.INFINITE*/); //Wait event int size = 0, code = 0; byte number = 0, len = 0; var result = OBReadLibNet.Api.OBRGetStatus(ref size, ref number); CheckCasioResult(result); if (number > 0) { var buffer = new byte[size]; result = OBReadLibNet.Api.OBRGets(buffer, ref code, ref len); CheckCasioResult(result); result = OBReadLibNet.Api.OBRClearBuff(); CheckCasioResult(result); if (Scanned != null) { var barcode = Encoding.Default.GetString(buffer, 0, buffer.Length).Trim(); var barcodeData = new BarcodeData { Text = barcode }; Scanned.Invoke(this, new ScannedDataEventArgs(new[] { barcodeData })); } } } } catch (ThreadAbortException) { } finally { running = false; } }
// GET: api/Items/GetId?id={id}&weight={weight} public IHttpActionResult RemoveItemEnterWeight(int id, double weight) { var lineItem = items.FirstOrDefault((p) => p.Id == id); if (lineItem == null) { return(NotFound()); } if (lineItem.Eaches) { weight = 1.00; } Scanned scanned = new Scanned(); scanned.Remove(lineItem, weight); Receipt.Sum(); return(Ok(Receipt.OrderTotal)); }
public IncomeForm(System.Collections.Generic.Dictionary<string,//car System.Collections.Generic.Dictionary<string, //TORG12 System.Collections.Generic.Dictionary<string,//Box navcode Boxes>>> ttnStruct, string barCode) { InitializeComponent(); scannedDelegate = new Scanned(OnScanned); TtnStruct = ttnStruct; _currentTTNBarcode = barCode; _mode = CarScanMode.CarsScan; foreach (string incomeDoc in TtnStruct[_currentTTNBarcode].Keys) {//цикл по всем накладным foreach (string navCodeBox in TtnStruct[_currentTTNBarcode][incomeDoc].Keys) {//цикл по всем коробам этой накладной totalQtyCar += 1; } } }
private void OnScanned(IReadOnlyBuyer buyer, Product product, int remainingAmount) { Scanned?.Invoke(this, new CashboxScanEventArgs(buyer, this, product, remainingAmount)); }
void BoxScanModeScanned(string barcode) { if (this.InvokeRequired) { TSDServer.Scanned del = new Scanned(OnScanned); this.Invoke(del, barcode); } else { this.bkLabel.Visible = false; this.docLabel.Visible = false; this.errLabel.Visible = false; this.txtLabel.Visible = false; this.dateLabel.Visible = false; this.textBox1.Text = barcode; this.textBox1.SelectAll(); if (barcode.StartsWith("3") && barcode.Length == 13) { ProductsDataSet.DocsTblRow[] rows = ActionsClass.Action.GetDataByDocIdAndType(barcode, (byte)TSDUtils.ActionCode.IncomeBox); if (rows != null && rows.Length > 0) { //919051|002352151|11|1|76|2011-09-07|7|7|7|002352151||07.09.2011 //919051|3001012060898|7|1|76|2011-09-07|7|7|7|919051|002352151|07.09.2011 //916941|002352272|11|1|11|2011-09-07|7|7|7|002352272||07.09.2011 //916941|3001012040609|7|1|11|2011-09-07|7|7|7|916941|002352272|07.09.2011 //002352272 = text2 try { /* ProductsDataSet.DocsTblRow[] boxrows = ActionsClass.Action.GetDataByDocIdAndType(barcode, (byte)TSDUtils.ActionCode.IncomeBox);*/ if (rows.Length > 0) { string naklNum = rows[0].Text2; /* ProductsDataSet.DocsTblRow[] naklrows = ActionsClass.Action.GetDataByNavCodeAndType(rows[0].NavCode, (byte)TSDUtils.ActionCode.BoxIncomes);*/ ProductsDataSet.DocsTblRow[] naklrows1 = ActionsClass.Action.GetDataByDocIdAndType(naklNum, (byte)TSDUtils.ActionCode.BoxIncomes); if (naklrows1.Length > 0) { this.docLabel.Text = string.Format("По накладной №{0} {1} коробов", naklNum, naklrows1.Length); ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.IncomeBox); ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.IncomeBox); } else throw new ApplicationException("Накладных не найдено!"); } else throw new ApplicationException("Номер короба не определен!"); } catch (Exception err) { this.docLabel.Text = err.Message; ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.DocNotFound); ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.DocNotFound); } ProductsDataSet.DocsTblRow row = rows[0]; this.bkLabel.Visible = true; this.bkLabel.Text = string.Format("ШК: {0}", barcode); this.docLabel.Visible = true; this.txtLabel.Visible = true; this.dateLabel.Visible = true; this.dateLabel.Text = row.Text3; currentdoc_rows = ActionsClass.Action.GetDataByDocIdAndType(barcode, (byte)TSDUtils.ActionCode.BoxWProducts); RefreshData(barcode); //string.Format( //"Дата: {0}", DateTime.Today.ToString("dd.MM.yyyy")); /* ScannedProductsDataSet.ScannedBarcodesRow scannedRow = ActionsClass.Action.AddScannedRow( long.Parse(barcode), (byte)TSDUtils.ActionCode.IncomeBox, barcode, 0, 0); scannedRow.FactQuantity += 1; */ //ActionsClass.Action.IncomeBoxAction(scannedRow); } else { this.errLabel.Text = string.Format("Это чужой короб!"); this.errLabel.Visible = true; ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.StrangeBox); ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.StrangeBox); } this.Refresh(); } else { _currentBoxBarcode = string.Empty; this.errLabel.Text = string.Format("Это не ШК короба!", barcode); this.errLabel.Visible = true; ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.DocNotFound); ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.DocNotFound); } // this.textBox1.SelectAll(); } }
void CarScanModeScaneed(string barcode) { if (this.InvokeRequired) { TSDServer.Scanned del = new Scanned(OnScanned); this.Invoke(del, barcode); } else { this.bkLabel.Visible = false; this.docLabel.Visible = false; this.errLabel.Visible = false; this.txtLabel.Visible = false; this.dateLabel.Visible = false; this.textBox1.Text = barcode; this.textBox1.SelectAll(); if (barcode.StartsWith("3") && barcode.Length == 13) { lblQtySku.Visible = true; //int totalQty = TtnStruct[_currentTTNBarcode].Keys.Count; bool found = false; foreach (string incomeDoc in TtnStruct[_currentTTNBarcode].Keys) {//цикл по всем накладным foreach (string navCodeBox in TtnStruct[_currentTTNBarcode][incomeDoc].Keys) {//цикл по всем коробам этой накладной if ( TtnStruct[_currentTTNBarcode][incomeDoc][navCodeBox].Barcode == barcode) { this.bkLabel.Visible = true; this.bkLabel.Text = string.Format("ШК: {0}", barcode); this.docLabel.Visible = true; this.docLabel.Text = string.Format ("Накладная № {0}", incomeDoc);//row.Text2); this.txtLabel.Visible = true; this.dateLabel.Visible = true; this.dateLabel.Text = TtnStruct[_currentTTNBarcode][incomeDoc][navCodeBox].DateLabel; TtnStruct[_currentTTNBarcode][incomeDoc][navCodeBox].Accepted = true; ScannedProductsDataSet.ScannedBarcodesRow scannedRow = ActionsClass.Action.FindByBarcodeDocTypeDocId( TtnStruct[_currentTTNBarcode][incomeDoc][navCodeBox].Barcode, (byte)TSDUtils.ActionCode.CarsBoxes, _currentTTNBarcode); if (scannedRow == null) { totalIncomeCar++; //записываем в БД ActionsClass.Action.IncomeCarBoxAction(_currentTTNBarcode, TtnStruct[_currentTTNBarcode][incomeDoc][navCodeBox]); } else { this.errLabel.Text = string.Format("Короб уже принят!"); this.errLabel.Visible = true; ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.AlreadyAccepted); ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.AlreadyAccepted); } found = true; } } } lblQtySku.Text = string.Format("Принято {0} из {1} коробов", totalIncomeCar, totalQtyCar); if (!found) { this.errLabel.Text = string.Format("Короб не в данной ТТН!"); this.errLabel.Visible = true; ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.StrangeBox); ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.StrangeBox); } #region oldcode /*try { //сравнение ШК данного и штрихкода поставки //накладная и коробка должны соответствовать if (barcode == TtnStruct[_currentTTNBarcode][incomeDoc][row.NavCode].Barcode) { //если ок - ставим признак "принят" TtnStruct[_currentTTNBarcode][incomeDoc][row.NavCode].Accepted = true; this.bkLabel.Visible = true; this.bkLabel.Text = string.Format("ШК: {0}", barcode); this.docLabel.Visible = true; this.docLabel.Text = string.Format ("Накладная № {0}", incomeDoc);//row.Text2); this.txtLabel.Visible = true; this.dateLabel.Visible = true; this.dateLabel.Text = row.Text3; //записываем в БД ActionsClass.Action.IncomeBoxAction(barcode, row); found = true; break; } else { //не соответствует throw new ApplicationException("Короб не относится к данной ТТН!"); } } catch //не найдена запись { this.errLabel.Text = string.Format("Короб {0} не относится к данной ТТН!", barcode); this.errLabel.Visible = true; } }*/ //НЕ НАЙДЕНО - СТРАННО /* //Проверка по всем коробам данного магазина ProductsDataSet.DocsTblRow[] rows = ActionsClass.Action.GetDataByDocIdAndType(barcode, (byte)TSDUtils.ActionCode.IncomeBox); if (rows != null && rows.Length > 0) { //если запись найдена - то в данный магазин должен припыбит этот короб ProductsDataSet.DocsTblRow row = rows[0]; //проверка, чтобы короб был в данной поставке (машине) bool found = false; foreach (string incomeDoc in TtnStruct[_currentTTNBarcode].Keys) {//цикл по всем накладным try { //сравнение ШК данного и штрихкода поставки //накладная и коробка должны соответствовать if (barcode == TtnStruct[_currentTTNBarcode][incomeDoc][row.NavCode].Barcode) { //если ок - ставим признак "принят" TtnStruct[_currentTTNBarcode][incomeDoc][row.NavCode].Accepted = true; this.bkLabel.Visible = true; this.bkLabel.Text = string.Format("ШК: {0}", barcode); this.docLabel.Visible = true; this.docLabel.Text = string.Format ("Накладная № {0}", incomeDoc);//row.Text2); this.txtLabel.Visible = true; this.dateLabel.Visible = true; this.dateLabel.Text = row.Text3; //записываем в БД ActionsClass.Action.IncomeBoxAction(barcode, row); found = true; break; } else { //не соответствует throw new ApplicationException("Короб не относится к данной ТТН!"); } } catch //не найдена запись { this.errLabel.Text = string.Format("Короб {0} не относится к данной ТТН!", barcode); this.errLabel.Visible = true; } } //НЕ НАЙДЕНО - СТРАННО if (!found) { this.errLabel.Text = string.Format("Короб {0} не относится к данной ТТН!", barcode); this.errLabel.Visible = true; } */ //string.Format( //"Дата: {0}", DateTime.Today.ToString("dd.MM.yyyy")); /* ScannedProductsDataSet.ScannedBarcodesRow scannedRow = ActionsClass.Action.AddScannedRow( long.Parse(barcode), (byte)TSDUtils.ActionCode.IncomeBox, row.DocId, row.Quantity, row.Priority); scannedRow.FactQuantity += 1; ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.IncomeBox); ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.IncomeBox); * */ /* } else { ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.StrangeBox); ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.StrangeBox); this.errLabel.Text = string.Format("ШК {0} чужой короб!", barcode); this.errLabel.Visible = true; }*/ #endregion this.Refresh(); } else { _currentBoxBarcode = string.Empty; ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.DocNotFound); ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.DocNotFound); this.errLabel.Text = string.Format("Это не ШК короба!"); this.errLabel.Visible = true; } // this.textBox1.SelectAll(); } }
internal void OnScanned(string result) { Scanned?.Invoke(result); }
void OnScanned(string barcode) { if (this.InvokeRequired) { TSDServer.Scanned del = new Scanned(OnScanned); this.Invoke(del, barcode); } else { if (_currentMode == InventarFormMode.DefaultInventar) OnInventarScanned(barcode); else OnIncomeScanned(barcode); } }
void OnScanned(string barcode) { if (this.InvokeRequired) { TSDServer.Scanned del = new Scanned(OnScanned); this.Invoke(del, barcode); } else { if (!enableScan) return; this.bkLabel.Visible = false; this.docLabel.Visible = false; this.errLabel.Visible = false; this.txtLabel.Visible = false; this.dateLabel.Visible = false; this.textBox1.Text = barcode; this.textBox1.SelectAll(); Boxrows.Clear(); IncomerowsList.Clear(); //изменено на просто 4, было 400 - 09092013 //новый ШК машины теперь будет начинаться с 4 if (barcode.StartsWith("4") && barcode.Length == 13) { //currentTtnBarcode = barcode; //загрузить список машин - должна быть 1 запись т.к. машины уникальны. ProductsDataSet.DocsTblRow[] rows = ActionsClass.Action.GetDataByDocIdAndType(barcode, (byte)TSDUtils.ActionCode.CarsBoxes); if (rows != null && rows.Length > 0) { ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.CarsBoxes); ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.CarsBoxes); Boxrows.AddRange(rows); //записи машины найдены ProductsDataSet.DocsTblRow row = rows[0]; this.bkLabel.Visible = true; this.bkLabel.Text = string.Format("ШК: {0}", barcode); this.docLabel.Visible = true; this.docLabel.Text = string.Format ("ТТН № {0}", row.Text2); this.txtLabel.Visible = true; this.dateLabel.Visible = true; this.dateLabel.Text = row.Text3; //string.Format( //"Дата: {0}", DateTime.Today.ToString("dd.MM.yyyy")); CheckStatus(barcode); if (Boxrows != null && Boxrows.Count > 0) { //загрузить список всех накладных машин foreach (ProductsDataSet.DocsTblRow docsRow in Boxrows) { //ProductsDataSet.DocsTblRow[] Incomerows = //ActionsClass.Action.GetDataByNavCodeAndType(docsRow.NavCode, //(byte)TSDUtils.ActionCode.BoxIncomes); IncomerowsList.AddRange(ActionsClass.Action.GetDataByNavCodeAndType(docsRow.NavCode, (byte)TSDUtils.ActionCode.BoxIncomes)); } } currentTtnBarcode = barcode; //Загрузить список всех коробов машины FillCar(IncomerowsList, Boxrows); } else { currentTtnBarcode = string.Empty; ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.StrangeBox); ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.StrangeBox); this.errLabel.Text = string.Format("ТТН не этого магазина!", barcode); this.errLabel.Visible = true; } this.Refresh(); } else { currentTtnBarcode = string.Empty; ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.DocNotFound); ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.DocNotFound); this.errLabel.Text = string.Format("Это не ШК ТТН!", barcode); this.errLabel.Visible = true; } // this.textBox1.SelectAll(); } }
/// <summary> /// Close scan driver and stop listen thread /// </summary> public void StopScan() { OnScanned = null; paused = false; aborted = true; OBReadLibNet.Api.OBRClose(); //OBRDRV Close SystemLibNet.Api.SysTerminateWaitEvent(); //End SysWaitForEvent function //HWND = IntPtr.Zero; //textBox1.Text = ""; //textBox2.Text = ""; //textBox3.Text = ""; //textBox4.Text = ""; try { if (thread != null) thread.Abort(); //Abort start thread } catch { }; }
void Scanned(string barcode) { if (this.InvokeRequired) { TSDServer.Scanned del = new Scanned(Scanned); this.Invoke(del, barcode); } else { this.label18.Text = ""; //tmr.Change(0, 200); //if (docsForm != null) //{ // docsForm.Close(); // docsForm.Dispose(); // docsForm = null; //} SearchBarcode(barcode); } }
public ReturnForm() { InitializeComponent(); scannedDelegate = new Scanned(OnScanned); }
private void OnScanned(string dir) { Scanned?.Invoke(this, new ScanEventArgs(dir)); }
void OnScanned(string barcode) { if (this.InvokeRequired) { TSDServer.Scanned del = new Scanned(OnScanned); this.Invoke(del, barcode); } else { if (!enableScan) return; this.bkLabel.Visible = false; this.docLabel.Visible = false; this.errLabel.Visible = false; this.dateLabel.Visible = false; this.textBox1.Text = barcode; this.textBox1.SelectAll(); this.listBox1.Items.Clear(); //Boxrows.Clear(); //IncomerowsList.Clear(); //изменено на просто 4, было 400 - 09092013 //новый ШК машины теперь будет начинаться с 4 //if (barcode.StartsWith("4") && barcode.Length == 13) //{ //currentTtnBarcode = barcode; //загрузить список машин - должна быть 1 запись т.к. машины уникальны. try { ProductsDataSet.DocsTblRow[] rows = ActionsClass.Action.FindAllReturnsByProduct(barcode); if (rows != null && rows.Length > 0) { ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.ReturnsTTN); ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.ReturnsTTN); docsList.Add(rows[0].DocId, rows[0].Text2); if (rows.Length > 1) { for (int i = 1; i < rows.Length; i++) { if (docsList.ContainsKey(rows[0].DocId)) continue; else docsList.Add(rows[i].DocId, rows[i].Text2); } } } else throw new ApplicationException("Не найдено возвратов"); foreach (string key in docsList.Keys) { this.listBox1.Items.Add(string.Concat(key, "|", docsList[key])); this.listBox1.Focus(); this.listBox1.SelectedIndex = 0; } } catch (Exception err) { this.errLabel.Visible = true; string errmsg = err.Message; int l = errmsg.Length; int qty = l / 30; for (int i = 0; i < qty; i++) { if ( l - i*30 <30) this.listBox1.Items.Add(errmsg.Substring(i*30)); else this.listBox1.Items.Add(errmsg.Substring(i * 30,30)); } this.textBox1.Focus(); this.textBox1.SelectAll(); return; } this.Refresh(); } }