/// <summary>
 /// this is used to update the user credential info   //swaraj on 18 feb 2010
 /// </summary>
 public void update()
 {
     try
     {
         //update membership information of user
         objMembershipUser = Membership.GetUser(User.Identity.Name);
         objMembershipUser.Email = txtEmail.Text;
         Membership.UpdateUser(objMembershipUser);
         if (!User.IsInRole("user"))
         {
             //update profile information of user
             objProfileBase = ProfileBase.Create(User.Identity.Name, true);
             objProfileBase.SetPropertyValue("FName", txtFirstname.Text);
             objProfileBase.SetPropertyValue("LName", txtLastname.Text);
             objProfileBase.SetPropertyValue("MobilePhone", txtMobilePhone.Text);
             objProfileBase.SetPropertyValue("Fax", txtFax.Text);
             objProfileBase.SetPropertyValue("Address", txtAddress.Text);
             objProfileBase.SetPropertyValue("ModifiedBy", User.Identity.Name);
             objProfileBase.SetPropertyValue("PostalCode", txtPostalCode.Text);
             objProfileBase.SetPropertyValue("State", txtState.Text);
             objProfileBase.SetPropertyValue("Country", txtCountry.Text);
             objProfileBase.SetPropertyValue("Fax", txtFax.Text);
             objProfileBase.SetPropertyValue("WorkPhone", txtWorkPhone.Text);
             objProfileBase.SetPropertyValue("HomePhone", txtHomePhone.Text);
             objProfileBase.Save();
         }
         else
         {
             UserInfoPrimaryKey objUserInfoPrimaryKey = new UserInfoPrimaryKey(objMembershipUser.ProviderUserKey.ToString());
             userInfo = UserInfo.SelectOne(objUserInfoPrimaryKey, ConnectionString);
             userInfo.UserName = txtUsername.Text;
             userInfo.FirstName = txtFirstname.Text;
             userInfo.LastName = txtLastname.Text;
             userInfo.Address1 = txtAddress.Text;
             userInfo.WorkPhone = txtWorkPhone.Text;
             userInfo.CellPhone = txtMobilePhone.Text;
             userInfo.State = txtState.Text;
             userInfo.Country = txtCountry.Text;
             userInfo.PostalCode = txtPostalCode.Text;
             userInfo.EmailAddress = txtEmail.Text;
             userInfo.Fax = txtFax.Text;
             userInfo.HomePhone = txtHomePhone.Text;
             UserInfos objUserInfos = UserInfo.SelectByField("UserId", objMembershipUser.ProviderUserKey.ToString(), ConnectionString);
             if (objUserInfos.Count > 0)
             {
                 userInfo.ListTab = objUserInfos[0].ListTab;
                 userInfo.CampaignTab = objUserInfos[0].CampaignTab;
                 userInfo.AdvancedTab = objUserInfos[0].AdvancedTab;
                 userInfo.ReportsTab = objUserInfos[0].ReportsTab;
             }
             userInfo.UpdateUserDetails();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
        /// <summary>
        ///  To update the user
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbtnUpdateUser_Click(object sender, EventArgs e)
        {
            try
            {

                objMembershipUser = Membership.GetUser(txtUsername.Text);
                objMembershipUser.Email = txtEmail.Text;
                objMembershipUser.IsApproved = chkStatus.Checked;
                Membership.UpdateUser(objMembershipUser);

                UserInfoPrimaryKey objUserInfoPrimaryKey = new UserInfoPrimaryKey(objMembershipUser.ProviderUserKey.ToString());
                userInfo = UserInfo.SelectOne(objUserInfoPrimaryKey, ConnectionString);
                userInfo.UserName = txtUsername.Text;
                userInfo.FirstName = txtEFName.Text;
                userInfo.LastName = txtELName.Text;
                userInfo.Address1 = txtEAddress1.Text;
                userInfo.Address2 = txtEAddress2.Text;
                userInfo.WorkPhone = txtEWPhone.Text;
                userInfo.CellPhone = txtECellPhone.Text;
                userInfo.City = txtECity.Text;
                userInfo.State = txtEState.Text;
                userInfo.Country = txtECountry.Text;
                userInfo.PostalCode = txtEPCode.Text;
                userInfo.EmailAddress = txtEmail.Text;

                userInfo.ListTab = true;
                userInfo.CampaignTab = true;
                userInfo.AdvancedTab = true;

                userInfo.ReportsTab = false;
                userInfo.CampaignReportsTab = false;

                userInfo.UpdateUserDetails();
                fillGrid("");
                lblMainMsg.Text = string.Format("User: "******" updated successfully");
                lblMainMsg.Style.Add("color", "Green");
                txtEmail.Text = "";
            }
            catch (Exception ex)
            {
                lblEditPopupMsg.Style.Add("color", "Red");
                lblEditPopupMsg.Text = "Already existed Email";
                UpdateUserModalPopupExtender.Show();

            }
        }