Exemplo n.º 1
0
        public ActionResult Detail(int id)
        {
            var gpMapper = new GpMapper();
            Gp  gp       = gpMapper.SelectGp(id);

            gp.State     = States.FindForGp(gp);
            ViewBag.Name = gp.Name;

            gpMapper.GetPrevNextDriver(id, out int?prev, out int?next);
            ViewBag.Prev = prev;
            ViewBag.Next = next;

            ViewBag.IfGp = User.Identity.IsAuthenticated && ButtonEnable.GpEdit(gp.UserId, new UsersMapper().SelectUser(User.Identity.Name));

            return(View(gp));
        }
        public bool OpenRecord(object primaryKey)
        {
            if (primaryKey == null)
            {
                return(false);
            }
            var idGp                 = (int)primaryKey;
            var gpMapper             = new GpMapper();
            var classificationMapper = new ClassificationMapper();
            var gp      = gpMapper.SelectGp(idGp);
            var drivers = new DriversMapper().SelectAll();

            var bindingList = new BindingList <Drivers>(drivers);

            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.Rows.Clear();
            foreach (var driver in bindingList)
            {
                var rowIndex = dataGridView1.Rows.Add();
                var row      = dataGridView1.Rows[rowIndex];

                row.Cells["Position"].Value  = classificationMapper.SelectGpDriver(gp.Id, driver.Id);
                row.Cells["LastName"].Value  = driver.LastName;
                row.Cells["FirstName"].Value = driver.FirstName;
                row.Cells["ID"].Value        = driver.Id;
            }

            if (classificationMapper.SelectGpCount(gp.Id) == 0)
            {
                labelError.Text = @"Výsledky pro tuto GP ještě neexistují.";
            }
            else
            {
                labelError.Text = "";
            }

            labelHeader.Text = @"Zobrazení výsledků GP - " + gp.Name;
            Text             = labelHeader.Text;

            _gpId = idGp;
            gpMapper.GetPrevNextDriver(_gpId, out _prevId, out _nextId);

            buttonGpEdit.Visible = ButtonEnable.TeamsEdit(gp.UserId, new UsersMapper().SelectUser(Logged.CurrentUser.UserRole));

            return(true);
        }
Exemplo n.º 3
0
        public ActionResult Classifications(int id)
        {
            var gpMapper = new GpMapper();
            var gp       = gpMapper.SelectGp(id);

            ViewBag.Name = gp.Name;

            gpMapper.GetPrevNextDriver(id, out int?prev, out int?next);
            ViewBag.Prev = prev;
            ViewBag.Next = next;
            ViewBag.Id   = id;

            Dictionary <int, Classification> classifications = new ClassificationMapper().SelectAll(id);

            ViewBag.IfGp = User.Identity.IsAuthenticated && ButtonEnable.GpEdit(gp.UserId, new UsersMapper().SelectUser(User.Identity.Name));

            return(View(classifications));
        }
Exemplo n.º 4
0
        public bool OpenRecord(object primaryKey)
        {
            if (primaryKey == null)
            {
                return(false);
            }
            var idDriver     = (int)primaryKey;
            var driverMapper = new GpMapper();
            var gp           = driverMapper.SelectGp(idDriver);

            labelNameEdit.Text    = gp.Name;
            labelCircuitEdit.Text = gp.Circuit;
            if (gp.Date != null)
            {
                labelDateEdit.Text = ((DateTime)gp.Date).ToString("dd/MM/yyyy");
            }

            if (gp.Lenght != null)
            {
                labelLenghtEdit.Text = gp.Lenght.ToString();
            }

            if (gp.Laps != null)
            {
                labelLapsEdit.Text = gp.Laps.ToString();
            }

            gp.State = States.FindForGp(gp);
            var state = new StatesMapper().SelectState(gp.State.Id);

            labelStateEdit.Text = state.Name;

            labelHeader.Text = @"Výpis GP - " + gp.Name;
            Text             = labelHeader.Text;

            _gpId = gp.Id;
            driverMapper.GetPrevNextDriver(_gpId, out _prevId, out _nextId);

            buttonGpEdit.Visible = ButtonEnable.TeamsEdit(gp.UserId, new UsersMapper().SelectUser(Logged.CurrentUser.UserRole));

            return(true);
        }