本文整理汇总了C#中WhiteCore.Modules.Web.WebInterface.UserFlagToType方法的典型用法代码示例。如果您正苦于以下问题:C# WebInterface.UserFlagToType方法的具体用法?C# WebInterface.UserFlagToType怎么用?C# WebInterface.UserFlagToType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WhiteCore.Modules.Web.WebInterface
的用法示例。
在下文中一共展示了WebInterface.UserFlagToType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Fill
public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
OSHttpResponse httpResponse, Dictionary<string, object> requestParameters,
ITranslator translator, out string response)
{
response = null;
var vars = new Dictionary<string, object>();
string error = "";
UUID userID = httpRequest.Query.ContainsKey("userid")
? UUID.Parse(httpRequest.Query["userid"].ToString())
: UUID.Parse(requestParameters["userid"].ToString());
IUserAccountService userService = webInterface.Registry.RequestModuleInterface<IUserAccountService>();
var agentService = Framework.Utilities.DataManager.RequestPlugin<IAgentConnector>();
UserAccount account = userService.GetUserAccount(null, userID);
IAgentInfo agent = agentService.GetAgent(userID);
if (agent == null)
error = "No agent information is available";
// Set user type
if (requestParameters.ContainsKey("Submit") &&
requestParameters["Submit"].ToString() == "SubmitSetUserType")
{
string UserType = requestParameters ["UserType"].ToString ();
int UserFlags = webInterface.UserTypeToUserFlags (UserType);
// set the user account type
account.UserFlags = UserFlags;
userService.StoreUserAccount (account);
if (agent != null)
{
agent.OtherAgentInformation ["UserFlags"] = UserFlags;
agentService.UpdateAgent (agent);
response = "User has been updated.";
} else
response = "Agent information is not available! Has the user logged in yet?";
IProfileConnector profileData =
Framework.Utilities.DataManager.RequestPlugin<IProfileConnector>();
if (profileData != null)
{
IUserProfileInfo profile = profileData.GetUserProfile (userID);
if (profile == null)
{
profileData.CreateNewProfile (userID);
profile = profileData.GetUserProfile (userID);
}
profile.MembershipGroup = webInterface.UserFlagToType (UserFlags, webInterface.EnglishTranslator); // membership is english
profileData.UpdateUserProfile (profile);
}
response = "User has been updated.";
return null;
}
// Password change
if (requestParameters.ContainsKey("Submit") &&
requestParameters["Submit"].ToString() == "SubmitPasswordChange")
{
string password = requestParameters["password"].ToString();
string passwordconf = requestParameters["passwordconf"].ToString();
if (password != passwordconf)
response = "Passwords do not match";
else
{
IAuthenticationService authService =
webInterface.Registry.RequestModuleInterface<IAuthenticationService>();
if (authService != null)
response = authService.SetPassword(userID, "UserAccount", password)
? "Successfully set password"
: "Failed to set your password, try again later";
else
response = "No authentication service was available to change your password";
}
return null;
}
// Email change
if (requestParameters.ContainsKey("Submit") &&
requestParameters["Submit"].ToString() == "SubmitEmailChange")
{
string email = requestParameters["email"].ToString();
if (userService != null)
{
account.Email = email;
userService.StoreUserAccount(account);
response = "Successfully updated email";
}
else
response = "No authentication service was available to change your password";
return null;
}
// Delete user
//.........这里部分代码省略.........
示例2: Fill
//.........这里部分代码省略.........
/*if (activationRequired)
{
UUID activationToken = UUID.Random();
agent.OtherAgentInformation["WebUIActivationToken"] = Util.Md5Hash(activationToken.ToString() + ":" + PasswordHash);
resp["WebUIActivationToken"] = activationToken;
}*/
con.UpdateAgent (agent);
// create user profile details
IProfileConnector profileData =
Framework.Utilities.DataManager.RequestPlugin<IProfileConnector> ();
if (profileData != null)
{
IUserProfileInfo profile = profileData.GetUserProfile (userID);
if (profile == null)
{
profileData.CreateNewProfile (userID);
profile = profileData.GetUserProfile (userID);
}
if (AvatarArchive != "")
{
profile.AArchiveName = AvatarArchive;
List<AvatarArchive> avarchives = webInterface.Registry.RequestModuleInterface<IAvatarAppearanceArchiver>().GetAvatarArchives();
UUID snapshotUUID = UUID.Zero;
foreach (var archive in avarchives)
if (archive.FolderName == AvatarArchive)
snapshotUUID = archive.Snapshot;
if (snapshotUUID != UUID.Zero)
profile.Image = snapshotUUID;
}
profile.MembershipGroup = webInterface.UserFlagToType (UserFlags, webInterface.EnglishTranslator); // membership is english
profile.IsNewUser = true;
profileData.UpdateUserProfile (profile);
}
IAgentInfoService agentInfoService = webInterface.Registry.RequestModuleInterface<IAgentInfoService> ();
Vector3 position = new Vector3 (128, 128, 25);
Vector3 lookAt = new Vector3 (0, 0, 22);
if (agentInfoService != null)
agentInfoService.SetHomePosition (userID.ToString (), (UUID) UserHomeRegion, position, lookAt);
vars.Add ("ErrorMessage", "Successfully created account, redirecting to main page");
response = "<h3>Successfully created account, redirecting to main page</h3>" +
"<script language=\"javascript\">" +
"setTimeout(function() {window.location.href = \"index.html\";}, 3000);" +
"</script>";
} else
{
vars.Add ("ErrorMessage", "<h3>" + error + "</h3>");
response = "<h3>" + error + "</h3>";
}
}
else
response = "<h3>You did not accept the Terms of Service agreement.</h3>";
return null;
}
List<Dictionary<string, object>> daysArgs = new List<Dictionary<string, object>>();
for (int i = 1; i <= 31; i++)
daysArgs.Add(new Dictionary<string, object> {{"Value", i}});
List<Dictionary<string, object>> monthsArgs = new List<Dictionary<string, object>>();
示例3: Fill
//.........这里部分代码省略.........
// create and save agent info
IAgentConnector con = Framework.Utilities.DataManager.RequestPlugin<IAgentConnector>();
con.CreateNewAgent(userID);
IAgentInfo agent = con.GetAgent(userID);
agent.OtherAgentInformation ["RLFirstName"] = FirstName;
agent.OtherAgentInformation ["RLLastName"] = LastName;
//agent.OtherAgentInformation ["RLAddress"] = UserAddress;
agent.OtherAgentInformation ["RLCity"] = UserCity;
//agent.OtherAgentInformation ["RLZip"] = UserZip;
agent.OtherAgentInformation ["UserDOBMonth"] = UserDOBMonth;
agent.OtherAgentInformation ["UserDOBDay"] = UserDOBDay;
agent.OtherAgentInformation ["UserDOBYear"] = UserDOBYear;
agent.OtherAgentInformation ["UserFlags"] = UserFlags;
/*if (activationRequired)
{
UUID activationToken = UUID.Random();
agent.OtherAgentInformation["WebUIActivationToken"] = Util.Md5Hash(activationToken.ToString() + ":" + PasswordHash);
resp["WebUIActivationToken"] = activationToken;
}*/
con.UpdateAgent(agent);
// create user profile details
IProfileConnector profileData =
Framework.Utilities.DataManager.RequestPlugin<IProfileConnector>();
if (profileData != null)
{
profileData.CreateNewProfile (userID);
IUserProfileInfo profile = profileData.GetUserProfile (userID);
if (AvatarArchive != "")
profile.AArchiveName = AvatarArchive;
profile.MembershipGroup = webInterface.UserFlagToType (UserFlags, webInterface.EnglishTranslator); // membership is english
profile.IsNewUser = true;
profileData.UpdateUserProfile (profile);
}
response = "<h3>Successfully created account, redirecting to main page</h3>" +
"<script language=\"javascript\">" +
"setTimeout(function() {window.location.href = \"index.html\";}, 3000);" +
"</script>";
}
else
response = "<h3>" + error + "</h3>";
}
else
response = "<h3>You did not accept the Terms of Service agreement.</h3>";
return null;
}
List<Dictionary<string, object>> daysArgs = new List<Dictionary<string, object>>();
for (int i = 1; i <= 31; i++)
daysArgs.Add(new Dictionary<string, object> {{"Value", i}});
List<Dictionary<string, object>> monthsArgs = new List<Dictionary<string, object>>();
//for (int i = 1; i <= 12; i++)
// monthsArgs.Add(new Dictionary<string, object> {{"Value", i}});
monthsArgs.Add(new Dictionary<string, object> {{"Value", translator.GetTranslatedString("Jan_Short")}});
monthsArgs.Add(new Dictionary<string, object> {{"Value", translator.GetTranslatedString("Feb_Short")}});
monthsArgs.Add(new Dictionary<string, object> {{"Value", translator.GetTranslatedString("Mar_Short")}});
monthsArgs.Add(new Dictionary<string, object> {{"Value", translator.GetTranslatedString("Apr_Short")}});
monthsArgs.Add(new Dictionary<string, object> {{"Value", translator.GetTranslatedString("May_Short")}});
monthsArgs.Add(new Dictionary<string, object> {{"Value", translator.GetTranslatedString("Jun_Short")}});
monthsArgs.Add(new Dictionary<string, object> {{"Value", translator.GetTranslatedString("Jul_Short")}});