protected void Btnsave_Click(object sender, EventArgs e)
        {
            if (Txtpsw.Text == "")
            {
                txtPasse2.Text = "";
                MsgPasse.Text  = "Vous devez saisir votre mot de passe!";
                Txtpsw.Focus();
            }

            else if (txtpsw2.Text == "")
            {
                txtpsw2.Focus();
                MsgPasse.Text  = "";
                txtPasse2.Text = "Vous devez retaper votre mot de passe";
            }
            else if (txtpsw2.Text.Trim() != Txtpsw.Text.Trim())
            {
                txtpsw2.Focus();
                txtpsw2.Text   = "";
                MsgPasse.Text  = "";
                txtPasse2.Text = "Les deux mot de passe ne sont pas identique!";
            }
            else
            {
                System.Drawing.Image.FromStream(FileUpload1.PostedFile.InputStream);
                System.Drawing.Image imag = System.Drawing.Image.FromStream(FileUpload1.PostedFile.InputStream);
                txtPasse2.Text = "";
                MsgPasse.Text  = "";
                AstreeDonnees astrDonnes = new AstreeDonnees();

                UtilisateurDB usr = astrDonnes.GetUser(Convert.ToInt16(Session["code_utilisateur"]));
                adresseDB     adr = astrDonnes.GetAdresse(usr).FirstOrDefault();

                adr.ville       = TxtVille.Text;
                adr.tel         = Txttel.Text;
                adr.gouvernerat = Txtgouvernerat.Text;
                usr.Mdp         = Txtpsw.Text;

                byte[] tab = ConvertImageToByteArray(imag, System.Drawing.Imaging.ImageFormat.Jpeg);;
                usr.Image = tab;

                astrDonnes.modifierUtilisateur(usr);
                astrDonnes.modifierAdresse(adr);
                //lblMsgSucces.Visible = true;
                //lblMsgSucces.Text = "Modification Terminée";
            }
        }
예제 #2
0
        private bool CheckValue()
        {
            if (string.IsNullOrEmpty(Txtid.Text))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('普通用户账号不能为空!');", true);
                Txtid.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(Txtpsw.Text))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('密码不能为空!');", true);
                Txtpsw.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(Txtgender.Text))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('性别不能为空!');", true);
                Txtgender.Focus();
                return(false);
            }

            return(true);
        }