Ejemplo n.º 1
0
        protected void RegisterButton_Click(object sender, EventArgs e)
        {
            // DXCOMMENT: Your Registration logic
            //MembershipUser u = Membership.GetUser(User.Identity.Name);
            //MembershipUser u = Membership.CreateUser(login, "educative");

            try
            {
                if (Cl_Fonction.Verification_Code("aspnet_Users", "UserName", RegisterUserNameTextBox.Text))
                {
                    RegisterUserNameTextBox.ValidationSettings.ErrorDisplayMode = DevExpress.Web.ErrorDisplayMode.ImageWithText;
                    RegisterUserNameTextBox.ValidationSettings.ErrorText        = "Ce username est déjà utilisé";
                }
                else
                {
                    if (Cl_Fonction.IsValidEmail(EmailTextBox.Text.Trim()))
                    {
                        ArrayList cle = new ArrayList();
                        ArrayList val = new ArrayList();

                        //string activationCode = Guid.NewGuid().ToString();
                        cle.Add("@CODE_PERSONNE"); val.Add(MatriculeTextBox.Text.Trim());
                        cle.Add("@NOM_PERSONNE"); val.Add(LastNameTextBox.Text.Trim());
                        cle.Add("@PRENOMS_PERSONNE"); val.Add(FirstNameTextBox.Text.Trim());
                        cle.Add("@USERNAME"); val.Add(RegisterUserNameTextBox.Text.Trim());
                        cle.Add("@SITE_ID"); val.Add(1);
                        cle.Add("@CONFIRMA"); val.Add("");
                        //cle.Add("@ACTIVATIONCODE");val.Add(activationCode);
                        cle.Add("@EMAIL"); val.Add(EmailTextBox.Text.Trim());
                        cle.Add("@SENDER"); val.Add(2);

                        Cl_Fonction.Extraction_ds("PS_USERCONFIRM", cle, val);

                        MembershipUser u = Membership.CreateUser(RegisterUserNameTextBox.Text.Trim(), ConfirmPasswordButtonEdit.Text, EmailTextBox.Text.Trim());

                        //SendActivationEmail(activationCode, txtEmail.Text.Trim());

                        ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Enregistrement effectué avec succès! Veuillez consulter l'administrateur pour accéder à la solution');", true);

                        Response.Redirect("~/");
                    }
                    else
                    {
                        EmailTextBox.ValidationSettings.ErrorText = "Veuillez SVP saisir une adresse mail valide";
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
                //ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Echec de l'enregistrement !');", true);
            }
        }
Ejemplo n.º 2
0
    //AJOUTER

    protected void Enregistrer(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        string libelle     = Cl_Fonction.GetStringTxt("lib", GridView);
        string observation = Cl_Fonction.GetStringMemo("com", GridView);


        if (Cl_Fonction.Verification_Code("Daf.TYPE_RESSOURCES", "LIBELLE", libelle.ToLower()))
        {
            GridView.JSProperties["cpShowPopup"] = "Caution";
            e.Cancel = true;
        }
        else
        {
            try
            {
                ArrayList cle = new ArrayList();
                ArrayList val = new ArrayList();

                cle.Add("@INDEX");
                val.Add("1");

                cle.Add("@ID");
                val.Add("0");

                cle.Add("@COMMENTAIRE");
                val.Add(observation);

                cle.Add("@LIBELLE");
                val.Add(libelle);

                cle.Add("@DATE");
                val.Add(DateTime.Now);

                cle.Add("@USER");
                val.Add(AuthHelper.GetLoggedInUserInfo().UserName.ToString());

                Cl_Fonction.Execute_Commande_StoreProc("PS_PARAMETRE_UPLOAD", cle, val);
                GridView.JSProperties["cpShowPopup"] = "Success";
                e.Cancel = true;
                GridView.CancelEdit();
                chargerGrid();
            }
            catch (Exception ex)
            {
                e.Cancel = true;

                GridView.JSProperties["cpShowPopup"] = "Error";
            }
        }
    }