// GET: TeamView/Delete/5
        public ActionResult Delete(string id)
        {
            TeamViewBusinessLayer t = new TeamViewBusinessLayer();
            TeamView tv             = t.TeamViews.Where(i => i.ID == id).Single();

            return(View(tv));
        }
Example #2
0
        public async Task <ActionResult> EditTeam(TeamView teamview)
        {
            var pic    = teamview.Logo;
            var folder = "~/Content/Logos";

            if (teamview.LogoFile != null)
            {
                pic = FilesHelper.UploadPhoto(teamview.LogoFile, folder);
                pic = $"{folder}/{pic}";
            }

            teamview.Logo = pic;

            var team = new Team
            {
                LeagueId = teamview.LeagueId,
                Initials = teamview.Initials,
                Logo     = teamview.Logo,
                Name     = teamview.Name,
                TeamId   = teamview.TeamId
            };

            if (ModelState.IsValid)
            {
                db.Entry(team).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction($"Details/{team.LeagueId}"));
            }

            return(View(teamview));
        }
        public ActionResult Create(FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Create";

            try
            {
                TeamView a = new TeamView();

                #region Pull from Form Collection
                a.TeamID          = Convert.ToInt16(collection["ddTeam"]);
                a.ViewID          = Convert.ToInt16(collection["ddPivotView"]);
                a.ViewDescription = "";
                a.TeamDescription = "";
                #endregion

                StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                DidItWork = spbl.ExecuteStoredProcedure(a, CrudAction, User.Identity.Name);
                if (DidItWork == false)
                {
                    return(Content(string.Format("Error on {0} of {1}. Press back to return and try again", CrudAction, a.GetType().Name)));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                return(View());
            }
        }
        public async Task <ActionResult> CreateTeam(int?id)
        {
            try
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                var league = await db.Leagues.FindAsync(id);

                if (league == null)
                {
                    return(HttpNotFound());
                }

                var view = new TeamView {
                    LeagueId = league.LeagueId,
                };
                return(View(view));
            }
            catch (Exception ex)
            {
                fileshelper.ErrorLogging(ex);
                return(View());
            }
        }
        public ActionResult Delete(string id, FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Delete";

            try
            {
                TeamViewBusinessLayer bl = new TeamViewBusinessLayer();
                TeamView a = bl.TeamViews.Where(p => p.ID == id).Single();

                StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                DidItWork = spbl.ExecuteStoredProcedure(a, CrudAction, User.Identity.Name);
                if (DidItWork == false)
                {
                    return(Content(string.Format("Error on {0} of {1}. Press back to return and try again", CrudAction, a.GetType().Name)));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                return(View());
            }
        }
Example #6
0
        public async Task <ActionResult> Edit(TeamView view)
        {
            if (ModelState.IsValid)
            {
                var pic    = view.Logo;
                var folder = "~/Content/Logos";

                if (view.LogoFile != null)
                {
                    pic = FilesHelper.UploadPhoto(view.LogoFile, folder);
                    pic = $"{folder}/{pic}";
                }

                view.Logo = pic;
                var team = ToTeam(view);

                db.Entry(team).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.LeagueId = new SelectList(db.Leagues, "LeagueId", "Name", view.LeagueId);
            return(View(view));
        }
        public async Task <ActionResult> EditTeam(TeamView view)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var pic    = view.Logo;
                    var folder = "~/Content/Logos";

                    if (view.LogoFile != null)
                    {
                        pic = FilesHelper.UploadPhoto(view.LogoFile, folder);
                        pic = string.Format("{0}/{1}", folder, pic);
                    }

                    var team = ToTeam(view);
                    team.Logo            = pic;
                    db.Entry(team).State = EntityState.Modified;
                    await db.SaveChangesAsync();

                    return(RedirectToAction(string.Format("Details/{0}", view.LeagueId)));
                }

                return(View(view));
            }
            catch (Exception ex)
            {
                fileshelper.ErrorLogging(ex);
                return(View());
            }
        }
Example #8
0
        public async Task <TeamView> UpdateTeamAsync(TeamView teamView)
        {
            var team   = teamView.Map();
            var result = await _teamRepository.UpdateAsync(team);

            return(result.Map());
        }
Example #9
0
        public async Task <ActionResult> EditTeam(TeamView view)
        {
            if (ModelState.IsValid)
            {
                var picture = view.Logo;
                var folder  = "~/Content/Logos";

                if (view.LogoFile != null)
                {
                    picture = FileHelper.UploadPhoto(view.LogoFile, folder);
                    picture = $"{folder}/{picture}";
                }

                var team = ToTeam(view);

                team.Logo = picture;


                db.Entry(team).State = EntityState.Modified;

                try
                {
                    await db.SaveChangesAsync();
                }
                catch
                {
                }

                return(RedirectToAction($"Details/{view.LeagueId}"));
            }


            return(View(view));
        }
        public async Task <ActionResult> EditTeam(TeamView view)
        {
            if (ModelState.IsValid)
            {
                var pic    = view.Logo;
                var folder = "~/Content/Teams";

                if (view.LogoFile != null)
                {
                    pic = FilesHelper.UploadPhoto(view.LogoFile, folder);
                    pic = string.Format("{0}/{1}", folder, pic);
                }

                var team = ToTeam(view);
                team.Logo            = pic;
                db.Entry(team).State = EntityState.Modified;
                var response = await DBHelper.SaveChanges(db);

                if (response.Succeeded)
                {
                    return(RedirectToAction(string.Format("Details/{0}", view.LeagueId)));
                }

                ModelState.AddModelError(string.Empty, response.Message);
            }

            return(View(view));
        }
Example #11
0
        public async Task <ActionResult> CreateTeam(TeamView teamview)
        {
            var pic    = string.Empty;
            var folder = "~/Content/Logos";

            if (teamview.LogoFile != null)
            {
                pic = FilesHelper.UploadPhoto(teamview.LogoFile, folder);
                pic = $"{folder}/{pic}";
            }

            teamview.Logo = pic;

            var team = new Team
            {
                LeagueId = teamview.LeagueId,
                Fans     = teamview.Fans,
                Initials = teamview.Initials,
                League   = teamview.League,
                Locals   = teamview.Locals,
                Logo     = teamview.Logo,
                Name     = teamview.Name,
                Visitors = teamview.Visitors
            };

            if (ModelState.IsValid)
            {
                db.Teams.Add(team);
                await db.SaveChangesAsync();

                return(RedirectToAction($"Details/{team.LeagueId}"));
            }

            return(View(teamview));
        }
Example #12
0
        public async Task <ActionResult> CreateTeam(TeamView view)
        {
            if (ModelState.IsValid)
            {
                var picture = string.Empty;
                var folder  = "~/Content/Logos";

                if (view.LogoFile != null)
                {
                    picture = FileHelper.UploadPhoto(view.LogoFile, folder);
                    picture = $"{folder}/{picture}";
                }

                var team = ToTeam(view);

                team.Logo = picture;


                db.Teams.Add(team);

                try
                {
                    await db.SaveChangesAsync();
                }
                catch
                {
                }

                return(RedirectToAction($"Details/{view.LeagueId}"));
            }

            ViewBag.LeagueId = new SelectList(db.Leagues, "LeagueId", "Name", view.LeagueId);

            return(View(view));
        }
Example #13
0
        private void ViewButton_Click(object sender, EventArgs e)
        {
            Form newform = new TeamView();

            this.Hide();
            this.Close();
            newform.Show();
        }
Example #14
0
        //  public async Task<ActionResult> Edit(Team team)
        public async Task <ActionResult> Edit(TeamView view)
        {
            if (ModelState.IsValid)
            {
                //if (view.ImageFile != null)
                //{
                //    MethodsHelper.Image = view.ImagePath;

                //    MethodsHelper.Image =
                //        FilesHelper.UploadPhoto(
                //            view.ImageFile,
                //            MethodsHelper.GetFolderSoccerFlag());

                //    MethodsHelper.Image =
                //        string.Format(
                //            "{0}{1}",
                //            MethodsHelper.GetFolderSoccerFlag(),
                //            MethodsHelper.Image);
                //}

                if (view.ImageFile != null)
                {
                    MethodsHelper.Image = view.ImagePath;

                    //  CEHJ - Guarda la imagen en el FTP
                    MethodsHelper.Image =
                        FilesHelper.UploadPhoto(
                            view.ImageFile,
                            MethodsHelper.GetFolderSoccerFlag(),
                            Convert.ToString(view.TeamId).Trim());

                    //  CEHJ - Da formato a la imagen
                    MethodsHelper.Image =
                        string.Format(
                            "{0}{1}",
                            MethodsHelper.GetFolderSoccerFlag(),
                            MethodsHelper.Image);
                }

                var team = TeamViewToTeam(view);
                team.ImagePath = MethodsHelper.Image;

                db.Entry(team).State = EntityState.Modified;
                response             = await DbHelper.SaveChangeDB(db);

                if (response.IsSuccess)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError(string.Empty, response.Message);
                }
            }

            //  return View(team);
            return(View(view));
        }
 private Team ToTeam(TeamView view)
 {
     return(new Team
     {
         ImagePath = view.ImagePath,
         Name = view.Name,
         TeamId = view.TeamId,
     });
 }
Example #16
0
 private Team ToTeam(TeamView teamView)
 {
     return(new Team()
     {
         ImagePath = teamView.ImagePath,
         Name = teamView.Name,
         TeamId = teamView.TeamId
     });
 }
Example #17
0
 public TeamController(
     ApplicationService service,
     TeamView view,
     IMapperService mapper)
 {
     _service = service ?? throw new ArgumentNullException(nameof(service));
     _view    = view ?? throw new ArgumentNullException(nameof(view));
     _mapper  = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
Example #18
0
 public static Team Map(this TeamView teamView)
 {
     return(new Team
     {
         Id = teamView.Id,
         Name = teamView.Name,
         Projects = teamView.Projects.Select(proj => proj.Map()).ToList(),
         Members = teamView.Members.Select(member => member.Map()).ToList()
     });
 }
Example #19
0
        private TeamView ConvertToTeamView(Team team)
        {
            TeamView teamView = new TeamView()
            {
                Id       = team.id_team,
                TeamName = team.name
            };

            return(teamView);
        }
Example #20
0
 private Team ToTeam(TeamView view)
 {
     return(new Team {
         TeamId = view.TeamId,
         Name = view.Name,
         Initials = view.Initials,
         League = view.League,
         LeagueId = view.LeagueId,
         Logo = view.Logo
     });
 }
Example #21
0
        public TeamView[] PassTeams()
        {
            Team[]     teamsTab = managerTeamsDB.PassTeams();
            TeamView[] tab      = new TeamView[teamsTab.Length];
            for (int i = 0; i < tab.Length; i++)
            {
                tab[i] = ConvertToTeamView(teamsTab[i]);
            }

            return(tab);
        }
        public PlayerWindow(bool _update = false)
        {
            InitializeComponent();

            update = _update;
            context = new GAA_Templates_ModelContainer();
            teamViewContext = new TeamView(context);
            countyViewContext = new CountyView(context);
            playerViewContext = new PlayerView(context);
            loadTestData();
            addEventHandlers();
        }
Example #23
0
        // PUT api/Report
        public IHttpActionResult Put([FromBody] TeamView model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try { service.Update(model); }

            catch (Exception e) { BadRequest(e.Message); }

            return(Ok());
        }
        public async Task <ActionResult> EditTeam(TeamView view)
        {
            if (ModelState.IsValid)
            {
                var table = db.Teams
                            .Where(u => u.Name.ToLower() == view.Name.ToLower() && u.LeagueId == view.LeagueId && u.TeamId != view.TeamId)
                            .FirstOrDefaultAsync();

                if (table.Result != null)
                {
                    ModelState.AddModelError(string.Empty,
                                             "Este nombre ya esta en uso en esta liga, escoja uno diferente");
                }
                else
                {
                    var table2 = db.Teams
                                 .Where(u => u.Initials.ToLower() == view.Initials.ToLower() && u.LeagueId == view.LeagueId && u.TeamId != view.TeamId)
                                 .FirstOrDefaultAsync();

                    if (table2.Result != null)
                    {
                        ModelState.AddModelError(string.Empty,
                                                 "Estas iniciales ya estan en uso en esta liga, escoja uno diferente");
                    }
                    else
                    {
                        if (ModelState.IsValid)
                        {
                            var pic    = view.Logo;
                            var folder = "~/Content/Logos";

                            if (view.LogoFile != null)
                            {
                                pic = FilesHelper.UploadPhoto(view.LogoFile, folder);
                                pic = string.Format("{0}/{1}", folder, pic);
                            }

                            var team = ToTeam(view);
                            team.Logo = pic;

                            db.Entry(team).State = EntityState.Modified;
                            await db.SaveChangesAsync();

                            return(RedirectToAction(string.Format("Details/{0}", team.LeagueId)));
                        }
                    }
                }
            }

            return(View(view));
        }
        public ActionResult TeamView()
        {
            int      ID = Convert.ToInt32(Session["ID"]);
            TeamView tv = new TeamView();

            tv.ourteam = db.team.Where(x => x.pmId == ID).ToList();
            tv.users.AddRange(db.users.Where(x => x.userTypeId == 4).ToList());
            tv.users.AddRange(db.users.Where(x => x.userTypeId == 5).ToList());
            foreach (var item in tv.ourteam)
            {
                tv.tm.AddRange(db.teamMember.Where(x => x.teamId == item.Id).ToList());
            }
            return(PartialView("_TeamView", tv));
        }
Example #26
0
        public ActionResult CreateTeam(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var league = db.Leagues.Find(id);

            var team = new TeamView {
                LeagueId = league.LeagueId
            };

            return(View(team));
        }
Example #27
0
 private Team ToTeam(TeamView view)
 {
     return(new Team
     {
         TeamId = view.TeamId,
         TournamentTeams = view.TournamentTeams,
         LeagueId = view.LeagueId,
         Logo = view.Logo,
         Name = view.Name,
         Visitors = view.Visitors,
         //Fans = view.Fans,
         Initials = view.Initials,
         League = view.League,
         Locals = view.Locals
     });
 }
Example #28
0
        public CsvTeam(TeamView team)
        {
            JsonConvert.PopulateObject(team.Data.GetRawText(), this);
            teamId = team.TeamId;

            if (team.Data.TryGetProperty("seasAttr", out var seasAttr))
            {
                this.seasAttr = string.Join(";", seasAttr.EnumerateArray().Select(v => v.GetString()));
            }

            if (team.Data.TryGetProperty("permAttr", out var permAttr))
            {
                this.permAttr = string.Join(";", permAttr.EnumerateArray().Select(v => v.GetString()));
            }

            if (team.Data.TryGetProperty("gameAttr", out var gameAttr))
            {
                this.gameAttr = string.Join(";", gameAttr.EnumerateArray().Select(v => v.GetString()));
            }

            if (team.Data.TryGetProperty("weekAttr", out var weekAttr))
            {
                this.weekAttr = string.Join(";", weekAttr.EnumerateArray().Select(v => v.GetString()));
            }


            if (team.Data.TryGetProperty("lineup", out var lineup))
            {
                this.lineup = string.Join(";", lineup.EnumerateArray().Select(v => v.GetString()));
            }

            if (team.Data.TryGetProperty("rotation", out var rotation))
            {
                this.rotation = string.Join(";", rotation.EnumerateArray().Select(v => v.GetString()));
            }

            if (team.Data.TryGetProperty("bullpen", out var bullpen))
            {
                this.bullpen = string.Join(";", bullpen.EnumerateArray().Select(v => v.GetString()));
            }

            if (team.Data.TryGetProperty("bench", out var bench))
            {
                this.bench = string.Join(";", bench.EnumerateArray().Select(v => v.GetString()));
            }
        }
Example #29
0
        public async Task <IActionResult> Edit(int id, [FromBody] TeamView teamView)
        {
            if (ModelState.IsValid)
            {
                var team = _mapper.Map <Team>(teamView);
                team.Id = id;
                team    = await _service.UpdateAsync(team);

                if (team == null)
                {
                    return(BadRequest("Can't update"));
                }
                var view = _mapper.Map <TeamView>(team);
                return(Ok(view));
            }
            return(BadRequest(ModelState));
        }
Example #30
0
        // GET: Teams/Create
        public async Task <ActionResult> CreateTeam(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            League league = await db.Leagues.FindAsync(id);

            if (league == null)
            {
                return(HttpNotFound());
            }
            var view = new TeamView {
                LeagueId = league.LeagueId,
            };

            return(View(view));
        }
Example #31
0
        public ActionResult EditTeam(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var team = db.Teams.Find(id);

            var teamview = new TeamView
            {
                LeagueId = team.LeagueId,
                Logo     = team.Logo,
                Initials = team.Initials,
                Name     = team.Name,
                TeamId   = team.TeamId
            };

            return(View(teamview));
        }
 private void bindClubsToComboBox(ComboBox cb, County county)
 {
     using (TeamView _context = new TeamView(context))
     {
         cb.DataSource = _context.GetClubsByCounty(county);
         cb.ValueMember = "ID";
         cb.DisplayMember = "Name";
     }
 }
Example #33
-1
        public MainWindow()
        {
            #if !DEBUG
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
            #endif
            Thread.CurrentThread.Name = "UI Thread";

            Bot = new BotClient();
            Bot.StateChanged += Bot_StateChanged;
            Bot.ClientChanged += Bot_ClientChanged;
            Bot.AutoReconnector.StateChanged += Bot_AutoReconnectorStateChanged;
            Bot.StaffAvoider.StateChanged += Bot_StaffAvoiderStateChanged;
            Bot.PokemonEvolver.StateChanged += Bot_PokemonEvolverStateChanged;
            Bot.ConnectionOpened += Bot_ConnectionOpened;
            Bot.ConnectionClosed += Bot_ConnectionClosed;
            Bot.MessageLogged += Bot_LogMessage;

            InitializeComponent();
            AutoReconnectSwitch.IsChecked = Bot.AutoReconnector.IsEnabled;
            AvoidStaffSwitch.IsChecked = Bot.StaffAvoider.IsEnabled;
            AutoEvolveSwitch.IsChecked = Bot.PokemonEvolver.IsEnabled;

            App.InitializeVersion();

            Team = new TeamView(Bot);
            Inventory = new InventoryView();
            Chat = new ChatView(Bot);
            Players = new PlayersView(Bot);

            _refreshPlayers = DateTime.UtcNow;
            _refreshPlayersDelay = 5000;

            TeamContent.Content = Team;
            InventoryContent.Content = Inventory;
            ChatContent.Content = Chat;
            PlayersContent.Content = Players;

            TeamContent.Visibility = Visibility.Visible;
            InventoryContent.Visibility = Visibility.Collapsed;
            ChatContent.Visibility = Visibility.Collapsed;
            PlayersContent.Visibility = Visibility.Collapsed;
            TeamButton.IsChecked = true;

            SetTitle(null);

            LogMessage("Running " + App.Name + " by " + App.Author + ", version " + App.Version);

            Task.Run(() => UpdateClients());
        }