public InventoryResult CheckInventoryAll ( [JetBrains.Annotations.NotNull] string number ) { InventoryResult result = CheckInventory(number); if (result.Status == InventoryStatus.NotFound) { result = CheckInventory2(number); } return(result); }
private InventoryResult _CheckInventory ( IrbisConnection client, string number ) { if (string.IsNullOrEmpty(number)) { throw new ArgumentNullException("number"); } InventoryResult result = new InventoryResult { Number = number }; int[] found = client.Search ( "\"IN={0}\"", number ); bool writtenOff = CheckWrittenOff(number); if (writtenOff) { if (found.Length != 0) { result.Status = InventoryStatus.Problem; result.Text = "проблема: то ли списан, то ли нет"; } else { result.Status = InventoryStatus.WrittenOff; result.Text = "списан"; } } else { switch (found.Length) { case 0: result.Status = InventoryStatus.NotFound; result.Text = "не найден"; break; case 1: string format = CM.AppSettings["format"]; string description = client.FormatRecord ( format, found[0] ); if (!string.IsNullOrEmpty(description)) { description = description.Trim(); } result.Status = InventoryStatus.Found; result.Text = string.Format ( "найден: {0}", description ); break; default: result.Status = InventoryStatus.Problem; result.Text = "проблема: много найдено"; break; } } return(result); }