本文整理汇总了C#中UserAccount类的典型用法代码示例。如果您正苦于以下问题:C# UserAccount类的具体用法?C# UserAccount怎么用?C# UserAccount使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserAccount类属于命名空间,在下文中一共展示了UserAccount类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connect
public Task Connect()
{
UserAccount ua = new UserAccount(Context.User.Identity.Name);
ChatRoomUser cru = new ChatRoomUser();
cru.GetChatRoomUserByUserAccountID(ua.UserAccountID);
if (cru.ChatRoomUserID == 0)
{
cru.CreatedByUserID = ua.UserAccountID;
cru.ConnectionCode = Context.ConnectionId;
cru.Create();
}
else
{
cru.ConnectionCode = Context.ConnectionId;
cru.UpdatedByUserID = ua.UserAccountID;
cru.Update();
}
Send(@"<i style=""color:yellow;font-size:10px;font-style: italic;"">CONNECTION OPENED</i>", ua.UserAccountID);
return Clients.joined(Context.ConnectionId, DateTime.UtcNow.ToString());
}
示例2: UpdateFrom
/// <summary>
/// Updates session from DB object
/// </summary>
/// <param name="user"></param>
public void UpdateFrom(UserAccount user)
{
UpdatedOn = DateTime.UtcNow;
UserId = user.Id;
OnUpdate(user);
}
示例3: GetUsersInRole
public static UserAccounts GetUsersInRole(int roleID)
{
UserAccounts uars = null;
// get a configured DbCommand object
DbCommand comm = DbAct.CreateCommand();
// set the stored procedure name
comm.CommandText = "up_GetUsersInRole";
ADOExtenstion.AddParameter(comm, "roleID", roleID);
// execute the stored procedure
DataTable dt = DbAct.ExecuteSelectCommand(comm);
// was something returned?
if (dt != null && dt.Rows.Count > 0)
{
uars = new UserAccounts();
UserAccount art = null;
foreach (DataRow dr in dt.Rows)
{
art = new UserAccount(dr);
uars.Add(art);
}
}
return uars;
}
示例4: CreateAccount
public UserCreateStatus CreateAccount(string username, string password, string fullname, string email)
{
bool exists = Repository.FirstOrDefault(u => u.LocalCredentials != null && u.LocalCredentials.Username == username) != null;
if (!exists)
{
if (!Validator.CheckPassword(password))
return UserCreateStatus.InsufficientPassword;
UserAccount user = new UserAccount
{
PublicIdentifier = HashHelper.ComputePublicIdentifier(typeof(UserAccount).Name, username),
LocalCredentials = new LocalCredentials
{
Username = username,
Password = HashHelper.ComputePassword(username, password)
},
Enabled = true,
Created = DateTime.Now,
Fullname = fullname,
Email = email,
UserRole = UserRole.User
};
Repository.Insert(user);
return UserCreateStatus.Created;
}
ActivityService.UserRegistered(username);
return UserCreateStatus.UsernameUsed;
}
示例5: ProfileController
public ProfileController(IMailService mail)
{
_mail = mail;
_mu = MembershipWrapper.GetUser();
if (_mu != null) _ua = new UserAccount(_mu.UserName);
}
示例6: SaveToken
private void SaveToken(string token, string shopName)
{
string isExistingShop = Request.QueryString["isES"];
// save token in database
DataModelEntities context = new DataModelEntities();
if (isExistingShop == "0") // new user
{
UserAccount userAccount = new UserAccount();
userAccount.User_Code = UserKey;
userAccount.Account_Code = (int)Constant.Accounts.Shopify;
userAccount.Application_Name = shopName;
userAccount.Config_Value1 = token;
userAccount.Created_Date = DateTime.Now;
userAccount.Is_Active = true;
context.UserAccounts.AddObject(userAccount);
}
else
{
UserAccount userAccount = context.UserAccounts.First(u => u.User_Code == UserKey && u.Is_Active == true && u.Account_Code == (int)Constant.Accounts.Shopify);
userAccount.Application_Name = shopName;
userAccount.Config_Value1 = token;
userAccount.Modified_Date = DateTime.Now;
userAccount.User_IP = Request.UserHostAddress;
}
context.SaveChanges();
context = null;
}
示例7: CallsUpdateOnRepository
public void CallsUpdateOnRepository()
{
var repo = new Mock<IUserAccountRepository>();
var sub = new UserAccountService(repo.Object, null, null);
var ua = new UserAccount();
sub.Update(ua);
repo.Verify(x => x.Update(ua));
}
示例8: Post
/// <summary>
/// Posts the specified user account.
/// </summary>
/// <param name="userAccount">The user account.</param>
/// <returns>
/// The Task.
/// </returns>
/// <remarks>
/// This operation allows to authenticate user account.
/// </remarks>
/// <response code="400">Bad request</response>
/// <response code="401">Unauthorized</response>
/// <response code="404">Account not found</response>
/// <response code="500">Internal Server Error</response>
/// <response code="200">Successful</response>
public async Task<IHttpActionResult> Post(UserAccount userAccount)
{
return await this.CreateAsync<User>(async operationResult =>
{
await this.AuthenticateUser(operationResult, userAccount);
return string.Empty;
});
}
示例9: Update
public void Update(UserAccount item)
{
var other = Get(item.ID);
if (other != item)
{
Remove(other);
Add(item);
}
}
示例10: OnUpdate
/// <summary>
/// TODO Update Custom Session fields here
/// </summary>
/// <param name="user"></param>
protected void OnUpdate(UserAccount user)
{
Email = user.Email;
if (user.UserFacebookClaims != null && user.UserFacebookClaims.Any())
{
var social = user.UserFacebookClaims.First();
FacebookId = social.Id;
}
}
示例11: btnSearch_Click
protected void btnSearch_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtSearch.Text))
{
ua = new UserAccount(txtSearch.Text);
LoadUserAddress(ua.UserAccountID);
}
}
示例12: CheckNewNotifications
public List<Notification> CheckNewNotifications(UserAccount user, bool isRead)
{
List<Notification> notificationList =
Translators.Notification.ToBusinessObject(
_dataAccessObjects.GetNotificationByJobRoleAndIsRead(
user.HighestPermission.ToString(), isRead));
return notificationList;
}
示例13: Validate
public ValidationResult Validate(UserAccountService service, UserAccount account, string value)
{
if (value.Length < 4)
{
return new ValidationResult("Password must be at least 4 characters long");
}
return null;
}
示例14: CheckAllNotifications
public List<Notification> CheckAllNotifications(UserAccount user)
{
List<Notification> notificationList =
Translators.Notification.ToBusinessObject(
_dataAccessObjects.GetNotificationByJobRole(
user.HighestPermission.ToString()));
return notificationList;
}
示例15: Register
public void Register(string account, string password)
{
var userAccount = new UserAccount();
userAccount.Account = account;
userAccount.Password = password.ToBinary();
userAccount.DelFlag = 0;
UserAccountDao.Save(userAccount);
}