Ejemplo n.º 1
0
 public ActionResult Change(ChangeAccountModel model)
 {
     if (ModelState.IsValid)
     {
         UserUpdateStatus status = UserService.UpdateAccount(model.Fullname, model.Email);
         if (status == UserUpdateStatus.Updated)
         {
             ShowMessage((L)"Account updated");
             return(Change());
         }
         else
         {
             ShowMessage((L)"No such user account", HtmlMessageType.Error);
         }
     }
     return(View(model));
 }
Ejemplo n.º 2
0
        protected void imgUserInfoSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (hdnEditUsername.Value != "")
                {
                    if (txtManageFirstName.Text != "" && txtManageLastName.Text != "" && txtManageEmail.Text != "")
                    {
                        MembershipUser member = Membership.GetUser(hdnEditUsername.Value);
                        member.Email = txtManageEmail.Text;

                        if (!EmailAddressExists(txtManageEmail.Text, m.RequireUniqueEmail))
                        {
                            UserInfo         user   = new UserInfo(Membership.ApplicationName, hdnEditUsername.Value, new Guid(hdnEditUserID.Value), txtManageFirstName.Text, txtManageLastName.Text, txtManageEmail.Text, GetPortalID, chkIsActive.Checked, GetUsername, GetStoreID);
                            UserUpdateStatus status = new UserUpdateStatus();
                            m.UpdateUser(user, out status);
                            if (status == UserUpdateStatus.DUPLICATE_EMAIL_NOT_ALLOWED)
                            {
                                ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserManagement", "EmailAddressAlreadyIsInUse"), "", SageMessageType.Alert);
                            }
                            else if (status == UserUpdateStatus.USER_UPDATE_SUCCESSFUL)
                            {
                                BindUsers(string.Empty);
                                if (user.IsActive)
                                {
                                    SendActivateMail(user);
                                }
                                ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserManagement", "UserInformationSaveSuccessfully"), "", SageMessageType.Success);
                            }
                        }
                        else
                        {
                            ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserManagement", "EmailAddressAlreadyIsInUse"), "", SageMessageType.Alert);
                        }
                    }
                    else
                    {
                        ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserManagement", "PleaseEnterTheRequiredFields"), "", SageMessageType.Alert);
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Connect to database and update user.
        /// </summary>
        /// <param name="user">Object of UserInfo class.</param>
        /// <param name="status">User creation status. <see cref="T:SageFrame.Security.Helpers.UserCreationStatus"/></param>
        /// <returns>True for update sucessfully. </returns>
        public static bool UpdateUser(UserInfo obj, out UserUpdateStatus status)
        {
            string sp = "[dbo].[usp_sf_UsersUpdate]";

            try
            {
                List <KeyValuePair <string, object> > ParamCollInput = new List <KeyValuePair <string, object> >();
                ParamCollInput.Add(new KeyValuePair <string, object>("@ApplicationName", obj.ApplicationName));
                ParamCollInput.Add(new KeyValuePair <string, object>("@UserName", obj.UserName));
                ParamCollInput.Add(new KeyValuePair <string, object>("@UserID", obj.UserID));
                ParamCollInput.Add(new KeyValuePair <string, object>("@FirstName", obj.FirstName));
                ParamCollInput.Add(new KeyValuePair <string, object>("@LastName", obj.LastName));
                ParamCollInput.Add(new KeyValuePair <string, object>("@Email", obj.Email));
                ParamCollInput.Add(new KeyValuePair <string, object>("@PortalID", obj.PortalID));
                ParamCollInput.Add(new KeyValuePair <string, object>("@IsApproved", obj.IsApproved));
                ParamCollInput.Add(new KeyValuePair <string, object>("@UpdatedBy", obj.UpdatedBy));
                ParamCollInput.Add(new KeyValuePair <string, object>("@StoreID", obj.StoreID));

                List <KeyValuePair <string, object> > ParamCollOutput = new List <KeyValuePair <string, object> >();
                ParamCollOutput.Add(new KeyValuePair <string, object>("@ErrorCode", 0));

                SageFrameSQLHelper sagesql = new SageFrameSQLHelper();

                List <KeyValuePair <int, string> > OutputValColl = new List <KeyValuePair <int, string> >();
                OutputValColl = sagesql.ExecuteNonQueryWithMultipleOutput(sp, ParamCollInput, ParamCollOutput);

                int ErrorCode = int.Parse(OutputValColl[0].Value);

                switch (ErrorCode)
                {
                case 1:
                    status = UserUpdateStatus.DUPLICATE_EMAIL_NOT_ALLOWED;
                    break;

                default:
                    status = UserUpdateStatus.USER_UPDATE_SUCCESSFUL;
                    break;
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
        protected void imgUserInfoSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (hdnEditUsername.Value != "")
                {
                    if (txtManageFirstName.Text != "" && txtManageLastName.Text != "" && txtManageEmail.Text != "")
                    {
                        MembershipUser member = Membership.GetUser(hdnEditUsername.Value);
                        member.Email = txtManageEmail.Text;
                        
                        if (!EmailAddressExists(txtManageEmail.Text,m.RequireUniqueEmail))
                        {
                            UserInfo user = new UserInfo(Membership.ApplicationName, hdnEditUsername.Value,new Guid(hdnEditUserID.Value), txtManageFirstName.Text,txtManageLastName.Text, txtManageEmail.Text, GetPortalID,chkIsActive.Checked, GetUsername, GetStoreID);
                            UserUpdateStatus status=new UserUpdateStatus();
                            m.UpdateUser(user, out status);
                            if (status == UserUpdateStatus.DUPLICATE_EMAIL_NOT_ALLOWED)
                            {
                                ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserManagement", "EmailAddressAlreadyIsInUse"), "", SageMessageType.Alert);
                                
                            }
                            else if (status == UserUpdateStatus.USER_UPDATE_SUCCESSFUL)
                            {
                                BindUsers(string.Empty);
                                if(user.IsActive)
                                {
                                    SendActivateMail(user);
                                }
                                ShowMessage(SageMessageTitle.Notification.ToString(),GetSageMessage("UserManagement", "UserInformationSaveSuccessfully"), "",SageMessageType.Success);
                            }
                            
                        }
                        else
                        {
                            ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserManagement", "EmailAddressAlreadyIsInUse"), "", SageMessageType.Alert);

                        }
                    }
                    else
                    {
                      ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserManagement", "PleaseEnterTheRequiredFields"), "", SageMessageType.Alert);
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Ejemplo n.º 5
0
        public static bool UpdateUser(UserInfo obj, out UserUpdateStatus status)
        {
            string sp = "[dbo].[usp_sf_UsersUpdate]";
            try
            {
                List<KeyValuePair<string, object>> ParamCollInput = new List<KeyValuePair<string, object>>();
                ParamCollInput.Add(new KeyValuePair<string, object>("@ApplicationName", obj.ApplicationName));
                ParamCollInput.Add(new KeyValuePair<string, object>("@UserName", obj.UserName));
                ParamCollInput.Add(new KeyValuePair<string, object>("@UserID", obj.UserID));
                ParamCollInput.Add(new KeyValuePair<string, object>("@FirstName", obj.FirstName));
                ParamCollInput.Add(new KeyValuePair<string, object>("@LastName", obj.LastName));
                ParamCollInput.Add(new KeyValuePair<string, object>("@Email", obj.Email));
                ParamCollInput.Add(new KeyValuePair<string, object>("@PortalID", obj.PortalID));
                ParamCollInput.Add(new KeyValuePair<string, object>("@IsApproved", obj.IsApproved));
                ParamCollInput.Add(new KeyValuePair<string, object>("@UpdatedBy", obj.UpdatedBy));
                ParamCollInput.Add(new KeyValuePair<string, object>("@StoreID", obj.StoreID));

                List<KeyValuePair<string, object>> ParamCollOutput = new List<KeyValuePair<string, object>>();
                ParamCollOutput.Add(new KeyValuePair<string, object>("@ErrorCode", 0));

                SageFrameSQLHelper sagesql = new SageFrameSQLHelper();

                List<KeyValuePair<int, string>> OutputValColl = new List<KeyValuePair<int, string>>();
                OutputValColl = sagesql.ExecuteNonQueryWithMultipleOutput(sp, ParamCollInput, ParamCollOutput);

                int ErrorCode = int.Parse(OutputValColl[0].Value);

                switch (ErrorCode)
                {
                    case 1:
                        status = UserUpdateStatus.DUPLICATE_EMAIL_NOT_ALLOWED;
                        break;
                    default:
                        status = UserUpdateStatus.USER_UPDATE_SUCCESSFUL;
                        break;
                }
                return true;
            }
            catch (Exception)
            {
                throw;
            }


        }
Ejemplo n.º 6
0
 public abstract bool UpdateUser(UserInfo user, out UserUpdateStatus status);
 public abstract bool UpdateUser(UserInfo user, out UserUpdateStatus status);