protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["adminInfo"] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            lblMesaage.Text = "Welcome " + Session["adminInfo"].ToString();

            using (CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities())
            {
                List <Supporter> sup = (from x in _db.Supporters where x.isActive == true && x.isApproval == false select x).ToList();

                grvSupporterList.DataSource = sup.OrderBy(i => i.Name);
                grvSupporterList.DataBind();

                for (int i = 0; i < grvSupporterList.Rows.Count; i++)
                {
                    GridViewRow row       = (GridViewRow)grvSupporterList.Rows[i];
                    Label       lblNumber = (Label)row.FindControl("lblNumber");
                    lblNumber.Text = (i + 1).ToString();
                }
            }
        }
    }
    private void TeamAdd()
    {
        Team team = new Team();

        team.TeamName            = txtTeamName.Text;
        team.City                = txtCity.Text;
        team.MainColor           = txtMainColor.Text;
        team.SecondaryColor      = txtSecondaryColor.Text;
        team.EstablishmentYear   = Convert.ToDateTime(txtEstablishmentYear.Text);
        team.AccountBalance      = Convert.ToDecimal(txtAccountBalance.Text);
        team.PositionLeague      = Convert.ToInt32(txtPositionLeague.Text);
        team.NumberWin           = Convert.ToInt32(txtNumberWin.Text);
        team.NumberLose          = Convert.ToInt32(txtNumberLose.Text);
        team.NumberThrowGoal     = Convert.ToInt32(txtThrowGoal.Text);
        team.NumberGrabbedGoal   = Convert.ToInt32(txtGrabbedGoal.Text);
        team.GoalAverage         = Convert.ToInt32(txtGoalAverage.Text);
        team.Point               = Convert.ToInt32(txtPoint.Text);
        team.NumberEquality      = Convert.ToInt32(txtNumberEquality.Text);
        team.IsActive            = cbIsActive.Checked;
        team.NumberMatchesPlayed = Convert.ToInt32(txtNumberMatchesPlayed.Text);

        if (fuTeamImage.HasFile)
        {
            fuTeamImage.SaveAs(Server.MapPath("~/image/" + fuTeamImage.FileName));
            team.TeamImage = fuTeamImage.FileName;
        }
        using (_db = new CankayaFootballLeagueEntities())
        {
            _db.Teams.Add(team);
            _db.SaveChanges();
        }
        Response.Redirect("~/TeamList.aspx");
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["supporterInfo"] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            using (CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities())
            {
                List <Team> team = (from x in _db.Teams where x.IsActive == true select x).OrderByDescending(i => i.GoalAverage).ToList();

                grvRating.DataSource = team.OrderByDescending(i => i.Point);
                grvRating.DataBind();

                for (int i = 0; i < grvRating.Rows.Count; i++)
                {
                    GridViewRow row       = (GridViewRow)grvRating.Rows[i];
                    Label       lblNumber = (Label)row.FindControl("lblNumber");
                    lblNumber.Text = (i + 1).ToString();
                }

                lblSupporterName.Text = "Welcome " + Session["supporterInfo"].ToString();
            }
        }
    }
    protected void btnIsApproval_Click1(object sender, EventArgs e)
    {
        CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities();

        for (int i = 0; i < grvSupporterList.Rows.Count; i++)
        {
            GridViewRow row   = (GridViewRow)grvSupporterList.Rows[i];
            CheckBox    c     = (CheckBox)row.FindControl("cbIsApproval");
            Label       lblId = (Label)row.FindControl("lblId");

            int idd = Convert.ToInt32(lblId.Text);

            if (c.Checked == true)
            {
                Supporter sup1 = (from x in _db.Supporters where x.isActive == true && x.isApproval == false && x.SupporterId == idd select x).SingleOrDefault();
                sup1.isApproval = true;
            }
        }
        _db.SaveChanges();

        List <Supporter> sup = (from x in _db.Supporters where x.isActive == true && x.isApproval == false select x).ToList();

        grvSupporterList.DataSource = sup.OrderBy(i => i.Name);
        grvSupporterList.DataBind();

        for (int i = 0; i < grvSupporterList.Rows.Count; i++)
        {
            GridViewRow row       = (GridViewRow)grvSupporterList.Rows[i];
            Label       lblNumber = (Label)row.FindControl("lblNumber");
            lblNumber.Text = (i + 1).ToString();
        }
    }
    protected void grvTeamList_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        grvTeamList.EditIndex = -1;

        CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities();
        List <Team> team = (from x in _db.Teams where x.IsActive == true select x).ToList();

        grvTeamList.DataSource = team;
        grvTeamList.DataBind();
    }
Ejemplo n.º 6
0
    private void ShowFixture()
    {
        using (CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities())
        {
            List <Fixture> week1 = (from x in _db.Fixtures where x.IsActive == true && x.Week == 1 select x).ToList();

            grvWeek1.DataSource = week1;
            grvWeek1.DataBind();

            List <Fixture> week2 = (from x in _db.Fixtures where x.IsActive == true && x.Week == 2 select x).ToList();

            grvWeek2.DataSource = week2;
            grvWeek2.DataBind();

            List <Fixture> week3 = (from x in _db.Fixtures where x.IsActive == true && x.Week == 3 select x).ToList();

            grvWeek3.DataSource = week3;
            grvWeek3.DataBind();

            List <Fixture> week4 = (from x in _db.Fixtures where x.IsActive == true && x.Week == 4 select x).ToList();

            grvWeek4.DataSource = week4;
            grvWeek4.DataBind();

            List <Fixture> week5 = (from x in _db.Fixtures where x.IsActive == true && x.Week == 5 select x).ToList();

            grvWeek5.DataSource = week5;
            grvWeek5.DataBind();

            List <Fixture> week6 = (from x in _db.Fixtures where x.IsActive == true && x.Week == 6 select x).ToList();

            grvWeek6.DataSource = week6;
            grvWeek6.DataBind();

            List <Fixture> week7 = (from x in _db.Fixtures where x.IsActive == true && x.Week == 7 select x).ToList();

            grvWeek7.DataSource = week7;
            grvWeek7.DataBind();

            List <Fixture> week8 = (from x in _db.Fixtures where x.IsActive == true && x.Week == 8 select x).ToList();

            grvWeek8.DataSource = week8;
            grvWeek8.DataBind();

            List <Fixture> week9 = (from x in _db.Fixtures where x.IsActive == true && x.Week == 9 select x).ToList();

            grvWeek9.DataSource = week9;
            grvWeek9.DataBind();

            List <Fixture> week10 = (from x in _db.Fixtures where x.IsActive == true && x.Week == 10 select x).ToList();

            grvWeek10.DataSource = week10;
            grvWeek10.DataBind();
        }
    }
    protected void grvRefereeList_RowEditing(object sender, GridViewEditEventArgs e)
    {
        CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities();

        grvRefereeList.EditIndex = e.NewEditIndex;

        List <Referee> referee = (from x in _db.Referees where x.IsActive == true select x).ToList();

        grvRefereeList.DataSource = referee;
        grvRefereeList.DataBind();
    }
    protected void grvTeamList_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow row                    = (GridViewRow)grvTeamList.Rows[e.RowIndex];
        Label       lblDeleteId            = (Label)row.FindControl("lblTeamId");
        FileUpload  newImage               = (FileUpload)row.FindControl("fuImage");
        TextBox     newName                = (TextBox)row.FindControl("txtTeamName");
        TextBox     newCity                = (TextBox)row.FindControl("txtCity");
        TextBox     newMainColor           = (TextBox)row.FindControl("txtMainColor");
        TextBox     newSecondaryColor      = (TextBox)row.FindControl("txtSecondaryColor");
        TextBox     newEstablishmentYear   = (TextBox)row.FindControl("txtEstablishmentYear");
        TextBox     newAccountBalance      = (TextBox)row.FindControl("txtAccountBalance");
        TextBox     newPositionLeague      = (TextBox)row.FindControl("txtPositionLeague");
        TextBox     newNumberWin           = (TextBox)row.FindControl("txtG");
        TextBox     newNumberLose          = (TextBox)row.FindControl("txtM");
        TextBox     newNumberEquality      = (TextBox)row.FindControl("txtB");
        TextBox     newNumberMatchesPlayed = (TextBox)row.FindControl("txtOM");
        TextBox     newNumberThrowGoal     = (TextBox)row.FindControl("txtAG");
        TextBox     newNumberGrabbedGoal   = (TextBox)row.FindControl("txtYG");
        TextBox     newGoalAverage         = (TextBox)row.FindControl("txtA");
        TextBox     newPoint               = (TextBox)row.FindControl("txtPoint");
        CankayaFootballLeagueEntities _db  = new CankayaFootballLeagueEntities();

        int id = Convert.ToInt32(lblDeleteId.Text);

        Team t = (from x in _db.Teams where x.TeamId == id && x.IsActive == true select x).SingleOrDefault();

        t.TeamName            = newName.Text;
        t.City                = newCity.Text;
        t.MainColor           = newMainColor.Text;
        t.SecondaryColor      = newSecondaryColor.Text;
        t.EstablishmentYear   = Convert.ToDateTime(newEstablishmentYear.Text);
        t.AccountBalance      = Convert.ToDecimal(newAccountBalance.Text);
        t.PositionLeague      = Convert.ToInt32(newPositionLeague.Text);
        t.NumberWin           = Convert.ToInt32(newNumberWin.Text);
        t.NumberLose          = Convert.ToInt32(newNumberLose.Text);
        t.NumberEquality      = Convert.ToInt32(newNumberEquality.Text);
        t.NumberMatchesPlayed = Convert.ToInt32(newNumberMatchesPlayed.Text);
        t.NumberThrowGoal     = Convert.ToInt32(newNumberThrowGoal.Text);
        t.NumberGrabbedGoal   = Convert.ToInt32(newNumberGrabbedGoal.Text);
        t.GoalAverage         = Convert.ToInt32(newGoalAverage.Text);
        t.Point               = Convert.ToInt32(newPoint.Text);
        t.TeamImage           = newImage.FileName;

        _db.SaveChanges();
        grvTeamList.DataBind();

        grvTeamList.EditIndex = -1;

        List <Team> team = (from x in _db.Teams where x.IsActive == true select x).ToList();

        grvTeamList.DataSource = team;
        grvTeamList.DataBind();
    }
    public Supporter isSupporterFound(string email, string password)
    {
        CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities();

        Supporter s = (from x in _db.Supporters where x.Email == email && x.isActive == true select x).SingleOrDefault();

        if (VerifyPassword(password, s.Password) == true)
        {
            return(s);
        }
        return(null);
    }
    protected void grvTeamList_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        GridViewRow row                   = (GridViewRow)grvTeamList.Rows[e.RowIndex];
        Label       lblDeleteId           = (Label)row.FindControl("lblTeamId");
        CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities();
        int id = Convert.ToInt32(lblDeleteId.Text);

        Team t = (from x in _db.Teams where x.TeamId == id && x.IsActive == true select x).SingleOrDefault();

        t.IsActive = false;
        _db.SaveChanges();
        grvTeamList.DataBind();
    }
Ejemplo n.º 11
0
    public string FindHomeId(object id)
    {
        string TeamName = "";
        int    rid      = Convert.ToInt32(id);
        CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities();
        Team t = (from x in _db.Teams where x.TeamId == rid select x).SingleOrDefault();

        if (t != null)
        {
            TeamName = t.TeamName;
        }
        return(TeamName);
    }
    public string FindRefereeName(object id)
    {
        string refereeName = "";
        int    rid         = Convert.ToInt32(id);
        CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities();
        RefereeType r = (from x in _db.RefereeTypes where x.RefereeTypeId == rid select x).SingleOrDefault();

        if (r != null)
        {
            refereeName = r.RefereeType1;
        }
        return(refereeName);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        using (CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities())
        {
            var u1 = (from x in _db.UserTypes select new { TypeId = x.UserTypeId, TypeName = x.UserType1 }).ToList();
            ddlUserType.DataSource     = u1;
            ddlUserType.DataTextField  = "TypeName";
            ddlUserType.DataValueField = "TypeId";
            ddlUserType.DataBind();

            var team = (from x in _db.Teams select new { TeamId = x.TeamId, TeamName = x.TeamName }).ToList();
            ddlSupportedTeam.DataSource     = team;
            ddlSupportedTeam.DataTextField  = "TeamName";
            ddlSupportedTeam.DataValueField = "TeamId";
            ddlSupportedTeam.DataBind();
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["adminInfo"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     else
     {
         using (CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities())
         {
             List <RefereeType> rf = (from x in _db.RefereeTypes select x).ToList();
             ddlRefereeType.DataSource     = rf;
             ddlRefereeType.DataTextField  = "RefereeType1";
             ddlRefereeType.DataValueField = "RefereeTypeId";
             ddlRefereeType.DataBind();
         }
     }
 }
    public Admin adminRegister(string name, string surName, string email, string password, string userName, string supportedTeamId)
    {
        CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities();

        Admin a = new Admin();

        a.Name            = name;
        a.Surname         = surName;
        a.Email           = email;
        a.Password        = HashPassword(password);
        a.UserName        = userName;
        a.SupportedTeamId = Convert.ToInt32(supportedTeamId);
        a.IsActive        = true;
        _db.Admins.Add(a);

        _db.SaveChanges();

        return(a);
    }
    public Supporter supporterRegister(string name, string surName, string email, string password, string userName, string supportedTeamId)
    {
        CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities();

        Supporter s = new Supporter();

        s.Name            = name;
        s.SurName         = surName;
        s.Email           = email;
        s.Password        = HashPassword(password);
        s.UserName        = userName;
        s.SupportedTeamId = Convert.ToInt32(supportedTeamId);
        s.isActive        = true;
        s.isApproval      = false;
        _db.Supporters.Add(s);
        _db.SaveChanges();

        return(s);
    }
    protected void grvRefereeList_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow  row              = (GridViewRow)grvRefereeList.Rows[e.RowIndex];
        Label        lblDeleteId      = (Label)row.FindControl("lblRefereeId");
        TextBox      newName          = (TextBox)row.FindControl("txtName");
        TextBox      newCity          = (TextBox)row.FindControl("txtCity");
        TextBox      newLicenceNumber = (TextBox)row.FindControl("txtLicenceNumber");
        TextBox      newLastName      = (TextBox)row.FindControl("txtLastName");
        TextBox      newBirthDate     = (TextBox)row.FindControl("txtBirthDate");
        TextBox      newEmail         = (TextBox)row.FindControl("txtEmail");
        DropDownList newRefereeType   = (DropDownList)row.FindControl("ddlRefereeTypeId");

        CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities();

        int id = Convert.ToInt32(lblDeleteId.Text);

        RefereeType[] rf = (from x in _db.RefereeTypes select x).ToArray();
        newRefereeType.DataSource     = rf;
        newRefereeType.DataTextField  = "RefereeType1";
        newRefereeType.DataValueField = "RefereeTypeId";
        newRefereeType.DataBind();

        Referee r = (from x in _db.Referees where x.RefereeId == id && x.IsActive == true select x).SingleOrDefault();

        r.Name          = newName.Text;
        r.City          = newCity.Text;
        r.LicenceNumber = newLicenceNumber.Text;
        r.LastName      = newLastName.Text;
        r.BirthDate     = Convert.ToDateTime(newBirthDate.Text);
        r.Email         = newEmail.Text;
        r.RefereeTypeId = Convert.ToInt32(newRefereeType.SelectedItem.Value);

        _db.SaveChanges();
        grvRefereeList.DataBind();

        grvRefereeList.EditIndex = -1;

        List <Referee> referee = (from x in _db.Referees where x.IsActive == true select x).ToList();

        grvRefereeList.DataSource = referee;
        grvRefereeList.DataBind();
    }
    public Admin isAdminFound(string email, string password)
    {
        CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities();

        Admin a = (from x in _db.Admins where x.Email == email && x.IsActive == true select x).SingleOrDefault();

        if (a == null)
        {
            isSupporterFound(email, password);
        }
        else
        {
            bool z = VerifyPassword(password, a.Password) == true;
            if (z == true)
            {
                return(a);
            }
        }
        return(null);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["adminInfo"] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            using (CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities())
            {
                if (!IsPostBack)
                {
                    List <Team> team = (from x in _db.Teams where x.IsActive == true select x).ToList();

                    grvTeamList.DataSource = team.OrderBy(i => i.TeamName);
                    grvTeamList.DataBind();
                }
            }
        }
    }
    private void RefereeAdd()
    {
        Referee referee = new Referee();

        referee.LicenceNumber = txtLicenceNumber.Text;
        referee.Name          = txtName.Text;
        referee.LastName      = txtSurname.Text;
        referee.City          = txtCity.Text;
        referee.BirthDate     = Convert.ToDateTime(txtBirthdate.Text);
        referee.Email         = txtEmail.Text;
        referee.RefereeTypeId = Convert.ToInt32(ddlRefereeType.SelectedItem.Value);
        referee.IsActive      = cbIsActive.Checked;

        using (CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities())
        {
            _db.Referees.Add(referee);
            _db.SaveChanges();
        }
        Response.Redirect("~/RefereeList.aspx");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["adminInfo"] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            using (CankayaFootballLeagueEntities _db = new CankayaFootballLeagueEntities())
            {
                if (!IsPostBack)
                {
                    List <Referee> referee = (from x in _db.Referees where x.IsActive == true select x).ToList();

                    grvRefereeList.DataSource = referee;
                    grvRefereeList.DataBind();
                }
            }
        }
    }