Exemple #1
0
        private void LoadStuff()
        {
            if (stock.Length > 0 && File.Exists(stock))
            {
                try
                {
                    log.PushActivity("Loading stock");
                    StockDoc = StockDocument.Load(stock);
                    if (StockDoc == null)
                    {
                        StockDoc = new StockDocument();
                    }
                }
                catch (Exception)
                {
                    StockDoc = new StockDocument();
                }
                log.PopActivity();
            }
            else
            {
                StockDoc = new StockDocument();
            }
            log.PushActivity("Loading document");
            B = new BOM();

            if (bom.Length > 0 && pnp.Length > 0)
            {
                String DirBaseName = Path.GetFileNameWithoutExtension(pnp);
                log.PushActivity("Processing " + DirBaseName);

                log.PushActivity("Loading BOM");
                log.AddString(String.Format("Loading BOM! {0},{1}", Path.GetFileName(bom), Path.GetFileName(pnp)));
                B.LoadJLC(bom, pnp);
                log.PopActivity();

                if (gerberzip != null && File.Exists(gerberzip))
                {
                    Set = LoadGerberZip(gerberzip, log);
                }
                else
                {
                    Set = new GerberImageCreator();
                }
                Box = Set.BoundingBox;

                BuildPostBom();

                log.PopActivity();
            }
            else
            {
                log.AddString(String.Format("pnp and bom need to be valid! bom:{0} pnp:{1}", bom, pnp));
            }


            loaded = true;
            log.AddString("Done!");
            log.PopActivity();
        }
 protected virtual void DeleteEntities(StockDocumentsJournalNode[] nodes)
 {
     foreach (var node in nodes)
     {
         var doctype = StockDocument.GetDocClass(node.DocTypeEnum);
         DeleteEntityService.DeleteEntity(doctype, DomainHelper.GetId(node));
     }
 }
        public async Task <Stock> Handle(CreateRequest <Stock> request, CancellationToken cancellationToken)
        {
            StockDocument companyDocument = new StockDocument
            {
                Id          = ObjectId.GenerateNewId().ToString(),
                Name        = request.Item.Name,
                Symbol      = request.Item.Symbol,
                Type        = request.Item.Type,
                Region      = request.Item.Region,
                MarketOpen  = request.Item.MarketOpen,
                MarketClose = request.Item.MarketClose,
                TimeZone    = request.Item.TimeZone,
                Currency    = request.Item.Currency
            };

            await _client.Stocks.CreateDocumentAsync(companyDocument);

            return(companyDocument);
        }