private void Window_Loaded(object sender, RoutedEventArgs e) { //在窗体加载时触发,窗体还不显示任何东西 //窗口载入 Account_grade.Text = AccountGrade.GetDescription(UserClient.UserAccount.Grade); Account_factory.Text = UserClient.UserAccount.Factory; Account_register.Text = UserClient.UserAccount.RegisterTime.ToString(); Account_last.Text = UserClient.UserAccount.LastLoginTime.ToString(); Account_times.Text = UserClient.UserAccount.LoginFrequency.ToString(); Account_address.Text = UserClient.UserAccount.LastLoginIpAddress; //状态栏设置 TextBlock_CopyRight.Text = $"本软件著作权归{SoftResources.StringResouce.SoftCopyRight}所有"; //绑定事件,仅执行一次,不能放到show方法里 net_socket_client.MessageAlerts += Net_socket_client_MessageAlerts; net_socket_client.LoginFailed += Net_socket_client_LoginFailed; net_socket_client.LoginSuccess += Net_socket_client_LoginSuccess; net_socket_client.AcceptByte += Net_socket_client_AcceptByte; net_socket_client.AcceptString += Net_socket_client_AcceptString; TextBlock_Announcement.Text = UserClient.Announcement; TextBlock_Version.Text = UserClient.CurrentVersion.ToString(); //初始化窗口 MainRenderInitialization(); //加载主题 new PaletteHelper().SetLightDark(UserClient.JsonSettings.IsThemeDark); }
public void Query(int userId) { //var request = new MemberRecommendLogRequest(); //request.salerId = userId; //request.PageSize = 1000; var account = AccountService.GetByUserId(userId); var query = RecommendLogService.GetList(account.accountId); if (query != null) { RecommendLogs.List = query.Select(x => new PromotionModel() { Name = x.DisplayName, value = x.grade.ToString(), tj = x.tj }).ToList(); //Page(request.PageIndex, request.PageSize, query.TotalCount, RecommendLogs); } presentExp = account.presentExp; activatePoint = account.activatePoint; grade = AccountGrade.GetName(account.grade); withdrawPoint = WithdrawService.GetUserIdPoint(account.userId); var query1 = RebateLogService.GetRebateLog(account.accountId); if (query1 != null) { PointLogs.List = query1.Select(x => new PromotionModel() { value = x.reateAmount.ToString(), submitTime = x.submitTime.ToString(), Name = string.Format("来自{0}的会员佣金", x.userId), type = "分享佣金" //x.type == RebateType.zero ? "" : x.type == RebateType.tj ? "推荐会员分享奖励" : x.type == RebateType.gw ? "推荐会员购物奖励" : "" }).ToList(); // Page(request1.PageIndex, request1.PageSize, query1.TotalCount, PointLogs); } }
private void FormMainWindow_Load(object sender, EventArgs e) { // udp测试 // SendServerUdpData(0, "载入了窗体"); //窗口载入 label_userName.Text = UserClient.UserAccount.UserName; label_grade.Text = AccountGrade.GetDescription(UserClient.UserAccount.Grade); label_factory.Text = UserClient.UserAccount.Factory; label_register.Text = UserClient.UserAccount.RegisterTime.ToString(); label_last.Text = UserClient.UserAccount.LastLoginTime.ToString(); label_times.Text = UserClient.UserAccount.LoginFrequency.ToString(); label_address.Text = UserClient.UserAccount.LastLoginIpAddress; // 状态栏设置 toolStripStatusLabel_time.Alignment = ToolStripItemAlignment.Right; statusStrip1.LayoutStyle = ToolStripLayoutStyle.StackWithOverflow; toolStripStatusLabel1.Text = $"本软件著作权归{SoftResources.StringResouce.SoftCopyRight}所有"; // 绑定事件,仅执行一次,不能放到show方法里 net_socket_client.MessageAlerts += Net_socket_client_MessageAlerts; net_socket_client.LoginFailed += Net_socket_client_LoginFailed; net_socket_client.LoginSuccess += Net_socket_client_LoginSuccess; net_socket_client.AcceptByte += Net_socket_client_AcceptByte; net_socket_client.AcceptString += Net_socket_client_AcceptString; net_socket_client.BeforReConnected += Net_socket_client_BeforReConnected; // 显示公告 label_Announcement.Text = UserClient.Announcement; // 显示版本 toolStripStatusLabel_Version.Text = UserClient.CurrentVersion.ToString(); //初始化窗口 MainRenderInitialization(); }
private void FormMainWindow_Load(object sender, EventArgs e) { //窗口载入 label_userName.Text = UserClient.UserAccount.UserName; label_grade.Text = AccountGrade.GetDescription(UserClient.UserAccount.Grade); label_factory.Text = UserClient.UserAccount.Factory; label_register.Text = UserClient.UserAccount.RegisterTime.ToString(); label_last.Text = UserClient.UserAccount.LastLoginTime.ToString(); label_times.Text = UserClient.UserAccount.LoginFrequency.ToString(); label_address.Text = UserClient.UserAccount.LastLoginIpAddress; label_group.Text = AccountGroup.GetAccountDescription(UserClient.UserAccount.GroupCode); //绑定事件,仅执行一次,不能放到show方法里 net_socket_client.MessageAlerts += Net_socket_client_MessageAlerts; net_socket_client.LoginFailed += Net_socket_client_LoginFailed; net_socket_client.LoginSuccess += Net_socket_client_LoginSuccess; net_socket_client.AcceptByte += Net_socket_client_AcceptByte; net_socket_client.AcceptString += Net_socket_client_AcceptString; //启动网络服务 Net_Socket_Client_Initialization(); label_Announcement.Text = UserClient.Announcement; toolStripStatusLabel1.Text = $"本软件著作权归{Resource.StringResouce.SoftCopyRight}所有"; toolStripStatusLabel_Version.Text = UserClient.CurrentVersion.ToString(); }
/// <inheritdoc/> public void OpenAccount(string owner, AccountGrade grade, IAccountIdGenerator generator) { if (string.IsNullOrWhiteSpace(owner)) { throw new ArgumentNullException(nameof(owner)); } if (!Enum.IsDefined(typeof(AccountGrade), grade)) { throw new ArgumentException($"Value '{grade}' is not defined."); } if (generator is null) { throw new ArgumentNullException(nameof(generator)); } var dto = new AccountDto() { Id = generator.GenerateGuidId(), Type = (int)grade, Owner = owner, Balance = 0, Bonus = 0, }; this.repository.AddRecord(dto); }
/// <inheritdoc/> public void SetGrade(Guid id, AccountGrade grade) { var dto = this.repository.GetRecord(id); dto.Type = (int)grade; this.repository.UpdateRecord(dto); }
private void FormRegisterAccount_Load(object sender, EventArgs e) { comboBox1.DataSource = AccountGrade.GetDescription(); comboBox2.DataSource = new string[] { "允许", "不允许" }; comboBox1.SelectedItem = AccountGrade.GetDescription(AccountGrade.Technology); comboBox2.SelectedItem = "允许"; textBox4.Text = (new UserAccount()).ForbidMessage; }
/// <summary> /// Initializes a new instance of the <see cref="Account"/> class. /// </summary> /// <param name="id">An account's ID.</param> /// <param name="grade">An account's grade.</param> /// <param name="owner">An account's owner.</param> /// <param name="balance">An account's current balance.</param> /// <param name="bonus">An account's current bonus value.</param> public Account(Guid id, AccountGrade grade, string owner, decimal balance, decimal bonus) { if (string.IsNullOrWhiteSpace(owner)) { throw new ArgumentNullException(nameof(owner)); } this.Id = id; this.Grade = grade; this.Owner = owner; this.Balance = balance; this.Bonus = bonus; }
public void Ready(int userId) { // Load(); var account = AccountService.GetByUserId(userId); if (account != null) { point = account.activatePoint; presentExp = account.presentExp; grade = AccountGrade.GetName(account.grade); } }
/// <inheritdoc/> public decimal CalculateWithdrawalCost(AccountGrade grade, decimal withdrawalAmount) { if (!Enum.IsDefined(typeof(AccountGrade), grade)) { throw new ArgumentException($"Grade value '{grade}' is not defined."); } if (!this.ruleSet.TryGetValue(grade, out var rules)) { throw new InvalidOperationException(); } return((withdrawalAmount * rules.Factor) * (rules.WithdrawalCharge * rules.Factor)); }
/// <inheritdoc/> public decimal CalculateDepositBonus(AccountGrade grade, decimal depositAmount) { if (!Enum.IsDefined(typeof(AccountGrade), grade)) { throw new ArgumentException($"Grade value '{grade}' is not defined."); } if (!this.ruleSet.TryGetValue(grade, out var rules)) { throw new InvalidOperationException(); } return((depositAmount * rules.Factor) * (rules.DepoistBonus * rules.Factor)); }
public void SaveRating(int grade, string reciverId) { var agV = _context.accountGrades.Where(a => a.RecieverID == reciverId && a.GiversID == _userManager.GetUserId(User)).FirstOrDefault(); if (agV == null) { AccountGrade ag = new AccountGrade { GiversID = _userManager.GetUserId(User), Givers = _context.profiles.Find(_userManager.GetUserId(User)), RecieverID = reciverId, Reciever = _context.profiles.Find(reciverId), Grade = grade }; _context.Add(ag); } else { agV.Grade = grade; } _context.SaveChanges(); }
private void AccountDetails_Shown(object sender, EventArgs e) { // 加载各种数据 textBox_Factory.Text = UserClient.UserAccount.Factory; textBox_GradeDescription.Text = AccountGrade.GetDescription(UserClient.UserAccount.Grade); textBox_LastLoginIpAddress.Text = UserClient.UserAccount.LastLoginIpAddress; textBox_LastLoginTime.Text = UserClient.UserAccount.LastLoginTime.ToString(); textBox_LastLoginWay.Text = UserClient.UserAccount.LastLoginWay; textBox_LoginEnable.Text = UserClient.UserAccount.LoginEnable ? "允许" : "禁止"; textBox_LoginFailedCount.Text = UserClient.UserAccount.LoginFailedCount.ToString(); textBox_LoginFrequency.Text = UserClient.UserAccount.LoginFrequency.ToString(); textBox_NameAlias.Text = UserClient.UserAccount.NameAlias; textBox_RegisterTime.Text = UserClient.UserAccount.RegisterTime.ToString(); textBox_UserName.Text = UserClient.UserAccount.UserName; // 加载头像 ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadPoolLoadLargePortrait), null); // 加载文件列表 DownloadUserFileNames(); // 本地化显示 UILocalization(); }