protected void btnEditJoueurName_Click(object sender, EventArgs e)
        {
            try
            {
                PROP.PROPJoueur Joueur = new PROP.PROPJoueur();
                //Joueur.Id = Convert.ToInt16(ddlJoueur.SelectedValue);
                //Joueur.Nom = txtEditJoueurName.Text;

                BALJoueur balJoueur = new BALJoueur();
                bool      result    = balJoueur.updateJoueur(Joueur);

                if (!result)
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Invalid Inputs for update.')</script>");
                }
                else
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Joueur is updated successfully.')</script>");
                    binding(null);
                    //ddlJoueur.SelectedIndex = 0;
                    //txtEditJoueurName.Text = string.Empty;
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
示例#2
0
        protected void btnEditCountryName_Click(object sender, EventArgs e)
        {
            try
            {
                PROP.PROPCountry country = new PROP.PROPCountry();
                country.CountryID   = Convert.ToInt16(ddlCountry.SelectedValue);
                country.CountryName = txtEditCountryName.Text;

                BALCountry balCountry = new BALCountry();
                bool       result     = balCountry.updateCountry(country);

                if (!result)
                {
                    ClientScript.RegisterClientScriptBlock(GetType(), "message", "<script>alert('Invalid Inputs for update.')</script>");
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(GetType(), "message", "<script>alert('Country is updated successfully.')</script>");
                    binding(null);
                    ddlCountry.SelectedIndex = 0;
                    txtEditCountryName.Text  = string.Empty;
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            BALEquipe balJoueur = new BALEquipe();

            try
            {
                int returnValue = balJoueur.CreateEquipe(txtEquipeName.Text);
                if (returnValue > 0)
                {
                    gvJoueurList.DataBind();
                    Page.RegisterClientScriptBlock("message", "<script>alert('Joueur is created successfully')</script>");
                    txtEquipeName.Text = string.Empty;

                    binding(null);
                }
                else
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Incorrect User Inputs.')</script>");
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
        void deletebyId(string txtId)
        {
            BALEquipe balJoueur = new BALEquipe();

            try
            {
                int returnValue = balJoueur.deleteEquipe(txtId);
                if (returnValue == 0)
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Incorrect Joueur Id')</script>");
                }
                else if (returnValue == -2)
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Joueur ID could not found.')</script>");
                }
                else if (returnValue == 1)
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Joueur is deleted successfully.')</script>");
                    binding(null);
                    //txtDeleteID.Text = string.Empty;
                }
                else
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Unspecified error.')</script>");
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
示例#5
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            BALCountry balCountry = new BALCountry();

            try
            {
                int returnValue = balCountry.deleteCountry(txtDeleteID.Text);
                if (returnValue == 0)
                {
                    ClientScript.RegisterClientScriptBlock(GetType(), "message", "<script>alert('Incorrect Country Id')</script>");
                }
                else if (returnValue == -2)
                {
                    ClientScript.RegisterClientScriptBlock(GetType(), "message", "<script>alert('Country ID could not found.')</script>");
                }
                else if (returnValue == 1)
                {
                    ClientScript.RegisterClientScriptBlock(GetType(), "message", "<script>alert('Country is deleted successfully.')</script>");
                    binding(null);
                    txtDeleteID.Text = string.Empty;
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(GetType(), "message", "<script>alert('Unspecified error.')</script>");
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
        protected void CreateUserButton_Click(object sender, EventArgs e)
        {
            BALUser balJoueur = new BALUser();

            try
            {
                int returnValue = balJoueur.CreateUser(this.UserName.Text, this.Email.Text, this.Password.Text);
                if (returnValue > 0)
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Joueur is created successfully')</script>");

                    Session["User"] = this.UserName.Text;
                    //binding(null);
                }
                else
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Incorrect User Inputs.')</script>");
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
示例#7
0
        protected void btnEditCountryName_Click(object sender, EventArgs e)
        {
            try
            {
                PROP.PROPEquipe equipe = new PROP.PROPEquipe();
                //equipe.Id = Convert.ToInt16(ddlCountry.SelectedValue);
                //equipe.Nom = txtEditCountryName.Text;


                BALEquipe dalequipe = new BALEquipe();

                //DALEquipe balCountry = new BALCountry();


                bool result = dalequipe.updateEquipe(equipe);

                if (!result)
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Invalid Inputs for update.')</script>");
                }
                else
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Country is updated successfully.')</script>");
                    binding(null);
                    //ddlCountry.SelectedIndex = 0;
                    //txtEditCountryName.Text = string.Empty;
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            BALJoueur balJoueur = new BALJoueur();

            try
            {
                int eqId;

                int.TryParse(ddlEquipe.SelectedValue, out eqId);
                int returnValue = balJoueur.CreateJoueur(txtJoueurName.Text, txtJoueurPrenom.Text, rdSexe1.Checked, eqId);
                if (returnValue > 0)
                {
                    gvJoueurList.DataBind();
                    Page.RegisterClientScriptBlock("message", "<script>alert('Joueur is created successfully')</script>");
                    txtJoueurName.Text = string.Empty;

                    binding(null);
                }
                else
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Incorrect User Inputs.')</script>");
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
        private void binding(string searchJoueur)
        {
            try
            {
                BALEquipe balEquipe = new BALEquipe();
                LsEquipe = balEquipe.getEquipe(null);

                BALJoueur balJoueure = new BALJoueur();
                LsJoueur = balJoueure.getJoueur(null);

                foreach (var eq in LsEquipe)
                {
                    var TwoJoueurs = LsJoueur.Where(x => x.EquipeId == eq.Id).Take(2);
                    if (TwoJoueurs.Count() > 0)
                    {
                        eq.Joueur1 = TwoJoueurs.FirstOrDefault();
                    }
                    if (TwoJoueurs.Count() == 2)
                    {
                        eq.Joueur2 = TwoJoueurs.LastOrDefault();
                    }
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
示例#10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                enVisibleEditButton();
                string idString = Request.QueryString["id"];

                var balEquipe = new BALEquipe();
                try
                {
                    EquipeObj = balEquipe.getEquipeByID(idString);
                    if (EquipeObj == null)
                    {
                        Page.RegisterClientScriptBlock("message", "<script>alert('Country Id is not found.')</script>");

                        Response.Redirect(btnLink.PostBackUrl);
                    }
                    else
                    {
                        lblName.Text = EquipeObj.Nom;
                        BALJoueur balJoueure = new BALJoueur();
                        var       LsJoueur   = balJoueure.getJoueur(null);
                        var       TwoJoueurs = LsJoueur.Where(x => x.EquipeId == EquipeObj.Id).Take(2);
                        if (TwoJoueurs.Count() > 0)
                        {
                            EquipeObj.Joueur1 = TwoJoueurs.FirstOrDefault();
                        }
                        if (TwoJoueurs.Count() == 2)
                        {
                            EquipeObj.Joueur2 = TwoJoueurs.LastOrDefault();
                        }

                        Label1.Text = EquipeObj.Joueur1.Nom;
                        Label2.Text = EquipeObj.Joueur2.Prenom;
                    }
                }
                catch (Exception ex)
                {
                    clsLogging logError = new clsLogging();
                    logError.WriteLog(ex);
                    Response.Redirect(btnLink.PostBackUrl);
                }
            }
        }
示例#11
0
        protected void gvJoueurList_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                PROP.PROPJoueur Joueur = new PROP.PROPJoueur();

                //int userid = Convert.ToInt32(gvJoueurList.DataKeys[e.RowIndex].Value.ToString());
                GridViewRow row   = (GridViewRow)gvJoueurList.Rows[e.RowIndex];
                Label       lblID = (Label)row.FindControl("lblID");
                //TextBox txtname=(TextBox)gr.cell[].control[];
                TextBox txtId     = (TextBox)row.Cells[2].Controls[0];
                TextBox txtName   = (TextBox)row.Cells[3].Controls[0];
                TextBox txtPrenom = (TextBox)row.Cells[4].Controls[0];
                //TextBox textadd = (TextBox)row.FindControl("txtadd");
                //TextBox textc = (TextBox)row.FindControl("txtc");
                gvJoueurList.EditIndex = -1;

                Joueur.Id     = int.Parse(txtId.Text);
                Joueur.Nom    = txtName.Text;
                Joueur.Prenom = txtPrenom.Text;

                BALJoueur balJoueur = new BALJoueur();
                bool      result    = balJoueur.updateJoueur(Joueur);

                if (!result)
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Invalid Inputs for update.')</script>");
                }
                else
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Joueur is updated successfully.')</script>");
                    binding(null);
                    //ddlJoueur.SelectedIndex = 0;
                    //txtEditJoueurName.Text = string.Empty;
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
示例#12
0
        private void binding(string searchCountry)
        {
            try
            {
                BALCountry balCountry = new BALCountry();
                gvCountryList.DataSource = balCountry.getCoutry(searchCountry);
                gvCountryList.DataBind();

                ddlCountry.DataSource     = balCountry.getCoutry(null);
                ddlCountry.DataValueField = "CountryID";
                ddlCountry.DataTextField  = "CountryName";
                ddlCountry.DataBind();
                ddlCountry.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select Country to Edit", "-1"));
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
示例#13
0
 private void binding(string searchJoueur)
 {
     try
     {
         BALJoueur balJoueur = new BALJoueur();
         gvJoueurList.DataSource = balJoueur.getCoutry(searchJoueur);
         gvJoueurList.DataBind();
         BALEquipe balEquipe = new BALEquipe();
         ddlEquipe.DataSource     = balEquipe.getEquipe(null);
         ddlEquipe.DataValueField = "id";
         ddlEquipe.DataTextField  = "nom";
         ddlEquipe.DataBind();
         ddlEquipe.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Selectionnée l'equipe", "-1"));
     }
     catch (Exception ex)
     {
         clsLogging logError = new clsLogging();
         logError.WriteLog(ex);
     }
 }
示例#14
0
        protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
        {
            var balEquipe = new BALEquipe();

            try
            {
                var countryName = balEquipe.getEquipeByID(ddlCountry.SelectedValue);
                if (countryName == null)
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Country Id is not found.')</script>");
                }
                else
                {
                    txtEditCountryName.Text = countryName.Nom;
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
示例#15
0
        protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
        {
            string     countryName = string.Empty;
            BALCountry balCountry  = new BALCountry();

            try
            {
                countryName = balCountry.getCountryByID(ddlCountry.SelectedValue);
                if (string.IsNullOrEmpty(countryName))
                {
                    ClientScript.RegisterClientScriptBlock(GetType(), "message", "<script>alert('Country Id is not found.')</script>");
                }
                else
                {
                    txtEditCountryName.Text = countryName;
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
示例#16
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            BALEquipe dalequipe = new BALEquipe();

            try
            {
                int returnValue = dalequipe.CreateEquipe("");
                if (returnValue > 0)
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Country is created successfully')</script>");
                    //txtCountryName.Text = string.Empty;
                }
                else
                {
                    Page.RegisterClientScriptBlock("message", "<script>alert('Incorrect User Inputs.')</script>");
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
示例#17
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            BALCountry balCountry = new BALCountry();

            try
            {
                int returnValue = balCountry.CreateCountry(txtCountryName.Text);
                if (returnValue > 0)
                {
                    ClientScript.RegisterClientScriptBlock(GetType(), "message", "<script>alert('Country is created successfully')</script>");
                    txtCountryName.Text = string.Empty;
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(GetType(), "message", "<script>alert('Incorrect User Inputs.')</script>");
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
示例#18
0
        protected void ddlJoueur_SelectedIndexChanged(object sender, EventArgs e)
        {
            string    JoueurName = string.Empty;
            BALJoueur balJoueur  = new BALJoueur();

            try
            {
                //JoueurName = balJoueur.getJoueurByID(ddlJoueur.SelectedValue);
                //if (string.IsNullOrEmpty(JoueurName))
                //{
                //    Page.RegisterClientScriptBlock("message", "<script>alert('Joueur Id is not found.')</script>");
                //}
                //else
                //{
                //    txtEditJoueurName.Text = JoueurName;
                //}
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }
示例#19
0
        public string CreateEquipe(string contryName)
        {
            BALEquipe equipe = new BALEquipe();

            try
            {
                int returnValue = equipe.CreateEquipe(contryName);
                if (returnValue > 0)
                {
                    return("Country is created successfully ");
                }
                else
                {
                    return("Incorrect User Inputs.");
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
            return("hello");
        }
示例#20
0
        private void binding(string searchCountry)
        {
            try
            {
                var balCountry          = new BAL.BALUser();
                List <PROP.PROPUser> Pl = balCountry.getUser(searchCountry);

                var us = Pl.FirstOrDefault(x => x.UserName == UserName.Text && x.Password == Password.Text);
                if (us != null)
                {
                    Session["User"] = UserName.Text;
                    Response.Redirect("../");
                }
                else
                {
                    FailureText.Text = "Les donnee ne son pas corect !";
                }
            }
            catch (Exception ex)
            {
                clsLogging logError = new clsLogging();
                logError.WriteLog(ex);
            }
        }