public ucFactuurContract() { InitializeComponent(); //combobox opvullen met items (facturen), omdat opvullen via datasource "SelectedIndexChanged" triggert. cbbID.Items.Clear(); cbbID.Items.AddRange(ContractManagement.getContracten().ToArray()); cbbID.DisplayMember = "factuur_id_full"; cbbID.ValueMember = "opdracht_id"; cbbKlant.DataSource = KlantManagement.getKlanten(); cbbKlant.DisplayMember = "naam"; cbbKlant.ValueMember = "klant_id"; cbbKlant.SelectedIndex = -1; cbbVertrek.DataSource = LocatieManagement.getLocaties(); cbbVertrek.DisplayMember = "FullAdress"; cbbVertrek.ValueMember = "locatie_id"; cbbVertrek.SelectedIndex = -1; cbbBestemming.DataSource = LocatieManagement.getLocaties(); cbbBestemming.DisplayMember = "FullAdress"; cbbBestemming.ValueMember = "locatie_id"; cbbBestemming.SelectedIndex = -1; dtTot.Value = DateTime.Today; dtVan.Value = DateTime.Today; disableFields(); }
private void btnMaakFactuur_Click(object sender, EventArgs e) { opdracht selectedContract = (opdracht)cbbID.SelectedItem; contract_factuur nieuweFactuur = new contract_factuur(); nieuweFactuur.opdracht = selectedContract; nieuweFactuur.periode_begin = dtPeriodeBegin.Value; nieuweFactuur.periode_einde = dtPeriodeEinde.Value; TimeSpan aantaldagen = dtPeriodeEinde.Value - dtPeriodeBegin.Value; int dagen = aantaldagen.Days + 1; nieuweFactuur.prijs = (selectedContract.contract_dagprijs * dagen) + ((selectedContract.contract_dagprijs * dagen) * 6 / 100); nieuweFactuur.betaald = false; nieuweFactuur.betaling_memo = string.Empty; ContractManagement.addFactuur(nieuweFactuur); cbbFactuurID.DataSource = ContractManagement.getFacturenVanContract(selectedContract); if (ContractManagement.getFacturenVanContract(selectedContract).Any() == true) { contract_factuur laatste_factuur = ContractManagement.getFacturenVanContract(selectedContract).Last(); dtPeriodeBegin.MinDate = laatste_factuur.periode_einde; dtPeriodeBegin.MaxDate = selectedContract.tot_datum; dtPeriodeEinde.MinDate = laatste_factuur.periode_einde; dtPeriodeEinde.MaxDate = selectedContract.tot_datum; dtPeriodeBegin.Value = laatste_factuur.periode_einde; //Als het contract korter is dan 1 maand, kunnen er geen facturen gemaakt worden voor 1 maand, dus factuur van begindatum tot einddatum. if (laatste_factuur.periode_einde.AddMonths(1) > selectedContract.tot_datum) { dtPeriodeEinde.Value = selectedContract.tot_datum; } else { dtPeriodeEinde.Value = laatste_factuur.periode_einde.AddMonths(1); } } else { dtPeriodeBegin.MinDate = selectedContract.vanaf_datum; dtPeriodeBegin.MaxDate = selectedContract.tot_datum; dtPeriodeEinde.MinDate = selectedContract.vanaf_datum; dtPeriodeEinde.MaxDate = selectedContract.tot_datum; dtPeriodeBegin.Value = selectedContract.vanaf_datum; //Als het contract korter is dan 1 maand, kunnen er geen facturen gemaakt worden voor 1 maand, dus factuur van begindatum tot einddatum. if (selectedContract.vanaf_datum.AddMonths(1) > selectedContract.tot_datum) { dtPeriodeEinde.Value = selectedContract.tot_datum; } else { dtPeriodeEinde.Value = selectedContract.vanaf_datum.AddMonths(1); } } }
//Ritplanning toevoegen aan 2de tab (als je er naar navigeert) private void tabControl1_Selected(object sender, TabControlEventArgs e) { flpRitplannen.Controls.Clear(); opdracht contract = (opdracht)cbbID.SelectedItem; if (contract != null) { foreach (contract_rit rit in ContractManagement.getRitten(contract.opdracht_id)) { ucRitplan uc = new ucRitplan(); uc.dag = rit.dag; uc.vertrek_1 = rit.rit1_vertrek; uc.vertrek_2 = rit.rit2_vertrek; uc.terug_1 = rit.rit1_terug; uc.terug_2 = rit.rit2_terug; uc.begin = contract.vanaf_datum; uc.einde = contract.tot_datum; uc.contract_rit = rit; flpRitplannen.Controls.Add(uc); } } else { } }
private void monthCalendar1_DateSelected(object sender, DateRangeEventArgs e) { ArrayList datums = new ArrayList(); datums.AddRange(monthCalendar1.BoldedDates.ToArray()); if (datums.Contains(monthCalendar1.SelectionStart)) { datums.Remove(monthCalendar1.SelectionStart); ContractManagement.RemoveRitInstantie(rit_contract, monthCalendar1.SelectionStart); } else { datums.Add(monthCalendar1.SelectionStart); ContractManagement.addRitInstantie(rit_contract, monthCalendar1.SelectionStart); } //ArrayList datums = new ArrayList(); //datums.AddRange(monthCalendar1.BoldedDates.ToArray()); monthCalendar1.BoldedDates = (DateTime[])datums.ToArray(typeof(DateTime)); monthCalendar1.UpdateBoldedDates(); }
public static bool Transfer(UInt160 from, UInt160 to, BigInteger amount, object data = null) { Assert(from.Length == 20, "The from address is invalid."); Assert(to.Length == 20, "The to address is invalid."); Assert(amount > 0, "The parameter amount must be greater than 0."); Assert(Runtime.CheckWitness(from) || from.Equals(Runtime.CallingScriptHash), "No authorization."); Assert(BalanceOf(from) >= amount, "Insufficient balance."); if (from == to) { return(true); } AssetReduce(from, amount); AssetIncrease(to, amount); OnTransfer(from, to, amount); // Validate payable if (ContractManagement.GetContract(to) != null) { Contract.Call(to, "onNEP17Payment", CallFlags.All, from, amount, data); } return(true); }
public static bool Transfer(UInt160 from, UInt160 to, BigInteger amount, object data) { if (amount <= 0) { throw new Exception("The parameter amount MUST be greater than 0."); } if (!Runtime.CheckWitness(from) && !from.Equals(ExecutionEngine.CallingScriptHash)) { throw new Exception("No authorization."); } if (AssetStorage.Get(from) < amount) { throw new Exception("Insufficient balance."); } if (from == to) { return(true); } AssetStorage.Reduce(from, amount); AssetStorage.Increase(to, amount); OnTransfer(from, to, amount); // Validate payable if (ContractManagement.GetContract(to) != null) { Contract.Call(to, "onNEP17Payment", CallFlags.All, new object[] { from, amount, data }); } return(true); }
public static bool Transfer(UInt160 from, UInt160 to, BigInteger amount, object data) { Assert(from.IsValid && to.IsValid, "Invalid From or To Address"); Assert(amount > 0, "The parameter amount MUST be greater than 0."); Assert(Runtime.CheckWitness(from), "No authorization."); var me = Runtime.ExecutingScriptHash; if (to == me) { Assert(CheckIsRouter(Runtime.CallingScriptHash), "Not Allowed To Transfer"); } Assert(AssetStorage.Get(from) >= amount, "Insufficient balance."); if (from == to) { return(true); } AssetStorage.Reduce(from, amount); AssetStorage.Increase(to, amount); onTransfer(from, to, amount); // Validate payable if (ContractManagement.GetContract(to) != null) { Contract.Call(to, "onNEP17Payment", CallFlags.All, new object[] { from, amount, data }); } return(true); }
//Methode om te zoeken en resultaten weer te geven //EditTim(Stage): Resultaten worden weergegeven in een datagridview private void btnZoeken_Click(object sender, EventArgs e) { int aantal = 0; //flpOpdrachten.Controls.Clear(); dataGridView1.AutoGenerateColumns = false; opdrachten = ContractManagement.getContractenVanKlant(txtKlantnaam.Text); dataGridView1.DataSource = ContractManagement.getContractenVanKlant(txtKlantnaam.Text); if (opdrachten.Any() == false) { lblStatus.Text = "Geen contracten."; } else { var countOpdracht = 0; foreach (opdracht opdracht in opdrachten) { dataGridView1.Rows[countOpdracht].Cells["Id"].Value = opdracht.opdracht_id_full; dataGridView1.Rows[countOpdracht].Cells["Opdr_id"].Value = opdracht.opdracht_id; dataGridView1.Rows[countOpdracht].Cells["Vanaf_Datum"].Value = opdracht.vanaf_datum.ToString("dd-MM-yyyy"); dataGridView1.Rows[countOpdracht].Cells["Tot_Datum"].Value = opdracht.tot_datum.ToString("dd-MM-yyyy"); //flpOpdrachten.Controls.Add(uco); countOpdracht++; aantal += 1; } lblStatus.Text = aantal + " contract(en)."; } }
public static void update(ByteString nefFile, string manifest) { if (!verify()) { throw new Exception("No authorization."); } ContractManagement.Update(nefFile, manifest); }
public static void Update(ByteString nefFile, string manifest) { if (!ValidateContractOwner()) { throw new Exception("Only the contract owner can update the contract"); } ContractManagement.Update(nefFile, manifest, null); }
public static void Update(byte[] nefFile, string manifest) { if (!Verify()) { throw new Exception("No authorization."); } ContractManagement.Update(nefFile.ToByteString(), manifest); }
private static void PostTransfer(UInt160 from, UInt160 to, ByteString tokenId, object data) { OnTransfer(from, to, 1, tokenId); if (to is not null && ContractManagement.GetContract(to) is not null) { Contract.Call(to, "onNEP11Payment", CallFlags.All, from, 1, tokenId, data); } }
public static void Destroy() { if (!IsOwner()) { throw new Exception("No authorization."); } ContractManagement.Destroy(); }
public static void Update(ByteString nefFile, string manifest, object data) { if (!IsOwner()) { throw new Exception("No authorization."); } ContractManagement.Update(nefFile, manifest, data); }
public static void Update(byte[] nefFile, string manifest) { if (!IsOwner()) { throw new Exception("No authorization."); } ContractManagement.Update(nefFile, manifest); }
protected static void PostTransfer(UInt160 from, UInt160 to, BigInteger amount, object data) { OnTransfer(from, to, amount); if (to is not null && ContractManagement.GetContract(to) is not null) { Contract.Call(to, "onNEP17Payment", CallFlags.All, from, amount, data); } }
public static void Update(ByteString nef, string manifest) { if (!CheckCommittee()) { throw new Exception("No authorization."); } ContractManagement.Update(nef, manifest); }
private void cbbDatum_SelectedIndexChanged(object sender, EventArgs e) { //Instantie ophalen rit_instantie instantie = (rit_instantie)cbbDatum.SelectedItem; //Kijken of deze instantie informatie heeft of niet, zoniet niets doen, zowel informatie ophalen if (ContractManagement.hasRitInfo(instantie) == true) { enableInfo(); emptyInfo(); rit_info info = ContractManagement.getRitInfo(instantie); //Informatie van rit 1 invullen cbbChauffeur.SelectedItem = info.chauffeur; cbbVoertuig.SelectedItem = info.voertuig; txtLedigekm.Text = info.rit1_ledigekm.ToString(); txtBeladenkm.Text = info.rit1_beladenkm.ToString(); txtAantalpersonen.Text = info.rit1_aatal_personen.ToString(); //Informatie tussen de rit txtKmTussen.Text = info.km_tussen_ritten.ToString(); //Informatie van rit 2 invullen cbbChauffeur2.SelectedItem = info.chauffeur1; cbbVoertuig2.SelectedItem = info.voertuig1; txtLedigekm2.Text = info.rit2_ledigekm.ToString(); txtBeladenkm2.Text = info.rit2_beladenkm.ToString(); txtAantalpersonen2.Text = info.rit2_aantal_personen.ToString(); MainForm.updateStatus = "Rit info van: " + cbbDatum.Text + ", is geladen."; } else { enableInfo(); emptyInfo(); opdracht contract = (opdracht)cbbID.SelectedItem; if (ContractManagement.getChauffeursVanContract(contract) != null) { cbbChauffeur.SelectedItem = ContractManagement.getChauffeursVanContract(contract).First(); cbbChauffeur2.SelectedItem = ContractManagement.getChauffeursVanContract(contract).First(); } else { } if (ContractManagement.getVoertuigenVanOpdracht(contract) != null) { cbbVoertuig.SelectedItem = ContractManagement.getVoertuigenVanOpdracht(contract).First(); cbbVoertuig2.SelectedItem = ContractManagement.getVoertuigenVanOpdracht(contract).First(); } else { } } }
public static bool Update(ByteString nefFile, string manifest) { if (!IsOwner()) { throw new InvalidOperationException("No Authorization!"); } ContractManagement.Update(nefFile, manifest, null); return(true); }
public static bool Update(ByteString nef, string manifest) { if (!Runtime.CheckWitness(Owner)) { return(false); } ContractManagement.Update(nef, manifest, null); return(true); }
private void updateUc() { rit_info info = ContractManagement.getRitInfo(instantie); txtKlant.Text = miniopdracht.klant.naam; try { txtBestemming.Text = OpdrachtManagement.getVertrek(miniopdracht.opdracht_id).FullAdress; } catch { } txtAantal.Text = opdracht.aantal_personen.ToString(); dtRit1.Value = opdracht.vanaf_datum; dtRit2.Value = opdracht.tot_datum; txtUur1.Text = opdracht.vanaf_uur; txtUur2.Text = opdracht.tot_uur; lblInfo.Text = opdracht.opdracht_id.ToString(); cbbLeverancier.DataSource = OpdrachtManagement.getLeveranciers(); cbbLeverancier.ValueMember = "leverancier_id"; cbbLeverancier.DisplayMember = "naam"; cbbVoertuig.DataSource = OpdrachtManagement.getVoertuigen(); cbbVoertuig.ValueMember = "voertuig_id"; cbbVoertuig.DisplayMember = "voertuig_id"; cbbChauffeurs.DataSource = OpdrachtManagement.getChauffeurs(); cbbChauffeurs.ValueMember = "naam"; cbbChauffeurs.DisplayMember = "naam"; cbbChauffeurs2.DataSource = OpdrachtManagement.getChauffeurs(); cbbChauffeurs2.ValueMember = "naam"; cbbChauffeurs2.DisplayMember = "naam"; cbbChauffeurs.SelectedIndex = -1; cbbChauffeurs2.SelectedIndex = -1; cbbVoertuig.SelectedIndex = -1; cbbLeverancier.SelectedIndex = -1; //IEnumerable<chauffeur> firstChauff = OpdrachtManagement.getFirstChauffeurVanOpdracht(opdracht); //IEnumerable<chauffeur> secChauff = OpdrachtManagement.getSecondChauffeurVanOpdracht(opdracht); //IEnumerable<voertuig> voertuig = OpdrachtManagement.getVoertuigenVanOpdracht(opdracht); //IEnumerable<leverancier> leverancier = OpdrachtManagement.getLeverancierVanOpdracht(opdracht); //try //{ // cbbChauffeurs.SelectedValue = firstChauff.First().naam; //} //catch { }; //try { cbbChauffeurs2.SelectedValue = secChauff.First().naam; } //catch { }; //try { cbbVoertuig.SelectedValue = voertuig.First().voertuig_id; } //catch { }; //try { cbbLeverancier.SelectedValue = leverancier.First().leverancier_id; } //catch { }; }
public static bool Destroy() { if (!IsOwner()) { throw new InvalidOperationException("No Authorization!"); } ContractManagement.Destroy(); return(true); }
public static bool Destroy() { if (!IsAdmin()) { Error("No authorization."); return(false); } ContractManagement.Destroy(); return(true); }
public ucEditContractPerDay(rit_instantie instantie, int ritnummer) { InitializeComponent(); FillBasics(); currentInstantie = instantie; currentRitnummer = ritnummer; opdracht od = ContractManagement.getContract(instantie.contract_rit); lblContract.Text = od.contract_id_full; rit_info info = ContractManagement.getRitInfo(instantie); if (info == null) { info = ContractManagement.CreateRitInfo(instantie, od); } currentRitInfo = info; if (ritnummer == 1) { lblTime.Text = instantie.contract_rit.rit1_vertrek + " - " + instantie.contract_rit.rit1_terug; if (info.chauffeur != null) { cbbChauffeur.SelectedItem = info.chauffeur; } if (info.voertuig != null) { cbbVoertuig.SelectedItem = info.voertuig; } if (info.leverancier != null) { cbbLeverancier.SelectedItem = info.leverancier; } } else if (ritnummer == 2) { lblTime.Text = instantie.contract_rit.rit2_vertrek + " - " + instantie.contract_rit.rit2_terug; if (info.chauffeur1 != null) { cbbChauffeur.SelectedItem = info.chauffeur1; } if (info.voertuig1 != null) { cbbVoertuig.SelectedItem = info.voertuig1; } if (info.leverancier1 != null) { cbbLeverancier.SelectedItem = info.leverancier1; } } }
public static void Update(ByteString nefFile, string manifest) { var key = new byte[] { Prefix_ContractOwner }; var contractOwner = (UInt160)Storage.Get(Storage.CurrentContext, key); var tx = (Transaction)Runtime.ScriptContainer; if (!contractOwner.Equals(tx.Sender)) { throw new Exception("Only the contract owner can update the contract"); } ContractManagement.Update(nefFile, manifest, null); }
private void ucRitplan_Load(object sender, EventArgs e) { ArrayList datums = new ArrayList(); foreach (rit_instantie ri in ContractManagement.getRitInstanties(rit_contract)) { datums.Add(ri.datum); } monthCalendar1.BoldedDates = (DateTime[])datums.ToArray(typeof(DateTime)); monthCalendar1.MinDate = begin; monthCalendar1.MaxDate = einde; }
public static object ManagementTest(UInt160 hash) { OnNotify(ContractManagement.Hash); OnNotify(ContractManagement.Name); OnNotify(ContractManagement.GetContract(hash).Hash); OnNotify(ContractManagement.GetContract(hash).Id); OnNotify(ContractManagement.GetContract(hash).Nef); OnNotify(ContractManagement.GetContract(hash).UpdateCounter); return(ContractManagement.GetContract(hash).Manifest); }
public static bool Transfer(UInt160 from, UInt160 to, BigInteger amount, object data = null) { if (IsPaused()) { Error("System is paused."); return(false); } if (IsBlacklisted(from)) { Error("Argument from is in blacklist."); return(false); } if (IsBlacklisted(to)) { Error("Argument to is in blacklist."); return(false); } if (amount <= 0) { Error("The parameter amount MUST be greater than 0."); return(false); } if (!Runtime.CheckWitness(from)) { Error("No authorization."); return(false); } if (AssetStorage.Get(from) < amount) { Error("Insufficient balance."); return(false); } if (from == to) { return(true); } AssetStorage.Reduce(from, amount); AssetStorage.Increase(to, amount); Transferred(from, to, amount); if (ContractManagement.GetContract(to) != null) { Contract.Call(to, "onPayment", CallFlags.ReadOnly, new object[] { from, amount, data }); } return(true); }
private void btnDeleteFactuur_Click(object sender, EventArgs e) { opdracht selectedOpdracht = (opdracht)cbbID.SelectedItem; contract_factuur deleteFactuur = (contract_factuur)cbbFactuurID.SelectedItem; if (deleteFactuur != null) { ContractManagement.deleteFactuur(deleteFactuur.contract_factuur_id); } emptyFactuur(); cbbFactuurID.DataSource = ContractManagement.getFacturenVanContract(selectedOpdracht); cbbFactuurID.SelectedIndex = -1; }
private void cbbID_SelectedIndexChanged(object sender, EventArgs e) { opdracht contract = (opdracht)cbbID.SelectedItem; if (contract != null) { if (contract.info_datum == null) { lblInfoStatus.Text = "Niet ingevuld"; lblInfoStatus.ForeColor = Color.Red; } else { lblInfoStatus.Text = "Ingevuld"; lblInfoStatus.ForeColor = Color.Green; } //Alle datums ophalen die gereden zijn in een contract List <rit_instantie> rit_instanties = new List <rit_instantie>(); IEnumerable <contract_rit> ritten = ContractManagement.getRitten(contract.opdracht_id); foreach (contract_rit rit in ritten) { rit_instanties.AddRange(ContractManagement.getRitInstanties(rit)); } //Datum combobox opvullen cbbDatum.Items.Clear(); cbbDatum.Items.AddRange(rit_instanties.ToArray()); cbbDatum.DisplayMember = "datum"; cbbDatum.ValueMember = "rit_instantie"; //Formulier invullen met juiste informatie cbbKlant.SelectedItem = contract.klant; txtPrijs.Text = contract.contract_dagprijs.ToString(); btnOpslaan.Enabled = true; btnAnnuleren.Enabled = true; btnPrint.Enabled = true; enableContract(); MainForm.updateStatus = "Contract met ID: " + contract.opdracht_id.ToString() + ", is geladen."; } else { } }