Exemplo n.º 1
0
    private void showUSERINFOData()
    {
        int userInfoID = 0;

        userInfoID = selecetedGridRow();
        USERINFO uSERINFO = new USERINFO();

        uSERINFO = USERINFOManager.GetUSERINFOByID(userInfoID);

        lblUserInfoID.Text = userInfoID.ToString();


        txtUserName.Text = uSERINFO.UserName;
        ddlAgent_Location.SelectedValue = uSERINFO.Agent_LocationID.ToString();
        txtFirstName.Text         = uSERINFO.FirstName;
        txtLastName.Text          = uSERINFO.LastName;
        txtMiddleName.Text        = uSERINFO.MiddleName;
        txtAddress.Text           = uSERINFO.Address;
        txtCity.Text              = uSERINFO.City;
        txtState.Text             = uSERINFO.State;
        txtCountry.Text           = uSERINFO.Country;
        txtPostalCode.Text        = uSERINFO.PostalCode;
        txtHomePhone.Text         = uSERINFO.HomePhone;
        txtWorkPhone.Text         = uSERINFO.WorkPhone;
        txtMobile.Text            = uSERINFO.Mobile;
        ddlUserType.SelectedValue = uSERINFO.Type.ToString();

        MembershipUser mu = Membership.GetUser(uSERINFO.UserName);

        if (mu != null)
        {
            lblPassword.Text = mu.GetPassword().ToString();

            txtEmail.Text     = mu.Email.ToString();
            chkActive.Checked = !mu.IsLockedOut;
        }
    }
Exemplo n.º 2
0
    protected void UpdateUserInfo()
    {
        int userInfoID = 0;

        userInfoID = selecetedGridRow();



        USERINFO uSERINFO = new USERINFO();

        uSERINFO = USERINFOManager.GetUSERINFOByID(userInfoID);
        USERINFO tempUSERINFO = new USERINFO();

        tempUSERINFO.USERINFOID = uSERINFO.USERINFOID;


        tempUSERINFO.AddedDate        = uSERINFO.AddedDate;
        tempUSERINFO.AddedBy          = User.Identity.Name.ToString();
        tempUSERINFO.ModifyDate       = DateTime.Now;
        tempUSERINFO.ModifyBy         = User.Identity.Name.ToString();
        tempUSERINFO.Type             = ddlUserType.SelectedItem.Value.ToString();
        tempUSERINFO.UserName         = uSERINFO.UserName;
        tempUSERINFO.Agent_LocationID = Int32.Parse(ddlAgent_Location.SelectedValue);
        tempUSERINFO.FirstName        = txtFirstName.Text;
        tempUSERINFO.LastName         = txtLastName.Text;
        tempUSERINFO.MiddleName       = txtMiddleName.Text;
        tempUSERINFO.Address          = txtAddress.Text;
        tempUSERINFO.City             = txtCity.Text;
        tempUSERINFO.State            = txtState.Text;
        tempUSERINFO.Country          = txtCountry.Text;
        tempUSERINFO.PostalCode       = txtPostalCode.Text;
        tempUSERINFO.ExpDate          = DateTime.Now;
        tempUSERINFO.Status           = 1;
        tempUSERINFO.HomePhone        = txtHomePhone.Text;
        tempUSERINFO.WorkPhone        = txtWorkPhone.Text;
        tempUSERINFO.Mobile           = txtMobile.Text;
        tempUSERINFO.Comm             = "";
        bool result = USERINFOManager.UpdateUSERINFO(tempUSERINFO);



        MembershipUser mu = Membership.GetUser(uSERINFO.UserName);

        if (mu != null)
        {
            if (txtPassword.Text == "" && txtConfirmPassword.Text == "")
            {
            }

            else
            {
                if (lblPassword.Text != "")
                {
                    mu.ChangePassword(lblPassword.Text, txtPassword.Text);
                }
            }

            mu.Email = txtEmail.Text;
            Membership.UpdateUser(mu);

            MSSQL.SQLExec("update aspnet_Membership set IsLockedOut=" + (chkActive.Checked ? "0" : "1") + " where UserId=(SELECT [UserId] FROM [aspnet_Users] where [UserName]='" + mu.UserName + "')");
        }
    }