Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    UserDetailPageManager ObjUserDetailPageManager = new UserDetailPageManager();
                    PopolaCboRoles(CboRoles, ObjUserDetailPageManager.GetRoles());
                    CboRoles.Items.Add(new ListItem("--Select--", "0"));

                    //aggiunge il tag script con il path del file jquery con la validazione della pagina nella masterpage
                    Literal LitPathFormScriptValidation = (Literal)Master.FindControl("LitPathFormScriptValidation");
                    LitPathFormScriptValidation.Text = "<script src='../js/UserDetail.js'></script>";


                    if (Request.QueryString["Id"] != null)
                    {
                        //siamo in modifica
                        Utente Usr = ObjUserDetailPageManager.GetUtente(Convert.ToInt32(Request.QueryString["Id"]));
                        LitUser.Text = "User " + Usr.lastName + " " + Usr.firstName;
                        ValorizzaForm(Usr);
                    }
                    else
                    {
                        //siamo in inserimento
                        LitUser.Text = "New user...";
                        ResettaForm();
                    }
                }
            }
            catch (Exception ex)
            {
                PrintError(ex);
            }
        }
Beispiel #2
0
        public Utente UpdateUser(int Id)
        {
            Utente result = null;

            UserDetailPageManager ObjUserDetailPageManager = new UserDetailPageManager();

            result = ObjUserDetailPageManager.GetUtente(Id);

            if (result != null)
            {
                result.firstName = TxtNomeUtente.Text;
                result.lastName  = TxtCognomeUtente.Text;
                result.roles     = new string[] { CboRoles.SelectedValue.ToString() };
                result.email     = TxtUsername.Text;
                // string PwdEncripted = Ls.Prj.Utility.SG.Algoritm.Cipher.Encrypt(TxtPassword.Text, Utility.GetPrivSimKey("CriptographyKey"));
                result.password = TxtPassword.Text;
                result.active   = Convert.ToBoolean(CboEnable.SelectedValue);
            }

            ObjUserDetailPageManager.UpdateUtente(result);
            return(result);
        }