public void ListeUsers()
        {
            // Création d'une nouvelle instance de Users (reliée à la table MainDB.Users)
            PersonnesTable users = new PersonnesTable((String)Application["MaindDB"], this);

            users.SelectAll();
            users.MakeGridView(PN_ListUsers, "EditUser.aspx");
        }
Beispiel #2
0
        private void InsertSetValueScript(Panel panel, PersonnesTable personne)
        {
            String script = "<script>";

            script += BuildSetValueScript("Prenom", personne.Prenom);
            script += BuildSetValueScript("Nom", personne.Nom);
            script += BuildSetValueScript("Telephone", personne.Telephone);
            script += BuildSetValueScript("CodePostal", personne.CodePostal);
            script += BuildSetValueScript("Naissance", personne.Naissance.ToShortDateString());
            script += BuildSetRadioBUttonGroupValueScript("Sexe", personne.Sexe.ToString());
            script += BuildSetRadioBUttonGroupValueScript("Etatcivil", personne.EtatCivil.ToString());
            script += "</script>";
            panel.Controls.Add(new LiteralControl(script));
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            user = new PersonnesTable((String)Application["MaindDB"], this);

            user.SelectByID((String)Session["Selected_ID"]);
            InsertSetValueScript(PN_Script, user);
            if (user.Avatar != "")
            {
                IMG_Avatar.ImageUrl = "Avatars/" + user.Avatar + ".png"; // +"?" + DateTime.Now.Millisecond.ToString();
            }
            else
            {
                IMG_Avatar.ImageUrl = "Images/ADD.png"; // +"?" + DateTime.Now.Millisecond.ToString();
            }
            String action = Request["action"];

            if (action == "cancel")
            {
                Response.Redirect("ListUsers.aspx");
            }
            if (action == "confirm")
            {
                //AddPersonne();
                Response.Redirect("ListUsers.aspx");
            }
            if (action == "delete")
            {
                if (delete)
                {
                    DeleteCurrent();
                    Response.Redirect("ListUsers.aspx");
                }
            }
            if (action == "edit")
            {
                UpdateCurrent();
                Response.Redirect("ListUsers.aspx");
            }
        }
Beispiel #4
0
        public void AddPersonne()
        {
            // Création d'une nouvelle instance de Users (reliée à la table MainDB.Users)
            PersonnesTable users = new PersonnesTable((String)Application["MaindDB"], this);

            String Avatar_Path = "";
            String avatar_ID   = "";

            if (FU_Avatar.FileName != "")
            {
                avatar_ID   = Guid.NewGuid().ToString();
                Avatar_Path = Server.MapPath(@"~\Avatars\") + avatar_ID + ".png";
                FU_Avatar.SaveAs(Avatar_Path);
            }

            users.InsertRecord(Request["Prenom"],
                               Request["Nom"],
                               Request["Telephone"],
                               Request["CodePostal"],
                               avatar_ID,
                               Request["Naissance"],
                               Request["Sexe"],
                               Request["EtatCivil"]);
        }