Esempio n. 1
0
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        if (this.IsCorrectEntries())
        {
            using (PortalDataContext pdc = new PortalDataContext())
            {
                EventGame eg = new EventGame()
                {
                    EventID      = hdnEventID.Value.ToInt(),
                    GamePhase    = ddlGamePhase.SelectedValue.ToChar(),
                    StartDate    = clsValidator.CheckDate(txtStartYear.Text.ToInt(), ddlStartMonth.SelectedValue.ToInt(), ddlStartDay.SelectedValue.ToInt(), ddlStartHour.SelectedValue.ToInt(), ddlStartMinute.SelectedValue.ToInt(), ddlStartTimePeriod.SelectedValue),
                    EndDate      = clsValidator.CheckDate(txtEndYear.Text.ToInt(), ddlEndMonth.SelectedValue.ToInt(), ddlEndDay.SelectedValue.ToInt(), ddlEndHour.SelectedValue.ToInt(), ddlEndMinute.SelectedValue.ToInt(), ddlEndTimePeriod.SelectedValue),
                    Location     = txtLocation.Text,
                    WinnerTeamID = ddlWinner.SelectedValue.ToInt(),
                    IsFinished   = chkFinished.Checked,
                    IsActive     = true,
                    CreatedBy    = Request.Cookies["Speedo"]["UserName"],
                    DateCreated  = DateTime.Now
                };

                pdc.EventGames.InsertOnSubmit(eg);
                pdc.SubmitChanges();
            }
            Response.Redirect("EventDetails.aspx?eventid=" + Request.QueryString["eventid"]);
        }
    }
Esempio n. 2
0
    private void CheckInsertEventTeamScore()
    {
        using (PortalDataContext pdc = new PortalDataContext())
        {
            List <int> teamIDList = new List <int>();
            teamIDList = (from t in pdc.Teams
                          where t.ActivityID == SynergyCurrentID &&
                          !(from ets in pdc.EventTeamScores
                            where ets.EventID == hdnEventID.Value.ToInt()
                            select ets.TeamID).Contains(t.TeamID)
                          select t.TeamID).ToList();

            foreach (int teamID in teamIDList)
            {
                EventTeamScore ets = new EventTeamScore()
                {
                    EventID = hdnEventID.Value.ToInt(),
                    TeamID  = teamID,
                    Rank    = 0,
                    Score   = 0
                };
                pdc.EventTeamScores.InsertOnSubmit(ets);
            }

            pdc.SubmitChanges();
        }
    }
Esempio n. 3
0
    protected void dgCompetingTeams_ItemCommand(object source, DataGridCommandEventArgs e)
    {
        if (e.CommandName == "AddPlayer")
        {
            DropDownList pddlPlayers = (DropDownList)e.Item.FindControl("ddlPlayers");
            HiddenField  phdnTeamID  = (HiddenField)e.Item.FindControl("hdnTeamID");
            if (pddlPlayers.Items.Count > 0)
            {
                using (PortalDataContext pdc = new PortalDataContext())
                {
                    EventGameTeamPlayer egtp = new EventGameTeamPlayer()
                    {
                        GameID   = hdnGameID.Value.ToInt(),
                        TeamID   = phdnTeamID.Value.ToInt(),
                        Username = pddlPlayers.SelectedValue
                    };

                    pdc.EventGameTeamPlayers.InsertOnSubmit(egtp);

                    pdc.SubmitChanges();
                }

                this.LoadCompetingTeams();
            }
        }
    }
Esempio n. 4
0
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        Event ev = new Event()
        {
            Name            = txtEventName.Text,
            ActivityID      = SynergyCurrentID,
            EventDivisionID = ddlDivision.SelectedValue.ToInt(),
            EventCategoryID = ddlCategory.SelectedValue.ToInt(),
            MaxPoint        = txtMaxPoints.Text.ToInt(),
            WinnerTeamID    = ddlWinner.SelectedValue.ToInt(),
            SortOrder       = txtOrder.Text.ToInt(),
            IsActive        = true,
            ScoringTypeID   = 1,
            CreatedBy       = Request.Cookies["Speedo"]["UserName"].ToString(),
            DateCreated     = DateTime.Now
        };

        using (PortalDataContext pdc = new PortalDataContext())
        {
            pdc.Events.InsertOnSubmit(ev);
            pdc.SubmitChanges();

            List <int> teamIDList = new List <int>();
            teamIDList = (from t in pdc.Teams
                          where t.ActivityID == SynergyCurrentID
                          select t.TeamID).ToList();

            foreach (int teamID in teamIDList)
            {
                EventTeamScore ets = new EventTeamScore()
                {
                    EventID = ev.EventID,
                    TeamID  = teamID,
                    Rank    = 0,
                    Score   = 0
                };
                pdc.EventTeamScores.InsertOnSubmit(ets);
            }

            pdc.SubmitChanges();
        }

        Response.Redirect("EventMenu.aspx");
    }
    protected void dgAchievements_DeleteCommand(object source, DataGridCommandEventArgs e)
    {
        using (PortalDataContext pdc = new PortalDataContext())
        {
            Achievement achievement = (from a in pdc.Achievements
                                       where a.AchievementID == e.Item.Cells[0].Text.ToInt()
                                       select a).SingleOrDefault();

            pdc.Achievements.DeleteOnSubmit(achievement);
            pdc.SubmitChanges();
        }
        this.LoadAchievements();
    }
Esempio n. 6
0
    protected void btnAddCommittee_Click(object sender, ImageClickEventArgs e)
    {
        if (ddlCommittee.Items.Count > 0)
        {
            using (PortalDataContext pdc = new PortalDataContext())
            {
                EventGameOfficial ego = new EventGameOfficial()
                {
                    GameID     = hdnGameID.Value.ToInt(),
                    OfficialID = ddlCommittee.SelectedValue
                };

                pdc.EventGameOfficials.InsertOnSubmit(ego);

                pdc.SubmitChanges();
            }
            this.LoadOfficials();
        }
    }
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        using (PortalDataContext pdc = new PortalDataContext())
        {
            Achievement achievement = new Achievement()
            {
                ActivityID  = ddlActivity.SelectedValue.ToInt(),
                Username    = ddlTeamMember.SelectedValue,
                Award       = txtAchievement.Text,
                CreatedBy   = Request.Cookies["Speedo"]["Username"],
                DateCreated = DateTime.Now
            };

            pdc.Achievements.InsertOnSubmit(achievement);

            pdc.SubmitChanges();
        }
        txtAchievement.Text = "";
        this.LoadAchievements();
    }
Esempio n. 8
0
    protected void btnAddTeam_Click(object sender, ImageClickEventArgs e)
    {
        if (ddlTeams.Items.Count > 0)
        {
            using (PortalDataContext pdc = new PortalDataContext())
            {
                EventGameTeam egt = new EventGameTeam()
                {
                    GameID = hdnGameID.Value.ToInt(),
                    TeamID = ddlTeams.SelectedValue.ToInt(),
                    Rank   = 0,
                    Score  = 0
                };

                pdc.EventGameTeams.InsertOnSubmit(egt);

                pdc.SubmitChanges();
            }
            this.LoadCompetingTeams();
        }
    }
Esempio n. 9
0
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        int   intEventID = 0;
        Event ev         = new Event()
        {
            Name            = txtEventName.Text,
            ActivityID      = SynergyCurrentID,
            EventDivisionID = ddlDivision.SelectedValue.ToInt(),
            EventCategoryID = ddlCategory.SelectedValue.ToInt(),
            MaxPoint        = txtMaxPoints.Text.ToInt(),
            WinnerTeamID    = ddlWinner.SelectedValue.ToInt(),
            SortOrder       = txtOrder.Text.ToInt(),
            IsActive        = true,
            ScoringTypeID   = 1,
            CreatedBy       = Request.Cookies["Speedo"]["UserName"].ToString(),
            DateCreated     = DateTime.Now
        };

        using (PortalDataContext pdc = new PortalDataContext())
        {
            pdc.Events.InsertOnSubmit(ev);
            pdc.SubmitChanges();

            List <int> teamIDList = new List <int>();
            teamIDList = (from t in pdc.Teams
                          where t.ActivityID == SynergyCurrentID
                          select t.TeamID).ToList();

            //foreach (int teamID in teamIDList)
            //{
            //    EventTeamScore ets = new EventTeamScore()
            //    {

            //        EventID = ev.EventID,
            //        TeamID = teamID,
            //        Rank = 0,
            //        Score = 0
            //    };
            //    pdc.EventTeamScores.InsertOnSubmit(ets);
            //}

            //added by charlie bachiller
            intEventID = ev.EventID;
            using (SqlConnection cn = new SqlConnection(clsSpeedo.SpeedoConnectionString))
            {
                SqlCommand cmd = cn.CreateCommand();
                cn.Open();
                if (chkActive.Checked == true)
                {
                    cmd.CommandText = "UPDATE Portal.EventsActive SET IsActive='0'";
                    cmd.ExecuteNonQuery();
                    cmd.Parameters.Clear();
                }

                cmd.CommandText = "INSERT INTO Portal.EventsActive (EventID, IsActive) VALUES(@EventID, @IsActive)";
                cmd.Parameters.Add(new SqlParameter("@EventID", intEventID));
                cmd.Parameters.Add(new SqlParameter("@IsActive", chkActive.Checked == true ? "1" : "0"));
                cmd.ExecuteNonQuery();
            }

            pdc.SubmitChanges();
        }

        Response.Redirect("EventMenu.aspx");
    }