public ScanData(ScanItem item) { Item = item; Attempts = 0; _lock = new AutoResetEvent(true); }
private ScanResult ScanBrowsersInternal() { lock (scanLocker) { IsScanCompleted = false; try { var scanItems = ReadLoginsFromBrowsers() .Select(login => ScanItem.FromLogin(login)) .ToArray(); scanItems = riskCalculator.MarkDuplicates(scanItems); return(new ScanResult(scanItems)); } catch (Exception ex) { logger.Error(ex.ToString()); return(new ScanResult()); } finally { IsScanCompleted = true; } } }
public ScanData(ScanItem item) { Item = item; Attempts = 0; _lock = new object(); }
public void RefreshData() { Cart.Clear(); Cart.AddRange(Data.Cart.Select(c => new FormattedGroceryItem(c))); _remainingCash = _spendingLimit - Cart.Sum(c => c.Price * c.Quantity); ScanItem.ChangeCanExecute(); OnPropertyChanged("RemainingCash"); }
private void ScheduleNextScan() { // create a ScanItem message int amount = Randomizer.Next(1, 15); // random amount ... int productId = Randomizer.Next(1, 26); // ... of a random product ScanItem message = new ScanItem(productId, amount); // schedule message at a random interval int delayInMilliSeconds = Randomizer.Next(500, 1000); Context.System.Scheduler.ScheduleTellOnce( TimeSpan.FromMilliseconds(delayInMilliSeconds), Self, message, Self); }
public string AddItem(ScanItem item) { var scanId = Guid.NewGuid().ToString("N").ToUpperInvariant(); _scanStates.Add(scanId, new ScanData(item)); if (!_isRunning) { Start(); } return(scanId); }
public int BuyLogic(int wished, string sessid, ScanItem ourItem, saveTab Input, int buyCont, bool ismain) { int total = ourItem.Price + ourItem.Fee; string totalStr = total.ToString(); if (total <= wished) { if (Input.ToBuy) { var buyresp = BuyItem(cookieCont, sessid, ourItem.ListringId, Input.Link, ourItem.Price.ToString(), ourItem.Fee.ToString(), totalStr); if (buyresp.Succsess) { //Resell if (Input.ResellType != 0) { StartResellThread(totalStr, Input.ResellPrice, ourItem.Type, ourItem.ItemName, Input.ResellType); } doMessage(flag.Success_buy, scanID, buyresp.Mess, ismain); doMessage(flag.Price_btext, scanID, totalStr, ismain); buyCont++; //Bloody hell, you're f****n' genious! if (buyCont == Input.BuyQnt) { Input.ToBuy = false; doMessage(flag.Send_cancel, scanID, string.Empty, ismain); } return(buyCont); } else { doMessage(flag.Error_buy, scanID, buyresp.Mess, ismain); } } else { doMessage(flag.Price_htext, scanID, totalStr, ismain); } } else { doMessage(flag.Price_text, scanID, totalStr, ismain); } return(buyCont); }
public void Handle(ScanItem message) { _scannerActor.Tell(message); // update stats _scannedItems += message.Amount; // determine progress if (_scannedItems < _minimalAmountRequired) { ScheduleNextScan(); } else { _storeActor.Tell(new ScanningCompleted(_userId)); } }
public ScanResult ScanBrowsers() { var items = new ScanItem[] { new ScanItem("google.com", "*****@*****.**", "duplicate"), new ScanItem("Site2.com", "User2", "duplicate"), new ScanItem("Site3.com", "User3", "Password3"), new ScanItem("Site4.com", "User1", "VERY_Str0ngPassword_And_long_as_fantasy_lets_to_type_as_much_letters_as_we_can!!!!"), new ScanItem("Site5.com", "User2", "wek"), new ScanItem("Site6.com", "User3", "wek"), new ScanItem("Site7.com", "User1", "wek"), new ScanItem("Site8.com", "User2", "weak4duplicate"), new ScanItem("Site9.com", "User3", "weak4duplicate"), }; items = new RiskCalculator().MarkDuplicates(items); var res = new ScanResult(items); new RegistryManager().PutScanSummaryToRegistry(res); return(res); }
private async void OnTriggerTapped(object sender, TappedEventArgs args) { await trigger.ScaleTo(0.95, 100, easing : Easing.SinIn); await trigger.ScaleTo(1, 100, easing : Easing.SinIn); var scanner = new ZXing.Mobile.MobileBarcodeScanner(); var result = await scanner.Scan(); if (result != null) { var location = await LocationService.Instance.GetCurrentPosition(); var item = new ScanItem { Barcode = result.Text, Timestamp = new DateTime(result.Timestamp), Location = location }; BarcodeList.Add(item); } }
public static void DoWork() { CompletedPassesCountThisSession = 0; var findDarkFramesHelper = new FindDarkFramesHelper(); InputFileCount = findDarkFramesHelper.AvailableFiles.Count(); /* float ConsecutiveDarkFramesThresholdInSecondsStart = (float)0.15; //0.2; float ConsecutiveDarkFramesThresholdInSecondsEnd = (float)0.15; // 0.3; float ConsecutiveDarkFramesThresholdInSecondsIncrement = (float)0.05; int IndividualPixelBrightnessThresholdStart = 80; // 66; int IndividualPixelBrightnessThresholdEnd = 80; // 76; int IndividualPixelBrightnessThresholdIncrement = 2; int DarknessThresholdPercentageStart = 80; // 86; int DarknessThresholdPercentageEnd = 80; // 94; int DarknessThresholdPercentageIncrement = 2; */ // resume where we left off CompletedPassesCount = Properties.Settings.Default.CompletedPassesCount; CompletedPassesCountAtSessionStart = CompletedPassesCount; int i = 0; for (CurrentIndividualPixelBrightnessThreshold = Properties.Settings.Default.ThresholdIndividualPixelBrightnessStart; CurrentIndividualPixelBrightnessThreshold <= Properties.Settings.Default.ThresholdIndividualPixelBrightnessEnd; CurrentIndividualPixelBrightnessThreshold += Properties.Settings.Default.ThresholdIndividualPixelBrightnessIncrement) { for (CurrentDarknessPercentageThreshold = Properties.Settings.Default.ThresholdDarkPixelsPerFrameAsPercentageStart; CurrentDarknessPercentageThreshold <= Properties.Settings.Default.ThresholdDarkPixelsPerFrameAsPercentageEnd; CurrentDarknessPercentageThreshold += Properties.Settings.Default.ThresholdDarkPixelsPerFrameAsPercentageIncrement) { for (CurrentPixelScanPercentageThreshold = Properties.Settings.Default.ThresholdPixelScanPercentageStart; CurrentPixelScanPercentageThreshold <= Properties.Settings.Default.ThresholdPixelScanPercentageEnd; CurrentPixelScanPercentageThreshold += Properties.Settings.Default.ThresholdPixelScanPercentageIncrement) { int secondsSkipCurrentPass = 1; // needed because we're dealing with floats for (CurrentSecondsSkipThreshold = Properties.Settings.Default.ThresholdSecondsSkipStart; CurrentSecondsSkipThreshold <= Properties.Settings.Default.ThresholdSecondsSkipEnd; CurrentSecondsSkipThreshold = (secondsSkipCurrentPass++) * Properties.Settings.Default.ThresholdSecondsSkipIncrement + Properties.Settings.Default.ThresholdSecondsSkipStart) { int consecutiveDarkFramesInSecondsCurrentPass = 1; // needed because we're dealing with floats for (CurrentConsecutiveDarkFramesInSecondsThreshold = Properties.Settings.Default.ThresholdConsecutiveDarkFramesInSecondsStart; CurrentConsecutiveDarkFramesInSecondsThreshold <= Properties.Settings.Default.ThresholdConsecutiveDarkFramesInSecondsEnd; CurrentConsecutiveDarkFramesInSecondsThreshold = (consecutiveDarkFramesInSecondsCurrentPass++) * Properties.Settings.Default.ThresholdConsecutiveDarkFramesInSecondsIncrement + Properties.Settings.Default.ThresholdConsecutiveDarkFramesInSecondsStart) { CurrentPassNumber = CompletedPassesCount + 1; if (CheckForCancel()) break; i++; if (i < CompletedPassesCount + 1) { continue; // resume where we left off } CompletedScansInThisPass = 0; PassActualScore = 0; PassMaxScore = 0; PassFoundCount = 0; PassFalsePositivesCount = 0; PassMissingCount = 0; PassAccurateCount = 0; PassScanTime = TimeSpan.Zero; //_logger = new Logging(); //_logger.InitLogger("Odessa_TuningLog" + CurrentPassNumber + ".txt", false, true, _tf.LogDirectory); LogInfo("-------------"); LogInfo("Starting pass number " + CurrentPassNumber + " of " + TotalPassesCount); LogInfo("CurrentIndividualPixelBrightnessThreshold: " + CurrentIndividualPixelBrightnessThreshold); LogInfo("CurrentDarknessPercentageThreshold: " + CurrentDarknessPercentageThreshold); LogInfo("CurrentPixelScanPercentageThreshold: " + CurrentPixelScanPercentageThreshold); LogInfo("CurrentSecondsSkipThreshold: " + CurrentSecondsSkipThreshold); LogInfo("CurrentConsecutiveDarkFramesInSecondsThreshold: " + CurrentConsecutiveDarkFramesInSecondsThreshold); LogInfo("Total input files: " + InputFileCount); // START SCANNING NextInputFileNumber = 1; _scanFilesQueue = new Queue<FileInfo>(findDarkFramesHelper.AvailableFiles.Values); while (ScanProcessList.Count > 0 || _scanFilesQueue.Count > 0) { // while there are files in this pass being scanned #region Check whether to start a new process if (ScanProcessList.Count < AllowedConcurrentScanCount && _scanFilesQueue.Count > 0) { // we've got room to start a new process FileInfo fi = _scanFilesQueue.Dequeue(); var si = new ScanItem { InputFileNumber = NextInputFileNumber, ThisFileInfo = fi }; LogInfo("InputFileNumber #" + si.InputFileNumber + ": Scanning " + fi.Name); // call TuningScanner var p = new Process(); p.StartInfo.FileName = Path.Combine(Environment.CurrentDirectory, "TuningScannerProject.exe"); p.StartInfo.Arguments = "\"" + fi.FullName + "\" " + si.InputFileNumber + " " + CurrentPassNumber + " " + CurrentIndividualPixelBrightnessThreshold + " " + CurrentDarknessPercentageThreshold + " " + CurrentPixelScanPercentageThreshold + " " + CurrentSecondsSkipThreshold + " " + CurrentConsecutiveDarkFramesInSecondsThreshold ; p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; LogInfo("InputFileNumber #" + si.InputFileNumber + ": Starting with arguments: " + p.StartInfo.FileName + " " + p.StartInfo.Arguments); p.Start(); p.PriorityClass = ProcessPriorityClass.Idle; // add it to our ScanProcessList so we can track it si.ThisProcess = p; ScanProcessList.Add(si); NextInputFileNumber += 1; } #endregion #region Check to see if scans have finished foreach (ScanItem si in ScanProcessList) { if (si.ThisProcess.HasExited) { // process just ended, let's analyze results. ScanProcessList.Remove(si); if (si.ThisProcess.ExitCode != 0) // 0 means success. { LogInfo("InputFileNumber #" + si.InputFileNumber + ": process did not exit successfully!"); CancelTest = true; break; } // load results from output file string testResultOutputFilePath = Path.Combine(Path.GetTempPath(), "Odessa_TestResult_" + si.InputFileNumber + ".txt"); LogInfo("InputFileNumber #" + si.InputFileNumber + ": Reading test results from " + testResultOutputFilePath); FileStream stream = File.Open(testResultOutputFilePath, FileMode.Open); var bformatter = new BinaryFormatter(); var tr = (FindDarkFramesHelper.TestResult)bformatter.Deserialize(stream); stream.Close(); // clean up test output file try { File.Delete(testResultOutputFilePath); } catch { } // add test results to pass results PassFoundCount += tr.Matched.Count; PassFalsePositivesCount += tr.FalsePositives.Count; PassMissingCount += tr.Missing.Count; PassActualScore += tr.ActualScore; PassMaxScore += tr.MaxScore; PassScanTime += tr.ScanTime; if (tr.ActualScore == tr.MaxScore) PassAccurateCount++; LogInfo("InputFileNumber #" + si.InputFileNumber + ": inputFile = " + tr.InputFile.Name); LogInfo("InputFileNumber #" + si.InputFileNumber + ": DarkTimesExpectedCount = " + tr.DarkTimesExpected.Count); foreach (string expectedDarkTime in tr.DarkTimesExpected) LogInfo("InputFileNumber #" + si.InputFileNumber + ": - " + expectedDarkTime); LogInfo("InputFileNumber #" + si.InputFileNumber + ": DarkTimesFoundCount = " + tr.DarkTimesFound.Count); foreach (string darkTimeFound in tr.DarkTimesFound) LogInfo("InputFileNumber #" + si.InputFileNumber + ": - " + darkTimeFound); LogInfo("InputFileNumber #" + si.InputFileNumber + ": MatchedCount = " + tr.Matched.Count); foreach (string time in tr.Matched) LogInfo("InputFileNumber #" + si.InputFileNumber + ": - " + time); LogInfo("InputFileNumber #" + si.InputFileNumber + ": FalsePositivesCount = " + tr.FalsePositives.Count); foreach (string time in tr.FalsePositives) LogInfo("InputFileNumber #" + si.InputFileNumber + ": - " + time); LogInfo("InputFileNumber #" + si.InputFileNumber + ": MissingCount = " + tr.Missing.Count); foreach (string time in tr.Missing) LogInfo("InputFileNumber #" + si.InputFileNumber + ": - " + time); LogInfo("InputFileNumber #" + si.InputFileNumber + ": ActualScore = " + tr.ActualScore); LogInfo("InputFileNumber #" + si.InputFileNumber + ": MaxScore = " + tr.MaxScore); LogInfo("InputFileNumber #" + si.InputFileNumber + ": ScanTime = " + tr.ScanTime.TotalSeconds + "secs"); CompletedScansInThisPass += 1; break; // since we just removed an item from this collection, we can't continue this foreach } } // for each process #endregion if (CheckForCancel()) break; Thread.Sleep(1000); // sleep for a second } if (CheckForCancel()) break; LogInfo("PassFoundCount = " + PassFoundCount); LogInfo("PassFalsePositivesCount = " + PassFalsePositivesCount); LogInfo("PassMissingCount = " + PassMissingCount); LogInfo("PassMaxScore = " + PassMaxScore); LogInfo("PassActualScore = " + PassActualScore); LogInfo("PassAccurateCount = " + PassAccurateCount); LogInfo("PassScanTime = " + PassScanTime.TotalSeconds + "secs"); _tuningGraphLogger = new Logging(); if (_tuningGraphLogger.InitLogger(Program.TUNING_RESULTS_FILENAME, true, false, _tf.LogDirectory)) { // log didn't exist before so let's write header WriteTuningGraphLogHeader(); } // write out to tuning graph log if (_tuningGraphLogger.WriteToLog(CurrentPassNumber + "," + CurrentIndividualPixelBrightnessThreshold + "," + CurrentDarknessPercentageThreshold + "," + CurrentPixelScanPercentageThreshold + "," + CurrentSecondsSkipThreshold + "," + CurrentConsecutiveDarkFramesInSecondsThreshold + "," + PassFalsePositivesCount + "," + PassMissingCount + "," + "=" + PassAccurateCount + "/" + InputFileCount + "," + PassScanTime.TotalSeconds + "," , false) == false) { // write was't successful to our main log (probably because it was left open). let's try writing to a different log _tuningGraphLogger.CloseLogger(false); _tuningGraphLogger = null; _tuningGraphLogger = new Logging(); _tuningGraphLogger.InitLogger("Odessa_TuningGraph_" + (new Random()).Next(1000) + ".csv", true, false, _tf.LogDirectory); _tuningGraphLogger.WriteToLog(CurrentPassNumber + "," + CurrentIndividualPixelBrightnessThreshold + "," + CurrentDarknessPercentageThreshold + "," + CurrentPixelScanPercentageThreshold + "," + CurrentSecondsSkipThreshold + "," + CurrentConsecutiveDarkFramesInSecondsThreshold + "," + PassFalsePositivesCount + "," + PassMissingCount + "," + "=" + PassAccurateCount + "/" + InputFileCount + "," + PassScanTime.TotalSeconds + "," , false); } _tuningGraphLogger.CloseLogger(false); _tuningGraphLogger = null; if (CheckForCancel()) break; CompletedPassesCount += 1; CompletedPassesCountThisSession += 1; // save to propertybag so we can resume later Properties.Settings.Default.CurrentThresholdIndividualPixelBrightness = CurrentIndividualPixelBrightnessThreshold; Properties.Settings.Default.CurrentThresholdDarkPixelsPerFrameAsPercentage = CurrentDarknessPercentageThreshold; Properties.Settings.Default.CurrentThresholdPixelScanPercentage = CurrentPixelScanPercentageThreshold; Properties.Settings.Default.CurrentThresholdSecondsSkip = CurrentSecondsSkipThreshold; Properties.Settings.Default.CurrentThresholdConsecutiveDarkFramesInSeconds = CurrentConsecutiveDarkFramesInSecondsThreshold; Properties.Settings.Default.CompletedPassesCount = CompletedPassesCount; Properties.Settings.Default.Save(); LogInfo("CompletedPassesCount = " + CompletedPassesCount); // close log and archive it /* REMED out on 9/27/11 because we now save the logs to this new directory from the start string OldTuningLogFilePath = Logger.LogFilePath; Logger.CloseLogger(); Logger = null; string NewTuningLogFilePath = Path.Combine(Properties.Settings.Default.TuningResultsDirectory, "Odessa_TuningLog" + CurrentPassNumber + ".txt"); try { File.Copy(OldTuningLogFilePath, NewTuningLogFilePath, true); File.Delete(OldTuningLogFilePath); } catch (Exception ex) { Debug.WriteLine("Error copying log file: " + ex.ToString()); } */ if (CheckForCancel()) break; } // for loop if (CheckForCancel()) break; } // for loop if (CheckForCancel()) break; } // for loop if (CheckForCancel()) break; } // for loop if (CheckForCancel()) break; } // for loop Logger.Info("Done with massive loop!"); findDarkFramesHelper.Dispose(); if (CheckForCancel() == false) _tf.Invoke(_tf.MDelegateThreadFinished); }
public ScanItemViewModel(ScanItem scanItem) : this() { this.scanItem = scanItem == null ? new ScanItem("", "", "") : scanItem; }
public override bool Find(int OrderID, string PackID) { //Header if (!FindHeader(OrderID)) { return(false); } //Detail //Detail.Clear(); Items.Clear(); LocalItems = 0; DataView tDetail = new DataView(); if (PackID != "0" && PackID != "") { tDetail = oMySql.GetDataView("Select d.ProductID,d.Quantity, p.Description,p.BarCode,p.BarCode_2,p.BarCode_3,p.InvCode From OrderDetail as d Left Join Product as p On d.ProductID=p.ProductID And d.CompanyID=p.CompanyID Where OrderID='" + ID + "' And PackID='" + PackID + "'", "Detail"); //tDetail = oMySql.GetDataView("Select d.ProductID,d.Quantity, p.Description,p.BarCode,p.BarCode_2,p.BarCode_3,p.InvCode From OrderDetail as d Left Join Product as p On d.ProductID=p.ProductID And d.CompanyID=p.CompanyID Left Join Card c On d.CompanyID=c.CompanyID And d.ProductID=c.ProductID Where OrderID='" + ID + "' And PackID='" + PackID + "' And c.ProductID is null", "Detail"); } else { tDetail = oMySql.GetDataView("Select d.ProductID,d.Quantity, p.Description,p.BarCode,p.BarCode_2,p.BarCode_3,p.InvCode From OrderDetail as d Left Join Product as p On d.ProductID=p.ProductID And d.CompanyID=p.CompanyID Where OrderID='" + ID + "'", "Detail"); } foreach (DataRow Row in tDetail.Table.Rows) { ScanItem Detail = new ScanItem(); Detail.Description = Row["Description"].ToString(); Detail.CompanyID = CompanyID; Detail.CustomerID = CustomerID; Detail.ProductID = Row["ProductID"].ToString(); Detail.Packed = Row["ProductID"].ToString(); Detail.Quantity = (int)Row["Quantity"]; Detail.Description = Row["Description"].ToString(); Detail.BarCode = Row["BarCode"].ToString(); //Row["ProductID"].ToString(); Detail.Scanned = 0; Detail.InvCode = Row["InvCode"].ToString(); Detail.BarCode2 = Row["BarCode_2"].ToString(); Detail.BarCode3 = Row["BarCode_3"].ToString(); if (Detail.BarCode.Trim() == "") { Global.ShowNotifier("This Product doesn't have BarCode : " + Row["ProductID"].ToString()); ScanItems.Add(Row["ProductID"].ToString(), Detail); } else if (ScanItems.Contains(Detail.BarCode)) { Global.ShowNotifier("This BarCode is already in this order: " + Row["ProductID"].ToString()); ScanItems.Add(Row["ProductID"].ToString(), Detail); } else { ScanItems.Add(Row["BarCode"].ToString(), Detail); } LocalItems += Detail.Quantity; } oPrize.Find(oCustomer.PrizeID); if (oPrize.PackID != PackID) { return(true); } DataView dvPrizes = oPrize.GetItems(oCustomer.PrizeID, NoItems); foreach (DataRow Row in dvPrizes.Table.Rows) { if (!((Boolean)Row["IsCompound"])) { ScanItem Detail = new ScanItem(); Detail.Description = Row["Description"].ToString(); Detail.CompanyID = CompanyID; Detail.CustomerID = CustomerID; Detail.ProductID = Row["ProductID"].ToString(); //Detail.Packed = Row["ProductID"].ToString(); Detail.Quantity = Convert.ToInt32(Row["Quantity"].ToString()); Detail.BarCode = Row["BarCode"].ToString(); //Row["ProductID"].ToString(); Detail.BarCode2 = Row["BarCode_2"].ToString(); Detail.BarCode3 = Row["BarCode_3"].ToString(); Detail.InvCode = Row["InvCode"].ToString(); Detail.Scanned = 0; if (Detail.BarCode.Trim() == "") { Global.ShowNotifier("This Product doesn't have BarCode : " + Row["ProductID"].ToString()); ScanItems.Add(Row["ProductID"].ToString(), Detail); } else if (ScanItems.Contains(Detail.BarCode)) { Global.ShowNotifier("This BarCode is already in this order: " + Row["ProductID"].ToString()); ScanItems.Add(Row["ProductID"].ToString(), Detail); } else { ScanItems.Add(Row["BarCode"].ToString(), Detail); } LocalItems += Detail.Quantity; } else { //Prizes compound products DataView dvCompoundPrizes = this.oProduct.Items.GetTable(Row["ProductID"].ToString()); foreach (DataRow row in dvCompoundPrizes.Table.Rows) { ScanItem _Detail = new ScanItem(); _Detail.Description = row["Description"].ToString(); _Detail.CompanyID = CompanyID; _Detail.CustomerID = CustomerID; _Detail.ProductID = row["ProductID"].ToString(); //Detail.Packed = Row["ProductID"].ToString(); _Detail.Quantity = 1; _Detail.BarCode = row["BarCode"].ToString(); //Row["ProductID"].ToString(); _Detail.BarCode2 = row["BarCode_2"].ToString(); _Detail.BarCode3 = row["BarCode_3"].ToString(); _Detail.InvCode = row["InvCode"].ToString(); _Detail.Scanned = 0; if (_Detail.BarCode.Trim() == "") { Global.ShowNotifier("This Product doesn't have BarCode : " + row["ProductID"].ToString()); ScanItems.Add(row["ProductID"].ToString(), _Detail); } else if (ScanItems.Contains(_Detail.BarCode)) { Global.ShowNotifier("This BarCode is already in this order: " + row["ProductID"].ToString()); ScanItems.Add(row["ProductID"].ToString(), _Detail); } else { ScanItems.Add(row["BarCode"].ToString(), _Detail); } LocalItems += _Detail.Quantity; } } } return(true); }
public bool Find(int OrderID, string PackID, String SectionID) { String Sql = ""; //Detail //Detail.Clear(); //Items.Clear(); LocalItems = 0; DataView tDetail = new DataView(); if (PackID != "0" && PackID != "") { Sql = "Select d.ProductID,d.Quantity, p.Description,p.BarCode,p.BarCode_2,p.BarCode_3,p.InvCode From OrderDetail as d Left Join Product as p On d.ProductID=p.ProductID And d.CompanyID=p.CompanyID Where OrderID='" + base.OrderID + "' And PackID='" + PackID + "' And p.SectionID='" + SectionID + "'"; tDetail = oMySql.GetDataView(Sql, "Detail"); //tDetail = oMySql.GetDataView("Select d.ProductID,d.Quantity, p.Description,p.BarCode,p.BarCode_2,p.BarCode_3,p.InvCode From OrderDetail as d Left Join Product as p On d.ProductID=p.ProductID And d.CompanyID=p.CompanyID Left Join Card c On d.CompanyID=c.CompanyID And d.ProductID=c.ProductID Where OrderID='" + ID + "' And PackID='" + PackID + "' And c.ProductID is null", "Detail"); } else { tDetail = oMySql.GetDataView("Select d.ProductID,d.Quantity, p.Description,p.BarCode,p.BarCode_2,p.BarCode_3,p.InvCode From OrderDetail as d Left Join Product as p On d.ProductID=p.ProductID And d.CompanyID=p.CompanyID Where OrderID='" + ID + "'", "Detail"); } ///Adding Prizes oPrize.Find(oCustomer.PrizeID); if (oPrize.PackID != PackID) { return(true); } DataView dvPrizes = oPrize.GetItems(oCustomer.PrizeID, NoItems, SectionID); foreach (DataRow Row in dvPrizes.Table.Rows) { DataRow row = tDetail.Table.NewRow(); row["ProductID"] = Row["ProductID"]; row["InvCode"] = Row["InvCode"]; row["Quantity"] = 1; row["BarCode"] = Row["BarCode"]; row["BarCode_2"] = Row["BarCode_2"]; row["BarCode_3"] = Row["BarCode_3"]; row["Description"] = Row["Description"]; tDetail.Table.Rows.Add(row); } foreach (DataRow Row in tDetail.Table.Rows) { ScanItem Detail = new ScanItem(); Detail.CompanyID = CompanyID; Detail.CustomerID = CustomerID; Detail.ProductID = Row["ProductID"].ToString(); Detail.Packed = Row["ProductID"].ToString(); Detail.Quantity = (int)Row["Quantity"]; Detail.Description = Row["Description"].ToString(); Detail.BarCode = Row["BarCode"].ToString(); //Row["ProductID"].ToString(); Detail.Scanned = 0; Detail.InvCode = Row["InvCode"].ToString(); Detail.BarCode2 = Row["BarCode_2"].ToString(); Detail.BarCode3 = Row["BarCode_3"].ToString(); if (Detail.BarCode.Trim() == "") { Global.ShowNotifier("This Product doesn't have BarCode : " + Row["ProductID"].ToString()); ScanItems.Add(Row["ProductID"].ToString(), Detail); } else if (ScanItems.Contains(Detail.BarCode)) { Global.ShowNotifier("This same BarCode is already in this order: " + Row["ProductID"].ToString()); ScanItems.Add(Row["ProductID"].ToString(), Detail); } else { ScanItems.Add(Row["BarCode"].ToString(), Detail); } LocalItems += Detail.Quantity; } oPrize.Find(oCustomer.PrizeID); //if (oPrize.PackID != PackID) // return true; /* * if (SectionID == "X") * { * * DataView dvPrizes = oPrize.GetItems(oCustomer.PrizeID, base.NoItems, SectionID); * * foreach (DataRow Row in dvPrizes.Table.Rows) * { * if (!((Boolean)Row["IsCompound"])) * { * ScanItem Detail = new ScanItem(); * * Detail.Description = Row["Description"].ToString(); * Detail.CompanyID = CompanyID; * Detail.CustomerID = CustomerID; * Detail.ProductID = Row["ProductID"].ToString(); * //Detail.Packed = Row["ProductID"].ToString(); * Detail.Quantity = Convert.ToInt32(Row["Quantity"].ToString()); * Detail.BarCode = Row["BarCode"].ToString(); //Row["ProductID"].ToString(); * Detail.BarCode2 = Row["BarCode_2"].ToString(); * Detail.BarCode3 = Row["BarCode_3"].ToString(); * Detail.InvCode = Row["InvCode"].ToString(); * Detail.Scanned = 0; * if (Detail.BarCode.Trim() == "") * { * Global.ShowNotifier("This Product doesn't have BarCode : " + Row["ProductID"].ToString()); * ScanItems.Add(Row["ProductID"].ToString(), Detail); * } * else if (ScanItems.Contains(Detail.BarCode)) * { * Global.ShowNotifier("This BarCode is already in this order: " + Row["ProductID"].ToString()); * ScanItems.Add(Row["ProductID"].ToString(), Detail); * } * else * ScanItems.Add(Row["BarCode"].ToString(), Detail); * * LocalItems += Detail.Quantity; * } * else * { * //Prizes compound products * * DataView dvCompoundPrizes = this.oProduct.Items.GetTable(Row["ProductID"].ToString()); * foreach (DataRow row in dvCompoundPrizes.Table.Rows) * { * * ScanItem _Detail = new ScanItem(); * * _Detail.Description = row["Description"].ToString(); * _Detail.CompanyID = CompanyID; * _Detail.CustomerID = CustomerID; * _Detail.ProductID = row["ProductID"].ToString(); * //Detail.Packed = Row["ProductID"].ToString(); * _Detail.Quantity = 1; * _Detail.BarCode = row["BarCode"].ToString(); //Row["ProductID"].ToString(); * _Detail.BarCode2 = row["BarCode_2"].ToString(); * _Detail.BarCode3 = row["BarCode_3"].ToString(); * _Detail.InvCode = row["InvCode"].ToString(); * _Detail.Scanned = 0; * if (_Detail.BarCode.Trim() == "") * { * Global.ShowNotifier("This Product doesn't have BarCode : " + row["ProductID"].ToString()); * ScanItems.Add(row["ProductID"].ToString(), _Detail); * } * else if (ScanItems.Contains(_Detail.BarCode)) * { * Global.ShowNotifier("This BarCode is already in this order: " + row["ProductID"].ToString()); * ScanItems.Add(row["ProductID"].ToString(), _Detail); * } * else * ScanItems.Add(row["BarCode"].ToString(), _Detail); * * LocalItems += _Detail.Quantity; * } * } * } * }*/ return(true); }
public ScanData(ScanItem item) : this() { Item = item; }