Beispiel #1
0
        private void UpdateUser()
        {
            if ((Session["Selected_ID"] != null) && (Session["Users"] != null))
            {
                Users users = (Users)Session["Users"];
                users.ID       = long.Parse(TB_ID.Text);
                users.FullName = TB_FullName.Text;
                users.UserName = TB_Username.Text;
                users.Password = TB_Password.Text;
                users.Email    = TB_Email.Text;

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

                users.Update();
                Session["User"]        = null;
                Session["Selected_ID"] = null;
            }
            Response.Redirect("ListUsers.aspx");
        }
        protected void AddPersonneFormData()
        {
            String avatar_ID = "";

            if (FU_Avatar.FileName != "")
            {
                String Avatar_Path = "";

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

            PersonnesTable personne = new PersonnesTable((String)Application["MainDB"], this);

            personne.Prenom     = TB_Prenom.Text;
            personne.Nom        = TB_Nom.Text;
            personne.Telephone  = TB_Telephone.Text;
            personne.CodePostal = TB_CodePostal.Text;
            personne.Naissance  = DateTime.Parse(TB_Naissance.Text);
            personne.Sexe       = RBL_Sexe.SelectedIndex;
            personne.EtatCivil  = RBL_EtatCivil.SelectedIndex;
            personne.Avatar     = avatar_ID;
            personne.Insert();
        }
Beispiel #3
0
        private void UpdateCurrent()
        {
            if ((Session["Selected_ID"] != null) && (Session["Personne"] != null))
            {
                PersonnesTable personne = (PersonnesTable)Session["Personne"];
                personne.Prenom     = Request["Prenom"];
                personne.Nom        = Request["Nom"];
                personne.Telephone  = Request["Telephone"];
                personne.CodePostal = Request["CodePostal"];
                personne.Naissance  = DateTime.Parse(Request["Naissance"]);
                personne.Sexe       = int.Parse(Request["Sexe"]);
                personne.EtatCivil  = int.Parse(Request["EtatCivil"]);

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

                personne.Update();
                Session["Personne"]    = null;
                Session["Selected_ID"] = null;
            }
            Response.Redirect("ListerPersonnes.aspx");
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String action = Request["action"];

            if (action == "add")
            {
                if ((Request["Prenom"] != null) && (Request["Prenom"] != ""))
                {
                    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);
                    }

                    PersonnesTable personnes = new PersonnesTable((String)Application["MainDB"], this);
                    personnes.Prenom     = Request["Prenom"];
                    personnes.Nom        = Request["Nom"];
                    personnes.Telephone  = Request["Telephone"];
                    personnes.CodePostal = Request["CodePostal"];
                    personnes.Avatar     = avatar_ID;
                    personnes.Naissance  = DateTime.Parse(Request["Naissance"]);
                    personnes.Sexe       = int.Parse(Request["Sexe"]);
                    personnes.EtatCivil  = int.Parse(Request["EtatCivil"]);
                    personnes.Insert();
                    Response.Redirect("ListerPersonnes.aspx");
                }
            }
            if (action == "cancel")
            {
                Response.Redirect("ListerPersonnes.aspx");
            }
        }
Beispiel #5
0
        private void UpdateCurrent()
        {
            String Avatar_Path = "";

            if (FU_Avatar.FileName != "")
            {
                Avatar_Path = Server.MapPath(@"~\Avatars\") + user.Avatar + ".png";
                FU_Avatar.SaveAs(Avatar_Path);
            }

            user.UpdateRecord((String)Session["Selected_ID"],
                              Request["Prenom"],
                              Request["Nom"],
                              Request["Telephone"],
                              Request["CodePostal"],
                              user.Avatar,
                              Request["Naissance"],
                              Request["Sexe"],
                              Request["EtatCivil"]);
        }
Beispiel #6
0
        public void AddUsers()
        {
            // Création d'une nouvelle instance de Users (reliée à la table MainDB.Users)
            Users users = new Users((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(TB_FullName.Text,
                               TB_Username.Text,
                               TB_Password.Text,
                               TB_Email.Text,
                               avatar_ID);
        }
Beispiel #7
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"]);
        }
Beispiel #8
0
        private void UpdateCurrent()
        {
            if ((Session["Selected_ID"] != null) && (Session["Personne"] != null))
            {
                PersonnesTable personne = (PersonnesTable)Session["Personne"];
                GetFormValues(personne);

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

                personne.Update();
                Session["Personne"]    = null;
                Session["Selected_ID"] = null;
            }
            Response.Redirect("ListerPersonnes.aspx");
        }