예제 #1
0
        void deletebyId(string txtId)
        {
            BALJoueur balJoueur = new BALJoueur();

            try
            {
                int returnValue = balJoueur.deleteJoueur(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);
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
            }
        }
예제 #5
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);
                }
            }
        }
예제 #6
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);
            }
        }
예제 #7
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);
     }
 }
예제 #8
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);
            }
        }
예제 #9
0
        public List <PROP.PROPJoueur> getJoueur()
        {
            BALJoueur balJoueur = new BALJoueur();

            return(balJoueur.getJoueur(null));
        }