コード例 #1
0
            /// <summary>
            /// Gets the discount codes from pricing services.
            /// </summary>
            /// <param name="request">The request.</param>
            /// <returns>The response.</returns>
            protected override GetDiscountCodesResponse Process(GetDiscountCodesRequest request)
            {
                ThrowIf.Null(request, "request");
                ThrowIf.Null(request.QueryResultSettings, "request.QueryResultSettings");

                // Create service request.
                var serviceRequest = new GetDiscountCodesServiceRequest(
                    request.OfferId, request.DiscountCode, request.Keyword, request.ActiveDate, request.QueryResultSettings);

                // Execute service request.
                var serviceResponse = this.Context.Execute <GetDiscountCodesServiceResponse>(serviceRequest);

                // If no discount codes were found then attempt the search again using Barcode
                if (serviceResponse.DiscountCodes != null && serviceResponse.DiscountCodes.Results.Count == 0)
                {
                    var scanInfo = new ScanInfo()
                    {
                        ScannedText = request.Keyword
                    };
                    var barcodeRequest = new GetBarcodeRequest(scanInfo);
                    GetBarcodeResponse getBarcodeResponse = this.Context.Runtime.Execute <GetBarcodeResponse>(barcodeRequest, this.Context);
                    Barcode            barcode            = getBarcodeResponse.Barcode;
                    if (barcode != null && barcode.Mask.MaskType == BarcodeMaskType.DiscountCode)
                    {
                        var getDiscountCodesByBarcodeServiceRequest = new GetDiscountCodesServiceRequest(
                            request.OfferId, barcode.DiscountCode, null, request.ActiveDate, request.QueryResultSettings);
                        serviceResponse = this.Context.Execute <GetDiscountCodesServiceResponse>(getDiscountCodesByBarcodeServiceRequest);
                    }
                }

                // Convert service response to response.
                return(new GetDiscountCodesResponse(serviceResponse.DiscountCodes));
            }
コード例 #2
0
        private static Dictionary <string, Guid> CacheLanguageGuids()
        {
            Dictionary <string, Guid> result = new Dictionary <string, Guid>(StringComparer.OrdinalIgnoreCase);

            if (MainPackage.Instance != null)
            {
                using (RegistryKey rootKey = MainPackage.Instance.UserRegistryRoot)
                {
                    if (rootKey != null)
                    {
                        ScanInfo.ScanLanguageServices(
                            rootKey,
                            (langName, langGuid) =>
                        {
                            Guid guid;
                            if (Guid.TryParse(langGuid, out guid))
                            {
                                result.Add(langName, guid);
                            }

                            return(false);
                        });
                    }
                }
            }

            return(result);
        }
コード例 #3
0
        public override string GetStringToSave()
        {
            var      f    = new FileInfo(filename);
            ScanInfo info = TextProcessor.ParseScanInfo(f);

            if (info == null)
            {
                DateTime date = f.CreationTime;
                info = new ScanInfo(date, "");
            }

            // doc type
            string s = Environment.StringResources.GetString("ScanDocument");

            // date
            s += " " + info.Date.ToString("dd.MM.yyyy");

            // description
            if (info.Descr.Length > 0)
            {
                s = TextProcessor.StuffNewLine(s) + Environment.StringResources.GetString("Description") + ": " +
                    info.Descr;
            }

            return(s);
        }
コード例 #4
0
    bool set_scan_data(RaycastHit hitP, int i, ref Dictionary <Transform, ScanInfo> dict)
    {
        ScanInfo scan_info = new ScanInfo();
        var      renderer  = hitP.collider.GetComponent <MeshRenderer>();
        Color    color     = renderer.material.GetColor("_Color");

        if (!dict.ContainsKey(hitP.collider.transform))
        {
            scan_info.n_scans = 1;
            //Debug.Log("tag = " + hitP.collider.tag);
            if (hitP.collider.tag == "waypoint")
            {
                scan_info.type  = ObjectType.WAYPOINT;
                scan_info.color = color;
                hitPoints.Add(hitP);
                tagLabels.Add(1);
            }
            else
            {
                scan_info.type = ObjectType.WALL;
                hitPoints.Add(hitP);
                tagLabels.Add(0);
            }
            dict[hitP.collider.transform] = scan_info;
        }
        else
        {
            scan_info = dict[hitP.collider.transform];
            scan_info.n_scans++;
            dict[hitP.collider.transform] = scan_info;
        }
        distancesVector[i] = hitP.distance;
        return(true);
    }
コード例 #5
0
        private ScanInfo getScanInfoByFilePath(int examId, string filePath)
        {
            Connection.Open();

            String sql = String.Format("select * from ScanResultTbl where File_Path=\'{0}\'", filePath);

            SQLiteCommand    cmd = new SQLiteCommand(sql, Connection);
            SQLiteDataReader rdr = cmd.ExecuteReader();

            ScanInfo scanInfo = new ScanInfo();

            scanInfo.examId = -1;
            while (rdr.Read())
            {
                scanInfo.examId         = examId;
                scanInfo.patternIdx     = rdr.GetInt32(rdr.GetOrdinal("Pattern_ID"));
                scanInfo.ascans         = (int)rdr.GetDouble(rdr.GetOrdinal("A_scans"));
                scanInfo.bscans         = (int)rdr.GetDouble(rdr.GetOrdinal("B_Scans"));
                scanInfo.scan_w         = rdr.GetDouble(rdr.GetOrdinal("Scan_Width"));
                scanInfo.scan_h         = rdr.GetDouble(rdr.GetOrdinal("Scan_Height"));
                scanInfo.scan_direction = rdr.GetInt32(rdr.GetOrdinal("Scan_Direction"));
                scanInfo.eye_side       = rdr.GetInt32(rdr.GetOrdinal("Eye_Side"));
                scanInfo.meas_time      = rdr.GetDateTime(rdr.GetOrdinal("Measure_Time"));
                scanInfo.file_path      = rdr["File_Path"] as String;
                break;
            }

            rdr.Close();

            Connection.Close();

            return(scanInfo);
        }
コード例 #6
0
        public ITagger <T> CreateTagger <T>(ITextBuffer buffer)
            where T : ITag
        {
            ITagger <IOutliningRegionTag> CreateBufferTagger()
            {
                Language language = DocumentItem.GetLanguage(buffer);

                ThreadHelper.ThrowIfNotOnUIThread();
                ITagger <IOutliningRegionTag> tagger;

                if (MainPackage.RegionOptions.IsSupported(language) && ScanInfo.TryGet(language, out ScanInfo scanInfo))
                {
                    tagger = new OutliningTagger(buffer, scanInfo);
                }
                else
                {
                    tagger = NonOutliningTagger.Instance;
                }

                return(tagger);
            }

            ITagger <IOutliningRegionTag> result = buffer.Properties.GetOrCreateSingletonProperty(CreateBufferTagger);

            return(result as ITagger <T>);
        }
コード例 #7
0
        public ActionResult UploadScanVersion(Guid originalID, Guid documentID, HttpPostedFileBase file)
        {
            if (file != null)
            {
                ScansRepository scanRepo    = new ScansRepository();
                Scan            visibleScan = scanRepo.GetScan(originalID);

                //jeœli skan jest dodany do dokumentu podczas tej edycji, to nie mam jeszcze przypisanego ID dokumentu
                if (!visibleScan.DocumentID.HasValue)
                {
                    _repository.SetDocumentScan(visibleScan.ScanID, documentID);
                    _repository.SubmitChanges();
                }

                if (visibleScan.OriginalScanID.HasValue)
                {
                    originalID = visibleScan.OriginalScanID.Value;
                }

                ScanBrowser browser = ScanBrowserFactory.Create();
                byte[]      content = new byte[file.ContentLength];
                file.InputStream.Read(content, 0, file.ContentLength);
                ScanInfo info = browser.GetScanFromFile(content, file.FileName);
                try
                {
                    _repository.AddScanVersion(originalID, info.FileName, info.MimeType, info.Scan, info.ScanPreview ?? new byte[0], "image/png", info.ScanZoom ?? new byte[0], AppContext.GetCID());
                }
                catch { }
            }

            return(RedirectToAction("Edit", new { documentID = documentID }));// (result);
        }
コード例 #8
0
        public void StartScan(ScanInfo scanInfo)
        {
            //once discovery request received, push it to queue.
            var createProcessStartCommand = new CreateDiscoveryProcessStartCommand(scanInfo.Id, scanInfo.ScanType);

            _bus.SendCommand(createProcessStartCommand);
        }
コード例 #9
0
ファイル: Types.cs プロジェクト: marcellus/fivemen
 public static string ScanInfoMessage(ScanInfo info, bool isUndo)
 {
     if (isUndo && info == ScanInfo.Successful)
     {
         return("撤消成功!");
     }
     return(ScanInfoMessage(info));
 }
コード例 #10
0
ファイル: AttendeeQuit.cs プロジェクト: kerkesix/satku
 public AttendeeQuit(
     ScanInfo info,
     decimal walkedSinceLast,
     string description) : base(info)
 {
     this.WalkedSinceLast = walkedSinceLast;
     this.Description     = description;
 }
コード例 #11
0
        private Task ExecuteScanTimeChange(ChangeScanTimeCommandBase c, ScanTimeType timeType)
        {
            var scanInfo = new ScanInfo(
                c.HappeningId, c.CheckpointId, c.PersonId, c.Id, c.Timestamp, c.NewTime, c.Context.User);

            return(this.checkpointRepository.Execute(
                       c.CheckpointId, checkpoint => checkpoint.ChangeScanTime(scanInfo, timeType)));
        }
コード例 #12
0
        public Task Execute(RemoveQuit c)
        {
            var scanInfo = new ScanInfo(
                c.HappeningId, c.CheckpointId, c.PersonId, c.Id, c.Timestamp, c.Timestamp, c.Context.User);

            return(this.repository.Execute(c.HappeningId,
                                           h => h.RemoveQuit(scanInfo)));
        }
コード例 #13
0
        private void PreviewPanel_Paint(object sender, PaintEventArgs e)
        {
            //Graphics g = e.Graphics;
            using (Bitmap bmp = new Bitmap(PreviewPanel.Width, PreviewPanel.Height))
            {
                using (Graphics g = Graphics.FromImage(bmp))
                {
                    g.Clip = new Region();
                    using (SolidBrush b = new SolidBrush(PreviewPanel.BackColor))
                        g.FillRectangle(b, 0, 0, PreviewPanel.Width, PreviewPanel.Height);

                    if (ScanInfo != null)
                    {
                        try
                        {
                            ScanLine        line       = null;
                            LaserCorrection corr       = null;
                            double          size       = ScanInfo.Size() * 0.66f;
                            double          factor     = Math.Min(PreviewPanel.Width, PreviewPanel.Height) / size;
                            Matrix4d        baseMatrix = Matrix4d.Scale(factor);
                            PointF          center     = new PointF(PreviewPanel.Width / 2, PreviewPanel.Height / 2);
                            DrawGrid(g, center, (float)factor);
                            int             currentLaser      = CurrentLaserIndex;
                            List <ScanLine> selectedLaserLine = new List <ScanLine>();
                            for (int i = 0; i < ScanInfo.Count; i++)
                            {
                                line = ScanInfo[i];

                                corr = new LaserCorrection();
                                corr.LoadFromSettings(line.LaserID);
                                bool selected = currentLaser == line.LaserID;
                                if (!selected)
                                {
                                    DrawScanLine(g, center, factor, line, corr, false);
                                }
                                else
                                {
                                    selectedLaserLine.Add(line);
                                }
                            }

                            corr = new LaserCorrection();
                            corr.LoadFromSettings(selectedLaserLine[Math.Max(0, currentLaser)].LaserID);
                            corr.Apply(Drag);
                            for (int i = 0; i < selectedLaserLine.Count; i++)
                            {
                                DrawScanLine(g, center, factor, selectedLaserLine[i], corr, true);
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                e.Graphics.Clip = new Region();
                e.Graphics.DrawImageUnscaled(bmp, new Point(0, 0));
            }
        }
コード例 #14
0
ファイル: AttendeeScanBase.cs プロジェクト: kerkesix/satku
 protected AttendeeScanBase(ScanInfo info)
 {
     this.HappeningId   = info.HappeningId;
     this.PersonId      = info.PersonId;
     this.ScanId        = info.ScanId;
     this.ReadBy        = info.ReadBy;
     this.Timestamp     = info.Timestamp;
     this.ScanTimestamp = info.ScanTimestamp;
     this.CheckpointId  = info.CheckpointId;
 }
コード例 #15
0
        public void Quit(ScanInfo scan, decimal walkedSinceLast, string description)
        {
            if (State.Quitters.Contains(scan.PersonId) || State.Completed.Contains(scan.PersonId))
            {
                Trace.TraceWarning("User either quit or completed, quit canceled.");
                return;
            }

            Apply(new AttendeeQuit(scan, walkedSinceLast, description));
        }
コード例 #16
0
        public void RemoveQuit(ScanInfo scanInfo)
        {
            if (State.Completed.Contains(scanInfo.PersonId) || !State.Quitters.Contains(scanInfo.PersonId))
            {
                Trace.TraceWarning("User either quit or completed, remove quit canceled.");
                return;
            }

            Apply(new AttendeeQuitRemoved(scanInfo));
        }
コード例 #17
0
        public void ValidateRemoveScan(ScanInfo scanInfo)
        {
            if (State.Completed.Contains(scanInfo.PersonId) || State.Quitters.Contains(scanInfo.PersonId))
            {
                Trace.TraceWarning("User either quit or completed, scan removal canceled.");
                return;
            }

            Apply(new RemoveScanValidated(scanInfo));
        }
コード例 #18
0
 internal static void OutputValuableBody(ScanInfo scanInfoEvent, ILogger logger) // "InGame" Logger
 {
     if (null != scanInfoEvent)
     {
         var output = String.Empty;
         if (false == string.IsNullOrEmpty(scanInfoEvent.TerraformState))
         {
             output = $"Body {scanInfoEvent.BodyName} is {scanInfoEvent.TerraformState}";
             logger.LogInformation(output);
         }
     }
 }
コード例 #19
0
        public Task Execute(Quit c)
        {
            var quitTime = c.QuitTimestamp ?? c.Timestamp;
            var scanInfo = new ScanInfo(
                c.HappeningId, c.CheckpointId, c.PersonId, c.Id, c.Timestamp, quitTime, c.Context.User);

            return(this.repository.Execute(c.HappeningId,
                                           h => h.Quit(
                                               scanInfo,
                                               c.WalkedSinceLast,
                                               c.Description)));
        }
コード例 #20
0
ファイル: TextLines.cs プロジェクト: menees/VsTools
        public string Stream(Language language)
        {
            string singleLineCommentDelimiter = null;

            if (ScanInfo.TryGet(language, out ScanInfo scanInfo))
            {
                singleLineCommentDelimiter = scanInfo.TryGetSingleLineCommentDelimiter();
            }

            StringBuilder sb = new();

            int  numLines    = this.lines.Length;
            bool startOfLine = true;

            for (int i = 0; i < numLines; i++)
            {
                string line = this.lines[i];
                RemoveLinePrefix(ref line, singleLineCommentDelimiter);

                if (string.IsNullOrEmpty(line))
                {
                    sb.Append("\r\n");
                    startOfLine = true;
                }
                else
                {
                    if (startOfLine)
                    {
                        if (sb.Length > 0)
                        {
                            sb.Append("\r\n");
                        }
                    }
                    else
                    {
                        sb.Append(' ');
                    }

                    sb.Append(line);
                    startOfLine = false;
                }
            }

            if (this.endsInHardReturn)
            {
                sb.Append("\r\n");
            }

            return(sb.ToString());
        }
コード例 #21
0
        public static ScanInfo ToScanInfo(this Scan c)
        {
            var scanTime = c.ScanTimestamp ?? c.Timestamp;
            var scanInfo = new ScanInfo(
                c.HappeningId,
                c.CheckpointId,
                c.PersonId,
                c.Id,
                c.Timestamp,
                scanTime,
                c.Context.User);

            return(scanInfo);
        }
コード例 #22
0
 public override DateTime RetrieveScanDate()
 {
     if (File.Exists(docControl.FileName))
     {
         var      f  = new FileInfo(docControl.FileName);
         ScanInfo si = TextProcessor.ParseScanInfo(f);
         if (si == null)
         {
             DateTime date = f.CreationTimeUtc;
             return(date);
         }
         return(si.Date.ToUniversalTime());
     }
     throw new Exception("RetrieveScanDate() Error");
 }
コード例 #23
0
        public ITagger <T> CreateTagger <T>(ITextBuffer buffer)
            where T : ITag
        {
            Func <OutliningTagger> createBufferTagger = () =>
            {
                Language language = DocumentItem.GetLanguage(buffer);
                ScanInfo scanInfo;
                ScanInfo.TryGet(language, out scanInfo);
                return(new OutliningTagger(buffer, scanInfo));
            };

            OutliningTagger result = buffer.Properties.GetOrCreateSingletonProperty <OutliningTagger>(createBufferTagger);

            return(result as ITagger <T>);
        }
コード例 #24
0
ファイル: Types.cs プロジェクト: marcellus/fivemen
        public static string ScanInfoMessage(ScanInfo info)
        {
            switch (info)
            {
            case ScanInfo.Successful:
                return(string.Empty);

            case ScanInfo.ScanError:
                return("扫描失败,请重试!");

            case ScanInfo.NotInLoc:
                return("该料盘对应库位错误,扫描失败!");

            case ScanInfo.NotInBill:
                return("该料盘不在本次扫描计划中!");

            case ScanInfo.NotScan:
                return("该料盘未扫描,不能撤消!");

            case ScanInfo.RepeatScan:
                return("该料盘已扫描,不能重复扫描!");

            case ScanInfo.Underflow:
                return("超出物料已扫描数量,不能撤消!");

            case ScanInfo.Overflow:
                return("超出物料计划扫描数量,扫描失败!");

            case ScanInfo.PartCountError:
                return("分盘数量与锁定数量不一致!");

            case ScanInfo.PartSubReScan:
                return("该子盘已扫描,扫描失败!");

            case ScanInfo.NotExpectedLoc:
                return("所扫库位非指导库位");

            case ScanInfo.OverflowFullDisk:
                return("超出可扫整盘数量!");

            case ScanInfo.NotExpectedLot:
                return("新批次号错误!");

            default:
                return(string.Empty);
            }
        }
コード例 #25
0
ファイル: CommentHandler.cs プロジェクト: menees/VsTools
        private static bool GetCommentStyle(
            Language language,
            bool useVsIndentation,
            bool preferEndDelimited,
            out string beginDelimiter,
            out string endDelimiter)
        {
            beginDelimiter = null;
            endDelimiter   = null;

            if (ScanInfo.TryGet(language, out ScanInfo scanInfo))
            {
                if (preferEndDelimited)
                {
                    (beginDelimiter, endDelimiter) = scanInfo.TryGetMultiLineCommentDelimiters();
                }

                // If multiLine was preferred but missing (e.g., VB), then we have to return the singleLine.
                if (string.IsNullOrEmpty(beginDelimiter))
                {
                    beginDelimiter = scanInfo.TryGetSingleLineCommentDelimiter();
                }

                // If singleLine was preferred but missing (e.g., HTML, XML), then we have to return the multiLine.
                if (!preferEndDelimited && string.IsNullOrEmpty(beginDelimiter))
                {
                    (beginDelimiter, endDelimiter) = scanInfo.TryGetMultiLineCommentDelimiters();
                }
            }

            switch (language)
            {
            case Language.VB:
                // VB's auto-formatter throws out leading indentation and indents all comments to
                // one level under their parent.  So I won't use my default indentation style for it.
                useVsIndentation = true;
                break;

            case Language.VBScript:
                // In VS 2012, the VBScript language service has selection bugs when commenting
                // and uncommenting, so I'll always use my indentation style for it.
                useVsIndentation = false;
                break;
            }

            return(useVsIndentation);
        }
コード例 #26
0
        public ActionResult UploadScan(Guid documentID, HttpPostedFileBase file)
        {
            if (file != null)
            {
                ScanBrowser browser = ScanBrowserFactory.Create();
                byte[]      content = new byte[file.ContentLength];
                file.InputStream.Read(content, 0, file.ContentLength);
                ScanInfo info = browser.GetScanFromFile(content, file.FileName);

                Guid scanId = ScansHelper.AddScan(info);

                _repository.SetDocumentScan(scanId, documentID);
                _repository.SubmitChanges();
            }

            return(RedirectToAction("Edit", new { documentID = documentID }));// (result);
        }
コード例 #27
0
        public ActionResult UploadScan()
        {
            for (int i = 0; i < Request.Files.Count; i++)
            {
                HttpPostedFileBase file = Request.Files[i];
                if (file != null)
                {
                    ScanBrowser browser = ScanBrowserFactory.Create();
                    byte[]      content = new byte[file.ContentLength];
                    file.InputStream.Read(content, 0, file.ContentLength);
                    ScanInfo info = browser.GetScanFromFile(content, file.FileName);

                    Guid scanId = ScansHelper.AddScan(info);
                }
            }
            return(RedirectToAction("Index"));
        }
コード例 #28
0
        public ActionResult SplitFile(Guid?scanGuid)
        {
            if (scanGuid.HasValue)
            {
                ScanBrowser     browser        = ScanBrowserFactory.Create();
                ScansRepository scanRepository = new ScansRepository();
                Scan            scan           = scanRepository.GetScan(scanGuid.Value);

                byte[]   fileContent = scan.ScanContent.ToArray();
                string[] fileName    = scan.FileName.Split('.');
                string   mimeType    = scan.MimeType;

                MemoryStream stream = new MemoryStream();
                stream.Write(fileContent, 0, fileContent.Length);


                LicensingManager.LicenseKey = "lL+mtKWhtKOnrbSjuqS0p6W6paa6ra2trQ==";

                Winnovative.PdfCreator.Document sourcedoc = new Winnovative.PdfCreator.Document(stream);
                stream.Close();

                using (TransactionScope transaction = new TransactionScope())
                {
                    if (sourcedoc != null && sourcedoc.Pages.Count > 1)
                    {
                        for (int i = 0; i < sourcedoc.Pages.Count; i++)
                        {
                            Winnovative.PdfCreator.Document newdoc = SplitPdf.ExtractPages(sourcedoc, i, 1);

                            string   newFileName = string.Join(string.Format("_{0}.", (i + 1)), fileName);
                            ScanInfo newscan     = browser.GetScanFromFile(newdoc.Save(), newFileName);
                            ScansHelper.AddScan(newscan);
                        }

                        scanRepository.DeleteScanFromRecycleBin(scan.ScanID);
                    }

                    transaction.Complete();
                }
            }


            return(RedirectToAction("Index"));
        }
コード例 #29
0
        private async Task InitializeGasPumps(Request request)
        {
            if (GasPumpsDataService.GasPumpsByStore != null)
            {
                return;
            }

            var gasScanInfo = new ScanInfo();

            gasScanInfo.ScannedText = GetGasolineItemId(request);
            var getScanResultRequest = new GetScanResultRequest(gasScanInfo);
            var response             = await request.RequestContext.Runtime.ExecuteAsync <GetScanResultResponse>(getScanResultRequest, request.RequestContext);

            if (response.Result.MaskType == BarcodeMaskType.Item)
            {
                GasPumpsDataService.COST_PER_UNIT = response.Result.Product.BasePrice;
            }

            var orgUnits = await GetAllOrgUnitsAsync(request);

            GasPumpsByStore = new Dictionary <string, IEnumerable <GasPump> >();
            var itemId = GetGasolineItemId(request);

            if (orgUnits.Any())
            {
                foreach (var orgUnit in orgUnits)
                {
                    var gasPumps = CreateGasPumps(orgUnit);
                    GasPumpsByStore.Add(orgUnit.OrgUnitNumber, gasPumps);

                    var stationDetails = new GasStationDetails(orgUnit.OrgUnitNumber, itemId);
                    stationDetails.GasPumpCount = gasPumps.Count;
                    var daysSinceDelivery = (orgUnit.RecordId % 6) + 1;
                    stationDetails.LastGasDeliveryTime = DateTimeOffset.UtcNow.AddDays(daysSinceDelivery * -1);
                    var calculatedTime = DateTimeOffset.UtcNow.AddDays(7 - daysSinceDelivery).AddHours(orgUnit.RecordId % 8).AddMinutes(orgUnit.RecordId % 60);
                    stationDetails.NextGasDeliveryTime = new DateTimeOffset(calculatedTime.Year, calculatedTime.Month, calculatedTime.Day, calculatedTime.Hour, 0, 0, calculatedTime.Offset);
                    stationDetails.GasTankCapacity     = stationDetails.GasPumpCount * 1000;
                    stationDetails.GasTankLevel        = stationDetails.GasTankCapacity - (stationDetails.GasTankCapacity / 10 * daysSinceDelivery);
                    stationDetails.GasBasePrice        = GasPumpsDataService.COST_PER_UNIT;
                    GasStations.Add(stationDetails);
                }
            }
        }
コード例 #30
0
        public void ValidateScan(ScanInfo scan)
        {
            // These are non-business events, just exit without an event to keep event count down.
            // These are checked on UI already, should never happen.
            if (State.Quitters.Contains(scan.PersonId) || State.Completed.Contains(scan.PersonId))
            {
                Trace.TraceWarning("User either quit or completed, scan canceled.");
                return;
            }

            // UI logic validates that this attendee actually exists on this happening. Just exit here.
            if (!State.Started.Contains(scan.PersonId))
            {
                Trace.TraceWarning("User has not started, scan canceled.");
                return;
            }

            Apply(new ScanValidated(scan));
        }
コード例 #31
0
ファイル: Types.cs プロジェクト: romanu6891/fivemen
 public static string ScanInfoMessage(ScanInfo info, bool isUndo)
 {
     if (isUndo && info == ScanInfo.Successful)
     {
         return "撤消成功!";
     }
     return ScanInfoMessage(info);
 }
コード例 #32
0
ファイル: Types.cs プロジェクト: romanu6891/fivemen
 public static string ScanInfoMessage(ScanInfo info)
 {
     switch (info)
     {
         case ScanInfo.Successful:
             return string.Empty;
         case ScanInfo.ScanError:
             return "扫描失败,请重试!";
         case ScanInfo.NotInLoc:
             return "该料盘对应库位错误,扫描失败!";
         case ScanInfo.NotInBill:
             return "该料盘不在本次扫描计划中!";
         case ScanInfo.NotScan:
             return "该料盘未扫描,不能撤消!";
         case ScanInfo.RepeatScan:
             return "该料盘已扫描,不能重复扫描!";
         case ScanInfo.Underflow:
             return "超出物料已扫描数量,不能撤消!";
         case ScanInfo.Overflow:
             return "超出物料计划扫描数量,扫描失败!";
         case ScanInfo.PartCountError:
             return "分盘数量与锁定数量不一致!";
         case ScanInfo.PartSubReScan:
             return "该子盘已扫描,扫描失败!";
         case ScanInfo.NotExpectedLoc:
             return "所扫库位非指导库位";
         case ScanInfo.OverflowFullDisk:
             return "超出可扫整盘数量!";
         case ScanInfo.NotExpectedLot:
             return "新批次号错误!";
         default:
             return string.Empty;
     }
 }
コード例 #33
0
ファイル: Program.cs プロジェクト: ThomasJackDalby/logic
 public void Scan(Unit unit, ScanAction action)
 {
     ScanInfo scanInfo = new ScanInfo();
     if (action.Direction == API.Direction.Down || action.Direction == API.Direction.Up)
     {
         int del;
         if (action.Direction == API.Direction.Down) del = -1;
         else del = 1;
         for (int x=-1;x<1;x++)
         {
             int ax = unit.X + x;
             int ay = unit.Y + del;
             if (ax < 0 || ax >= Data.Map.MapWidth) return;
             if (ay < 0 || ay >= Data.Map.MapLength) return;
             Tile tile = Data.Map.Tiles[ay][ax];
             if (tile != null) scanInfo.Tiles.Add(tile.GetInfo());
         }
     }
     if (action.Direction == API.Direction.Left || action.Direction == API.Direction.Right)
     {
         int del;
         if (action.Direction == API.Direction.Left) del = -1;
         else del = 1;
         for (int y = -1; y < 1; y++)
         {
             int ax = unit.X + del;
             int ay = unit.Y + y;
             if (ax < 0 || ax >= Data.Map.MapWidth) return;
             if (ay < 0 || ay >= Data.Map.MapLength) return;
             Tile tile = Data.Map.Tiles[ay][ax];
             if (tile != null) scanInfo.Tiles.Add(tile.GetInfo());
         }
     }
     unit.Player.AI.ReceiveScanInfo(scanInfo);
 }