private std::error_code processTransaction(TransactionBlockInfo blockInfo, ITransactionReader tx) { PreprocessInfo info = new PreprocessInfo(); var ec = preprocessOutputs(blockInfo, tx, info); if (ec != null) { return(ec); } processTransaction(blockInfo, tx, info); return(std::error_code()); }
private void processTransaction(TransactionBlockInfo blockInfo, ITransactionReader tx, PreprocessInfo info) { List <TransactionOutputInformationIn> emptyOutputs = new List <TransactionOutputInformationIn>(); List <ITransfersContainer> transactionContainers = new List <ITransfersContainer>(); m_logger.functorMethod(TRACE) << "Process transaction, block " << (int)blockInfo.height << ", transaction index " << (int)blockInfo.transactionIndex << ", hash " << tx.GetTransactionHash(); bool someContainerUpdated = false; foreach (var kv in m_subscriptions) { var it = info.outputs.find(kv.first); //C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops: auto subscriptionOutputs = (it == info.outputs.end()) ? emptyOutputs : it.second; bool containerContainsTx; bool containerUpdated; processOutputs(blockInfo, *kv.second, tx, subscriptionOutputs, info.globalIdxs, ref containerContainsTx, ref containerUpdated); someContainerUpdated = someContainerUpdated || containerUpdated; if (containerContainsTx) { transactionContainers.emplace_back(kv.second.getContainer()); } } if (someContainerUpdated) { m_logger.functorMethod(TRACE) << "Transaction updated some containers, hash " << tx.GetTransactionHash(); m_observerManager.notify(IBlockchainConsumerObserver.onTransactionUpdated, this, tx.GetTransactionHash(), transactionContainers); } else { m_logger.functorMethod(TRACE) << "Transaction doesn't updated any container, hash " << tx.GetTransactionHash(); } }
private void tbWeight_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { try { tbWeight.Enabled = false; List <PreprocessInfoAdd> list = new List <PreprocessInfoAdd>(); if (goods.weighed == 1) { #region 称重 if (string.IsNullOrWhiteSpace(tbWeight.Text.Trim())) { MessageBox.Show("请录入重量!"); tbWeight.Focus(); return; } decimal weight = 0; decimal.TryParse(tbWeight.Text.Trim(), out weight); if (weight <= 0) { MessageBox.Show("录入重量必须大于0!"); tbWeight.Focus(); return; } curWeight = Util.ConvertGToJin(weight); decimal downWeight = goods.modelNum - (goods.downLimit * goods.modelNum) / 100; decimal upWeight = goods.modelNum + (goods.upLimit * goods.modelNum) / 100; if (curWeight < downWeight) { MessageBox.Show("商品重量小于下限"); return; } if (curWeight > upWeight) { MessageBox.Show("重量不能大于上限"); return; } PreprocessInfoAdd add = new PreprocessInfoAdd(); add.createUser = UserInfo.RealName; add.goodsName = goods.goodsName; add.goodsUnit = goods.goodsUnit; add.modelNum = goods.modelNum; add.operateUser = UserInfo.RealName; add.packWeight = curWeight; add.partnerCode = UserInfo.PartnerCode; add.partnerName = UserInfo.PartnerName; add.physicsUnit = goods.physicsUnit; add.skuCode = goods.skuCode; add.status = 0; add.updateUser = UserInfo.RealName; list.Add(add); #endregion } else { #region 包裹数 if (string.IsNullOrWhiteSpace(tbWeight.Text.Trim())) { MessageBox.Show("请录入包裹数!"); tbWeight.Focus(); return; } int weight = 0; int.TryParse(tbWeight.Text.Trim(), out weight); if (weight <= 0) { MessageBox.Show("录入包裹数必须大于0!"); tbWeight.Focus(); return; } if (weight > 20) { MessageBox.Show("录入包裹数不能大于20!"); tbWeight.Focus(); return; } for (int i = 0; i < weight; i++) { PreprocessInfoAdd add = new PreprocessInfoAdd(); add.createUser = UserInfo.RealName; add.goodsName = goods.goodsName; add.goodsUnit = goods.goodsUnit; add.modelNum = goods.modelNum; add.operateUser = UserInfo.RealName; add.packWeight = goods.modelNum; add.partnerCode = UserInfo.PartnerCode; add.partnerName = UserInfo.PartnerName; add.physicsUnit = goods.physicsUnit; add.skuCode = goods.skuCode; add.status = 0; add.updateUser = UserInfo.RealName; list.Add(add); } #endregion } PreprocessInfoRequest request = new PreprocessInfoRequest(); request.wareHouseId = UserInfo.WareHouseCode; request.request = list; PreprocessInfoAddResponse response = client.Execute(request); if (!response.IsError) { if (response.result != null) { preprocessInfoList = response.result; foreach (PreprocessInfo item in preprocessInfoList) { curPreprocessInfo = item; PrintDocument document = new PrintDocument(); document.DefaultPageSettings.PaperSize = new PaperSize("Custum", 270, 180); #if (!DEBUG) PrintDialog dialog = new PrintDialog(); document.PrintPage += new PrintPageEventHandler(this.pd_PrintPage); dialog.Document = document; #else PrintPreviewDialog dialog = new PrintPreviewDialog(); document.PrintPage += new PrintPageEventHandler(this.pd_PrintPage); dialog.Document = document; #endif try { document.Print(); } catch (Exception exception) { MessageBox.Show("打印异常" + exception); document.PrintController.OnEndPrint(document, new PrintEventArgs()); } } } GetCount(); } tbWeight.Text = ""; } catch (Exception ex) { MessageBox.Show("出现异常" + ex.Message); } finally { tbWeight.Enabled = true; tbWeight.Focus(); } } }
private std::error_code preprocessOutputs(TransactionBlockInfo blockInfo, ITransactionReader tx, PreprocessInfo info) { Dictionary <PublicKey, List <uint> > outputs = new Dictionary <PublicKey, List <uint> >(); try { GlobalMembers.findMyOutputs(tx, m_viewSecret, m_spendKeys, outputs); } catch (System.Exception e) { m_logger.functorMethod(WARNING, BRIGHT_RED) << "Failed to process transaction: " << e.Message << ", transaction hash " << Common.GlobalMembers.podToHex(tx.GetTransactionHash()); return(std::error_code()); } if (outputs.Count == 0) { return(std::error_code()); } std::error_code errorCode = new std::error_code(); var txHash = tx.GetTransactionHash(); if (blockInfo.height != GlobalMembers.WALLET_UNCONFIRMED_TRANSACTION_HEIGHT) { //C++ TO C# CONVERTER TODO TASK: There is no equivalent to 'reinterpret_cast' in C#: //C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created: //ORIGINAL LINE: errorCode = getGlobalIndices(reinterpret_cast<const Hash&>(txHash), info.globalIdxs); errorCode.CopyFrom(getGlobalIndices(reinterpret_cast <const Hash&>(txHash), info.globalIdxs)); if (errorCode != null) { return(errorCode); } } foreach (var kv in outputs) { var it = m_subscriptions.find(kv.first); //C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops: if (it != m_subscriptions.end()) { auto transfers = info.outputs[kv.first]; //C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created: //ORIGINAL LINE: errorCode = createTransfers(it->second->getKeys(), blockInfo, tx, kv.second, info.globalIdxs, transfers, m_logger); //C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops: errorCode.CopyFrom(CryptoNote.GlobalMembers.createTransfers(it.second.getKeys(), blockInfo, tx, kv.second, info.globalIdxs, transfers, m_logger.functorMethod)); if (errorCode != null) { return(errorCode); } } } return(std::error_code()); }
public void GetPrintPicture(Bitmap image, PrintPageEventArgs g, PreprocessInfo preprocessInfo) { Font fontCu = new Font("宋体", 12f, FontStyle.Bold); int height = 15; int heightRight = 15; Font font = new Font("宋体", 10f); Brush brush = new SolidBrush(Color.Black); g.Graphics.SmoothingMode = SmoothingMode.HighQuality; int interval = 5; int pointX = 35; RectangleF layoutRectangleRight = new RectangleF(135f, 5, 130f, 85f); //g.Graphics.DrawString(preprocessInfo.preprocessCode, font, brush, layoutRectangleRight); Rectangle destRect = new Rectangle(200, -15, image.Width, image.Height); g.Graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); //heightRight =image.Width-20; //layoutRectangleRight = new RectangleF(155, heightRight, 150f, 85f); //g.Graphics.DrawString(UserInfo.CompanyName, font, brush, layoutRectangleRight); heightRight += 20; layoutRectangleRight = new RectangleF(155, heightRight, 150f, 85f); g.Graphics.DrawString(UserInfo.RealName, font, brush, layoutRectangleRight); heightRight += 15; layoutRectangleRight = new RectangleF(155, heightRight, 150f, 85f); g.Graphics.DrawString(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), font, brush, layoutRectangleRight); //门店名称 RectangleF layoutRectangle = new RectangleF(pointX, height, 120f, 30f); //商品名称 layoutRectangle = new RectangleF(pointX, 5, 180f, 30f); g.Graphics.DrawString(preprocessInfo.goodsName, font, brush, layoutRectangle); height += interval + 20; //重量 layoutRectangle = new RectangleF(pointX, height, 120f, 40f); g.Graphics.DrawString(preprocessInfo.packWeight.ToString("f2") + "斤", fontCu, brush, layoutRectangle); height += interval + 13; Rectangle dest2Rect = new Rectangle(pointX, 80, image.Width, image.Height); g.Graphics.DrawImage(image, dest2Rect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); height = 80 + image.Height - 15; layoutRectangle = new RectangleF(pointX, height, 150f, 30f); g.Graphics.DrawString(preprocessInfo.preprocessCode, font, brush, layoutRectangle); }