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 InitializeTestData() { var articleRepositoryStub = MockRepository.GenerateMock <IRepository <articles> >(); var articleTypeRepositoryStub = MockRepository.GenerateMock <IRepository <articleTypes> >(); var customerRepositoryStub = MockRepository.GenerateMock <IRepository <customers> >(); var categoryRepositoryStub = MockRepository.GenerateMock <IRepository <categories> >(); var articleService = new ArticleService(articleRepositoryStub, articleTypeRepositoryStub, customerRepositoryStub, categoryRepositoryStub); moto = new moto() { title = "moto 1", detail = "moto 1 detail", customer_id = 1, category_Id = 1, precio = 10, vin = "001" }; articleService.CreateModel(moto); auto = new auto() { title = "auto 1", detail = "auto 1 detail", customer_id = 1, category_Id = 1, price_auto = 50, kilometraje = "100 km" }; articleService.CreateModel(auto); }
private void saveUnlockTransactionsJobs(CryptoNote.ISerializer serializer) { auto index = m_unlockTransactions.get <TransactionHashIndex>(); auto wallets = m_walletsContainer.get <TransfersContainerIndex>(); ulong jobsCount = index.size(); serializer.functorMethod(jobsCount, "unlockTransactionsJobsCount"); foreach (var j in index) { var containerIt = wallets.find(j.container); Debug.Assert(containerIt != wallets.end()); var keyIt = m_walletsContainer.project <KeysIndex>(containerIt); Debug.Assert(keyIt != m_walletsContainer.get <KeysIndex>().end()); UnlockTransactionJobDtoV2 dto = new UnlockTransactionJobDtoV2(); dto.blockHeight = j.blockHeight; dto.transactionHash = j.transactionHash; dto.walletSpendPublicKey = keyIt.spendPublicKey; serializer.functorMethod(dto, "unlockTransactionsJob"); } }
//C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#: //ORIGINAL LINE: virtual void getOutput(uint index, KeyOutput& output, ulong& amount) const override public override void getOutput(uint index, ref KeyOutput output, ref ulong amount) { auto @out = getOutputChecked(m_txPrefix, index, TransactionTypes.OutputType.Key); output = boost::get <KeyOutput>(@out.target); amount = @out.amount; }
private void loadUnlockTransactionsJobs(CryptoNote.ISerializer serializer) { auto index = m_unlockTransactions.get <TransactionHashIndex>(); auto walletsIndex = m_walletsContainer.get <KeysIndex>(); ulong jobsCount = 0; serializer.functorMethod(jobsCount, "unlockTransactionsJobsCount"); for (ulong i = 0; i < jobsCount; ++i) { UnlockTransactionJobDtoV2 dto = new UnlockTransactionJobDtoV2(); serializer.functorMethod(dto, "unlockTransactionsJob"); var walletIt = walletsIndex.find(dto.walletSpendPublicKey); if (walletIt != walletsIndex.end()) { UnlockTransactionJob job = new UnlockTransactionJob(); job.blockHeight = dto.blockHeight; job.transactionHash = dto.transactionHash; job.container = walletIt.container; index.insert(std::move(job)); } } }
private void btnAgregar_Click(object sender, EventArgs e) { if (validarfoto()) { auto datos = new auto(); datos.marca = txtMarca.Text; datos.modelo = txtModelo.Text; datos.color = txtColor.Text; datos.precio = double.Parse(txtPrecio.Text); datos.nserie = txtNoSerie.Text; datos.nacionalidad = txtNacionalidad.Text; datos.Observacion = txtObservaciones.Text; clsManejoAutos.savenewauto(datos, idpropietario); galeria datosGla1 = new galeria(); datosGla1.fotografia = Webcam.SaveImageCapture(pcbFoto1.Image); clsGaleria.saveGaleria(datosGla1, datos.idauto); galeria datosGla2 = new galeria(); datosGla2.fotografia = Webcam.SaveImageCapture(pcbFoto2.Image); clsGaleria.saveGaleria(datosGla2, datos.idauto); galeria datosGla3 = new galeria(); datosGla3.fotografia = Webcam.SaveImageCapture(pcbFoto3.Image); clsGaleria.saveGaleria(datosGla3, datos.idauto); this.Close(); } else { MessageBox.Show("Faltan las imagenes"); } }
static void Main(string[] args) //abbiamo creato la struttura fuori dal main adesso andiamo a lavorare sui dati dentro il main { auto x; //dichiariamo l'oggetto x = new auto(); //istanziamo l'oggetto x.fatti_inserire_dati(); Console.WriteLine("Premi un tasto per continuare"); //blocchiamo il programma per leggere Console.ReadKey(); //pressione di un tasto della tastiera Console.WriteLine("Riepilgando"); //scriviamo a video avvisando che andremo a stampare x.stampa_a_video(); Console.WriteLine("Premi un tasto per continuare"); //blocchiamo il programma per leggere Console.ReadKey(); //pressione di un tasto della tastiera x.azzera(); //chiamiamo la funzione che è stata scritta dentro la struct che andrà ad azzerare tutti i nostri dati Console.WriteLine("Riepilgando di nuovo... ora che è stata azzerata"); //avvisiamo l'utente che stamperemo di nuovo i dati x.stampa_a_video(); Console.WriteLine("Premi un tasto per continuare"); Console.ReadKey(); }
public void AddAuto() { var nums = (from a in db.auto select a.num).ToList(); foreach (string num in nums) { if (num == this.num.ToUpper()) { throw new Exception("Данный автомобиль уже зарегестрирован в базе"); } } int new_id = db.objects.Max(n => n.id_o) + 1; objects obj = new objects { id_o = new_id, type_o = "a" }; auto auto = new auto { id_a = new_id, model = model, num = num.ToUpper(), year_a = year }; db.objects.Add(obj); db.auto.Add(auto); db.SaveChanges(); }
public ITransfersSubscription addSubscription(AccountSubscription subscription) { if (subscription.keys.viewSecretKey != m_viewSecret) { throw new System.Exception("TransfersConsumer: view secret key mismatch"); } auto res = m_subscriptions[subscription.keys.address.spendPublicKey]; if (res.get() == null) { res.reset(new TransfersSubscription(m_currency, m_logger.GetLogger(), subscription)); m_spendKeys.Add(subscription.keys.address.spendPublicKey); if (m_subscriptions.Count == 1) { m_syncStart = res.getSyncStart(); } else { var subStart = res.getSyncStart(); m_syncStart.height = Math.Min(m_syncStart.height, subStart.height); m_syncStart.timestamp = Math.Min(m_syncStart.timestamp, subStart.timestamp); } } return(*res); }
/// <summary> /// 创建CSharp代码生成器 /// </summary> /// <param name="type">模板数据视图</param> /// <param name="auto">安装属性</param> /// <returns>生成器代码</returns> private static string createClass(Type type, auto auto) { coder code = new coder(type); code.skin(getNode(auto.GetFileName(type))); return(code.partCodes["CLASS"]); }
//C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#: //ORIGINAL LINE: const Crypto::Hash& getBlockLongHash() const public Crypto.Hash getBlockLongHash() { if (!blockLongHash.is_initialized()) { if (block.majorVersion == BLOCK_MAJOR_VERSION_1) { auto rawHashingBlock = getBlockHashingBinaryArray(); blockLongHash = Hash(); Crypto.GlobalMembers.cn_slow_hash_v0(rawHashingBlock.data(), rawHashingBlock.size(), blockLongHash.get()); } else if ((block.majorVersion == BLOCK_MAJOR_VERSION_2) || (block.majorVersion == BLOCK_MAJOR_VERSION_3)) { auto rawHashingBlock = getParentBlockHashingBinaryArray(true); blockLongHash = Hash(); Crypto.GlobalMembers.cn_slow_hash_v0(rawHashingBlock.data(), rawHashingBlock.size(), blockLongHash.get()); } else if (block.majorVersion >= BLOCK_MAJOR_VERSION_4) { auto rawHashingBlock = getParentBlockHashingBinaryArray(true); blockLongHash = Hash(); Crypto.GlobalMembers.cn_lite_slow_hash_v1(rawHashingBlock.data(), rawHashingBlock.size(), blockLongHash.get()); } else { throw new System.Exception("Unknown block major version."); } } return(blockLongHash.get()); }
public static void savePago(int idauto) { try { var ctx = new DataModel(); pago pg = new pago(); auto au = ctx.autos.Where(r => r.idauto == idauto).FirstOrDefault(); ctx.autos.Attach(au); pg.autos = au; /* * propietario pr = ctx.propietarios.Where(r => r.idpropietario == idprop).FirstOrDefault(); * ctx.propietarios.Attach(pr); * pg.propietarios = pr; */ pg.fecha = DateTime.Now; ctx.Entry(pg).State = EntityState.Added; ctx.SaveChanges(); } catch (Exception) { throw; } }
public ActionResult DeleteConfirmed(string id) { auto auto = db.auto.Find(id); db.auto.Remove(auto); db.SaveChanges(); return(RedirectToAction("Index")); }
public EditAuto(auto auto) { item2 = auto; InitializeComponent(); textBox1.Text = item2.model; maskedTextBox1.Text = item2.num; numericUpDown1.Value = (int)item2.year_a; }
public bool get_peerlist_head(LinkedList <PeerlistEntry> bs_head, uint depth = CryptoNote.P2P_DEFAULT_PEERS_IN_HANDSHAKE) { /* Sort the peers by last seen [Newer peers come first] */ //C++ TO C# CONVERTER TODO TASK: The following line could not be converted: std::sort(m_peers_white.begin(), m_peers_white.end(), [] (const auto& lhs, const auto& rhs) { return(lhs.last_seen > rhs.last_seen); }
private void btnGuardar_Click(object sender, EventArgs e) { if (pcbFoto.Image != null) { if (validarPropietario()) { if (validarAuto()) { var datos = new propietario(); datos.nombre = txtNombre.Text; datos.appaterno = txtApPaterno.Text; datos.apmaterno = txtApMateno.Text; datos.ine = txtINE.Text; datos.telefono = txtTelefono.Text; datos.correo = txtCorreo.Text; datos.calle = txtCalle.Text; datos.ncasa = txtNoCasa.Text; datos.avenida = txtAvenida.Text; datos.colonia = txtColonia.Text; datos.ciudad = txtCiudad.Text; datos.pais = txtPais.Text; datos.fotografia = Webcam.SaveImageCapture(pcbFoto.Image); //clsManejoPropietarios.SavePropietario(datos); //DataModel ctx = new DataModel(); //ctx.propietarios.Attach(datos); var auto = new auto(); auto.marca = txtMarca.Text; auto.modelo = txtModelo.Text; auto.nserie = txtNoSerie.Text; auto.precio = double.Parse(txtPrecio.Text); auto.color = txtColor.Text; auto.nacionalidad = cboNacionalidad.Text; auto.Observacion = txtObservaciones.Text; auto.propietarios = datos; clsManejoAutos.SaveAuto(auto); this.Close(); } else { errorINE.Clear(); errorINE.SetError(txtNoSerie, "Numero de serie duplicado"); } } else { errorINE.Clear(); errorINE.SetError(txtINE, "Codigo de INE duplicado"); } } else { errorINE.Clear(); errorINE.SetError(pcbFoto, "Introducir foto para continuar"); } }
private void loadKeyListAndBalances(CryptoNote.ISerializer serializer, bool saveCache) { ulong walletCount; serializer.functorMethod(walletCount, "walletCount"); m_actualBalance = 0; m_pendingBalance = 0; m_deletedKeys.Clear(); HashSet <Crypto.PublicKey> cachedKeySet = new HashSet <Crypto.PublicKey>(); auto index = m_walletsContainer.get <KeysIndex>(); for (uint i = 0; i < walletCount; ++i) { Crypto.PublicKey spendPublicKey = new Crypto.PublicKey(); ulong actualBalance; ulong pendingBalance; serializer.functorMethod(spendPublicKey, "spendPublicKey"); if (saveCache) { serializer.functorMethod(actualBalance, "actualBalance"); serializer.functorMethod(pendingBalance, "pendingBalance"); } cachedKeySet.Add(spendPublicKey); var it = index.find(spendPublicKey); if (it == index.end()) { m_deletedKeys.emplace(std::move(spendPublicKey)); } else if (saveCache) { m_actualBalance += actualBalance; m_pendingBalance += pendingBalance; //C++ TO C# CONVERTER TODO TASK: Only lambda expressions having all locals passed by reference can be converted to C#: //ORIGINAL LINE: index.modify(it, [actualBalance, pendingBalance](WalletRecord& wallet) index.modify(it, (WalletRecord wallet) => { wallet.actualBalance = actualBalance; wallet.pendingBalance = pendingBalance; }); } } foreach (var wallet in index) { if (cachedKeySet.count(wallet.spendPublicKey) == 0) { m_addedKeys.Add(wallet.spendPublicKey); } } }
public async Task <IActionResult> EditAsync(auto obj) { if (ModelState.IsValid) { await autoRepository.UpdateAsync(obj); return(Json(new { isValid = true, html = Helper.RenderRazorViewToString(this, "_Index", autoRepository.FindAll()) })); } return(Json(new { isValid = false, html = Helper.RenderRazorViewToString(this, "_Index", obj) })); }
public IActionResult CreateAsync(auto cust) { if (ModelState.IsValid) { autoRepository.Add(cust); return(Json(new { isValid = true, html = Helper.RenderRazorViewToString(this, "_Index", autoRepository.FindAll()) })); } return(Json(new { isValid = false, html = Helper.RenderRazorViewToString(this, "_Index", cust) })); }
public ActionResult Edit([Bind(Include = "auto_id,auto_placa,auto_valor")] auto auto) { if (ModelState.IsValid) { db.Entry(auto).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(auto)); }
public static override bool functorMethod(string value, Common.StringView name) { writeElementPrefix(new ushort(GlobalMembers.BIN_KV_SERIALIZE_TYPE_STRING), new Common.StringView(name)); auto @out = stream(); GlobalMembers.writeArraySize(@out, value.Length); write(@out, value.data(), value.Length); return(true); }
public ActionResult Edit([Bind(Include = "kenteken,merk,type,dagprijs,beschikbaar,foto")] auto auto) { if (ModelState.IsValid) { db.Entry(auto).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(auto)); }
public override bool Binary(object value, ulong size, Common.StringView name) { if (size > 0) { writeElementPrefix(new ushort(GlobalMembers.BIN_KV_SERIALIZE_TYPE_STRING), new Common.StringView(name)); auto @out = stream(); GlobalMembers.writeArraySize(@out, new ulong(size)); write(@out, value, size); } return(true); }
public ActionResult Create([Bind(Include = "auto_id,auto_placa,auto_valor")] auto auto) { if (ModelState.IsValid) { db.auto.Add(auto); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(auto)); }
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()); }
private void CaricaDatiDiTesto() { moto m = new moto(); m = new moto("Ducati", "Panigale V4R", 1000, 75, DateTime.Now, 0, "blu", false, false, 11300, "StandarCO"); listVeicolo.Add(m); auto a = new auto("Alfa Romeo", "Stelvio", 2000, 150, DateTime.Now, 0, "rosso", false, false, 10000, 8); listVeicolo.Add(a); lbVeicoli.DataSource = listVeicolo; }
public ActionResult Edit([Bind(Include = "kenteken,merk,Type,DEALER_dealernr")] auto auto) { if (ModelState.IsValid) { db.Entry(auto).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DEALER_dealernr = new SelectList(db.dealers, "dealernr", "naam", auto.DEALER_DealerNr); return(View(auto)); }
public ActionResult Create([Bind(Include = "kenteken,merk,type,dagprijs,beschikbaar,foto")] auto auto) { if (ModelState.IsValid) { db.auto.Add(auto); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(auto)); }
public void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ListView.SelectedItems.Count > 0) { auto todoItem = (auto)ListView.SelectedItems[0]; // MainWindow.todo = todoItem; id_cole = itemsFromDb.IndexOf(todoItem); prechod = 1; MainWindow.framePublic.Navigate(new news(todoItem)); // MainWindow.framePublic.Source = new Uri("pages/news.xaml", UriKind.Relative); //změna source Page } }
public TMXObjectGroup getObjectGroup(ref String groupName) { for (const auto objectGroup : _objectGroups) { if (objectGroup && objectGroup->getGroupName() == groupName) { return(objectGroup); } } // objectGroup not found return(null); }
/// <summary> /// 安装入口 /// </summary> /// <param name="parameter">安装参数</param> /// <returns>是否安装成功</returns> public bool Run(auto.parameter parameter) { if (parameter != null) { string path = parameter.ProjectPath + (parameter.ProjectPath == config.setup.Default.FastCSharpPath ? DefaultTemplatePath : config.setup.Default.SimpleTemplatePath).pathSuffix(); if (Directory.Exists(path)) { list<string>[] codes = Directory.GetFiles(path, "*.cs").getArray(name => code(name)); if (!codes.any(code => code == null)) { cSharp.coder.Add(string.Concat(codes.getArray(code => code.ToArray()).getArray())); return true; } return false; } return true; } return false; }