Exemplo n.º 1
0
        private void successPersisted(string supplmentmessage, ServiceUsers updateUser)
        {
            if (supplmentmessage == null)
                supplmentmessage = "<span style=\"color:PaleGreen \">The user was sucessfully " + actiontext + ".</span>";
            else
                supplmentmessage = "<span style=\"color:Maroon\">" + supplmentmessage + ".</span>";
            SessionInfo info = new SessionInfo();
            string hostnameSession = null;
            string confignameSession = null;
            info.getHostNameConfigName(out hostnameSession, out confignameSession);
            if (oldUser != null && oldUser.UserKey == user.UserKey && (hostnameSession.Equals(hostNameIdentifier) && confignameSession.Equals(configName)))
            {
                string addressSes = null;
                string IDSes = null;
                ServiceUsers csUserSes = null;
                string confignameSes = null;
                string hosterSes = null;
                string versionSes = null;
                string platformSes = null;
                string clientSession = null;
                string nameSes = null;
                info.getSessionData(false, out addressSes, out csUserSes, out clientSession, out nameSes, out confignameSes, out hosterSes, out versionSes, out platformSes, out IDSes);
                HttpCookie cookie = info.setSessionData(addressSes, updateUser, clientSession, nameSes, confignameSes, hosterSes, versionSes, platformSes,IDSes);
                Response.Cookies.Remove(cookie.Name);
                Response.Cookies.Add(cookie);
                user = updateUser;
            }
            userList = configProxy.getServiceUsers(hostNameIdentifier, configName, traversePath, user);
            if (userList == null)
                Response.Redirect(ConfigSettings.PAGE_NODES, true);
            if (action.Equals(ConfigUtility.ADD_USER))
                thisUser = userList.Find(delegate(ServiceUsers userExist) { return userExist.UserId.ToLower().Equals(updateUser.UserId.ToLower()) && userExist.LocalUser == updateUser.LocalUser && userExist.Password.Equals(updateUser.Password); });
            else
                if (action.Equals(ConfigUtility.UPDATE_USER))
                    thisUser = userList.Find(delegate(ServiceUsers userExist) { return userExist.UserKey == thisUser.UserKey; });
            UpdateMessage.Text = supplmentmessage;
            if (action == ConfigUtility.REMOVE_USER && !oldUser.LocalUser)
                UpdateMessage.Text = UpdateMessage.Text + "<br>Note that all Connected Service Definitions and corresponding active Connection Point instances associated with the Connected Service user have also been removed from the configuration database.";
            ViewState["thisUser"] = thisUser;
            ViewState["oldUser"] = thisUser;
            ViewState["identify"] = thisUser.UserKey.ToString();
            if (action.Equals(ConfigUtility.ADD_USER))
            {
                Add.Enabled = false;
                Update.Enabled = true;
                Delete.Enabled = true;
            }
            if (action.Equals(ConfigUtility.REMOVE_USER))
            {
                Add.Enabled = false;
                Update.Enabled = false;
                Delete.Enabled = false;
            }
            ViewState["userList"] = userList;
            action = ConfigUtility.UPDATE_USER;
            ViewState["action"] = action;
            ViewState["CompositeServiceData"] = null;

        }