Example #1
0
        private async Task GetLastInfractions()
        {
            var count = int.Parse(this.cmbItems.SelectedItem.ToString());

            this._lastInfractions = await ApiManagerInfractions.GetLast(count);

            this.infractionDTOBindingSource.DataSource = _lastInfractions;
        }
Example #2
0
        private async Task GetDriverInfractions()
        {
            var currentDriver = this.driverDTOBindingSource.Current as DriverDTO;

            if (currentDriver != null)
            {
                var infractions = await ApiManagerInfractions.ByDriverIdentifier(currentDriver.Identifier);

                this.infractionDTOBindingSource.DataSource = infractions;
            }
        }
Example #3
0
        private async void cmdAccept_Click(object sender, EventArgs e)
        {
            if (this.ValidateData())
            {
                try
                {
                    this._infraction = await ApiManagerInfractions.AddNew(this._infraction);

                    this.DialogResult = DialogResult.OK;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Ha ocurrido el siguiente error:" + Environment.NewLine + Environment.NewLine + ex.GetBaseException().Message, "DGT", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #4
0
        private async Task GetInfractionStats()
        {
            this.chart1.Series[0].Points.Clear();
            var stats = await ApiManagerInfractions.GetStats();

            if (stats != null && stats.Any())
            {
                this._infractionStats = stats;
                this.infractionDTOBindingSource.DataSource = this._infractionStats;

                foreach (var s in _infractionStats)
                {
                    this.chart1.Series[0].Points.AddXY(s.Name, s.Count);
                }
            }

            else
            {
                _infractionStats = new List <InfractionStatsDTO>();
            }
        }
Example #5
0
        public async Task SearchInfractions()
        {
            if (this.infractionTypes == null || !this.infractionTypes.Any())
            {
                await this.LoadInfractionTypes();
            }

            DateTime?from = null;

            if (this.dtpFilterFrom.Checked)
            {
                from = this.dtpFilterFrom.Value;
            }

            DateTime?to = null;

            if (this.dtpFilterTo.Checked)
            {
                to = this.dtpFilterTo.Value;
            }

            var infractionTypeId = "";

            if (this.cmbFilterInfractionType.SelectedValue.ToString() != Guid.Empty.ToString())
            {
                infractionTypeId = this.cmbFilterInfractionType.SelectedValue.ToString();
            }

            this.infractions = await ApiManagerInfractions.Search(this.txtFilterVehicleLicense.Text, this.txtFilterDriverIdentifier.Text, infractionTypeId, from, to);

            if (infractions == null || !infractions.Any())
            {
                MessageBox.Show("No se ha encontrado ningún resultado", "Búsqueda de infracciones", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                this.infractionDTOBindingSource.DataSource = infractions;
            }
        }
Example #6
0
        private async void GetInfractions(string license)
        {
            var results = await ApiManagerInfractions.ByVehicleLicense(license);

            this.infractionDTOBindingSource.DataSource = results;
        }