コード例 #1
0
        /// <summary>
        /// 新增账单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string Add(AccountRecord model)
        {
            if (model == null)
            {
                return(string.Empty);
            }
            if (string.IsNullOrEmpty(model.AccountDescription))
            {
                model.AccountDescription = string.Format("{0}{1}", model.SpendTypeText, model.ProductName);
            }

            using (DbContext db = new CRDatabase())
            {
                CTMS_SYS_USERINFO user = db.Set <CTMS_SYS_USERINFO>().Find(model.UserID);
                if (model.Balance == -1 && model.Account > user.ACCOUNT)
                {
                    throw new Exception("余额不足!");
                }
                user.ACCOUNT        += model.Balance * model.Account;
                db.Entry(user).State = EntityState.Modified;
                //Todo 对应服务次数加1

                db.Set <CTMS_ACCOUNTRECORD>().Add(ModelToEntity(model));
                db.SaveChanges();
                return(model.ID);
            }
        }
コード例 #2
0
ファイル: AccountManager.cs プロジェクト: stweily/Encore
        public Account CreateAccount(string userName, string password, string email, ClientBoxLevel boxLevel = ClientBoxLevel.Cataclysm,
                                     ClientLocale locale = ClientLocale.English)
        {
            Contract.Requires(!string.IsNullOrEmpty(userName));
            Contract.Requires(userName.Length >= Constants.Accounts.MinNameLength);
            Contract.Requires(userName.Length <= Constants.Accounts.MaxNameLength);
            Contract.Requires(!string.IsNullOrEmpty(password));
            Contract.Requires(password.Length >= Constants.Accounts.MinPasswordLength);
            Contract.Requires(password.Length <= Constants.Accounts.MaxPasswordLength);
            Contract.Requires(!string.IsNullOrEmpty(email));
            Contract.Ensures(Contract.Result <Account>() != null);

            var pw   = CreatePassword(userName, password);
            var sha1 = pw.SHA1Password.GetBytes();

            Contract.Assume(sha1.Length == Password.SHA1Length);
            var sha256 = pw.SHA256Password.GetBytes();

            Contract.Assume(sha256.Length == Password.SHA256Length);

            var rec = new AccountRecord(userName, email, sha1, sha256, boxLevel, locale);

            rec.Create();

            var acc = new Account(rec);

            AddAccount(acc);
            return(acc);
        }
コード例 #3
0
        private async Task <ResultModel <string> > PayedByAccount(Payment payment, Thirdpay thirdpay)
        {
            var result  = new ResultModel <string>();
            var account = await dbContext.Account.FirstOrDefaultAsync(_ => _.Id == payment.Member_Id);

            if (account.Balance < payment.Amount)
            {
                result.Message = "您的余额不足";
                return(result);
            }

            payment.Account = (int)PaymentAccount.Account;
            payment.Status  = (int)PaymentStatus.Paid;
            var accountRecord = new AccountRecord
            {
                Amount    = payment.Amount,
                Member_Id = payment.Member_Id,
                Remark    = payment.Remark,
                Type      = (int)AccountRecordType.Payment
            };

            payment.Thirdpay_Id = thirdpay.Id;
            result.Data         = "支付成功";

            return(result);
        }
コード例 #4
0
    // UpdateAccountCoroutine
    IEnumerator IAccountOperations.UpdateAccountCoroutine(IAccount account, AccountUpdate update, Request <Account> request)
    {
        Request <AccountRecord> getAccountRequest;

        getAccountRequest = StorageLayerUtility.GetAccountRecord(account.id);
        yield return(getAccountRequest.WaitUntilDone()); if (StorageLayerUtility.RequestUtility.PropagateException(getAccountRequest, request))
        {
            yield break;
        }
        AccountRecord record = getAccountRequest.result;

        if (StorageLayerUtility.AccountUpdateUtility.isPasswordChanged(update))
        {
            record.passwordHash = SaltedPasswordHash.GenerateSaltedPasswordHash(SaltedPasswordHash.GeneratePasswordHash(StorageLayerUtility.AccountUpdateUtility.GetPassword(update) + record.name));
        }

        if (StorageLayerUtility.AccountUpdateUtility.IsDataChanged(update))
        {
            record.data = StorageLayerUtility.AccountUpdateUtility.GetData(update);
        }

        Account updatedAccount = StorageLayerUtility.CreateAccount(record);

        StorageLayerUtility.RequestUtility.SetResult(request, updatedAccount);
        yield break;
    }
コード例 #5
0
        // Check to see whether a username/password combination exists in the Account Database
        public AccountRecord LookUpAccountRecord(string userName, string password)
        {
            AccountRecord accountRecord = new AccountRecord();
            // Send a SQL query asking for a record that matches the Username in AccountRecord
            string     findCommandText = $"SELECT * FROM AccountTable WHERE Username = '******';";
            SqlCommand findCommand     = new SqlCommand(findCommandText, databaseConnection);

            try
            {
                // Read the account that matches the Username request
                using (SqlDataReader accountReader = findCommand.ExecuteReader())
                {
                    accountReader.Read();
                    // Store all account data from the acquired SQL record in the AccountRecord object
                    accountRecord.Username   = accountReader["Username"].ToString();
                    accountRecord.Salt       = accountReader["Salt"].ToString();
                    accountRecord.SaltedHash = accountReader["SaltedHash"].ToString();
                }
                accountRecord.ErrorString = "valid record";
                if (accountRecord.SaltedHash != GeneratePasswordHash(password, accountRecord.Salt))
                {
                    accountRecord             = new AccountRecord();
                    accountRecord.ErrorString = "password incorrect";
                }
            }
            catch (Exception e)
            {
                // If no record is found, return an empty object with error message labeled "No record found"
                accountRecord             = new AccountRecord();
                accountRecord.ErrorString = "no record found";
            }
            return(accountRecord);
        }
コード例 #6
0
        public async Task SaveOrUpdateAccountAsync(AccountRecord account)
        {
            var flags = new AccountFlagsOptions
            {
                IsUserAccount = true,
            };

            if (account.StorageId == null)
            {
                account.StorageId = new StorageId();
            }

            account.Timestamp = ConvertUtils.ConvertToUnixTime(DateTime.Now);

            await device.PasswordManager.SaveOrUpdateAccount(
                account.StorageId,
                account.Timestamp,
                account.Name,
                account.Password,
                account.Login,
                account.OtpSecret,
                account.Apps,
                account.Urls,
                account.IsPrimary,
                flags);
        }
コード例 #7
0
ファイル: MemberService.cs プロジェクト: mxcanfly/WYJK
        /// <summary>
        /// 获取账单记录
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public async Task <AccountRecord> GetAccountRecord(int ID)
        {
            string        sql   = $"select * from AccountRecord where ID={ID}";
            AccountRecord model = await DbHelper.QuerySingleAsync <AccountRecord>(sql);

            return(model);
        }
コード例 #8
0
        public static void Login(Client client, IdentificationMessage message)
        {
            if (message.version.ToString() != "2.0.0.0")
            {
                client.Send(new IdentificationFailedForBadVersionMessage((sbyte)IdentificationFailureReasonEnum.BAD_VERSION, new Protocol.Types.Version(2, 0, 0, 0)));
            }
            AccountRecord account = AccountRecord.ReturnAccount(message.login);

            if (account == null || Functions.CipherPassword(account.Password, client.Ticket) != message.password)
            {
                client.Send(new IdentificationFailedMessage((sbyte)IdentificationFailureReasonEnum.WRONG_CREDENTIALS));
            }
            else
            {
                if (account.BannedUntil > DateTime.Now)
                {
                    client.Send(new IdentificationFailedMessage((sbyte)IdentificationFailureReasonEnum.BANNED));
                }
                if (Server.Clients.Count(x => x.Account == account) > 1)
                {
                    Server.Clients.FirstOrDefault(x => x.Account == account).Disconnect();
                }
                client.Account = account;
                client.Send(new IdentificationSuccessMessage(account.HasRights, false, account.Nickname, 0, account.SecretQuestion, 42195168000000));
                client.Send(new ServersListMessage(new GameServerInformations[]
                {
                    new GameServerInformations(111, (sbyte)ServerStatusEnum.ONLINE, 0, true, (sbyte)CharacterRecord.ReturnCharacters(account.Id).Count())
                }));
            }
        }
コード例 #9
0
 // CopyAccountRecord
 public void CopyAccountRecord(AccountRecord account)
 {
     id           = account.id.value;
     name         = account.name;
     passwordHash = System.Convert.ToBase64String(account.passwordHash.passwordHash);
     salt         = System.Convert.ToBase64String(account.passwordHash.salt);
 }
コード例 #10
0
        public static void HandleNicknameChoiceRequestMessage(NicknameChoiceRequestMessage message, AuthClient client)
        {
            if (client.Account == null)
            {
                return;
            }
            if (client.Account.Username == message.nickname)
            {
                client.Send(new NicknameRefusedMessage((sbyte)NicknameErrorEnum.SAME_AS_LOGIN));
                return;
            }
            if (message.nickname == string.Empty || message.nickname.Length >= 15 || message.nickname.Contains('\''))
            {
                client.Send(new NicknameRefusedMessage((sbyte)NicknameErrorEnum.INVALID_NICK));
                return;
            }
            if (AccountRecord.NicknameExist(message.nickname))
            {
                client.Send(new NicknameRefusedMessage((sbyte)NicknameErrorEnum.ALREADY_USED));
                return;
            }

            client.Account.Nickname = message.nickname;

            AccountRecord.UpdateAccount(client.Account);
            client.Send(new NicknameAcceptedMessage());

            Login(client, false);
        }
コード例 #11
0
        public bool AddAccountRecord(AccountRecord accountRecord, string password)
        {
            // Make sure there is not an existing Username in Account Database
            AccountRecord existingAccountRecord = new AccountRecord();

            existingAccountRecord = LookUpAccountRecord(accountRecord.Username, null);
            if (existingAccountRecord.ErrorString != "no record found")
            {
                return(true);
            }
            else
            {
                // Generate a salt for the account
                accountRecord.Salt = GenerateSalt();
                // Generate Salted Hash from Password and Salt
                accountRecord.SaltedHash = GeneratePasswordHash(password, accountRecord.Salt);
                // build SQL Command String to send new record to SQL
                string insertCommandText = $"INSERT INTO AccountTable (Username, Salt, SaltedHash) " +
                                           $"VALUES ('{accountRecord.Username}','{accountRecord.Salt}','{accountRecord.SaltedHash}');";
                try
                {
                    ExecuteSqlSendCommand(insertCommandText);
                }
                catch (Exception e)
                {
                    //TODO: Determine whether any additional error reporting is necessary
                    return(true);
                }
                return(false);
            }
        }
コード例 #12
0
    public IEnumerator UpdateAccountCoroutine(uLobby.IAccount account, uLobby.AccountUpdate update, uLobby.Request <uLobby.Account> request)
    {
        Request <AccountRecord> getAccountRequest;

        getAccountRequest = StorageLayerUtility.GetAccountRecord(account.id);
        yield return(getAccountRequest.WaitUntilDone()); if (StorageLayerUtility.RequestUtility.PropagateException(getAccountRequest, request))
        {
            yield break;
        }
        AccountRecord record = getAccountRequest.result;

        if (StorageLayerUtility.AccountUpdateUtility.isPasswordChanged(update))
        {
            record.passwordHash = SaltedPasswordHash.GenerateSaltedPasswordHash(SaltedPasswordHash.GeneratePasswordHash(StorageLayerUtility.AccountUpdateUtility.GetPassword(update) + record.name));
        }
        if (StorageLayerUtility.AccountUpdateUtility.IsDataChanged(update))
        {
            record.data = StorageLayerUtility.AccountUpdateUtility.GetData(update);
        }
        MySqlParameter[] paramsArray = new MySqlParameter[4];
        paramsArray[0] = new MySqlParameter("password", record.passwordHash.passwordHash);
        paramsArray[1] = new MySqlParameter("salt", record.passwordHash.salt);
        paramsArray[2] = new MySqlParameter("data", record.data);
        paramsArray[3] = new MySqlParameter("id", int.Parse(record.id.value));
        var operation = ExecuteNonQueryAsync.BeginInvoke(storageManager.connectionString, "UPDATE accounts SET password=@password,salt=@salt,data=@data WHERE id = @id", paramsArray, null, null);

        while (!operation.IsCompleted)
        {
            yield return(null);
        }
        Account updatedAccount = StorageLayerUtility.CreateAccount(record);

        StorageLayerUtility.RequestUtility.SetResult(request, updatedAccount);
    }
コード例 #13
0
 public static void HandleAuthenticationTicketMessage(GameClient client, AuthenticationTicketMessage message)
 {
     if (message.ticket != string.Empty)
     {
         AccountRecord account = AccountRecord.ReturnAccountWithTicket(message.ticket);
         if (account != null)
         {
             client.Account = account;
             if (GameServer.Clients.Count(x => x.Account.Login == account.Login) > 1)
             {
                 GameServer.Clients.First(x => x.Account.Login == account.Login).Disconnect();
             }
             client.Account.Characters = CharacterRecord.ReturnCharacters(account.Id);
             client.Send(new AuthenticationTicketAcceptedMessage());
             BasicHandler.SendBasicTimeMessage(client);
         }
         else
         {
             client.Send(new AuthenticationTicketRefusedMessage());
         }
     }
     else
     {
         client.Send(new AuthenticationTicketRefusedMessage());
     }
 }
コード例 #14
0
        public void CreateAccount(string username, string password, RoleEnum role)
        {
            var account = new AccountRecord
            {
                Id                  = Accounts.DynamicPop(),
                Username            = username,
                Password            = password,
                Nickname            = username,
                Role                = role,
                BanEndTime          = DateTime.Now,
                CreationTime        = DateTime.Now,
                EndSubscriptionTime = DateTime.Now,
                CharacterSlots      = 0,
                HardwareId          = string.Empty,
                IsBanned            = false,
                IsBannedForLife     = false,
                IsConnected         = false,
                LastConnectionWorld = 0,
                LastIP              = string.Empty,
                SecretAnswer        = "Oui",
                SecretQuestion      = "Supprimer ce personnage ?",
                Ticket              = string.Empty,
                Tokens              = 0
            };

            account.AddInstantElement();

            _logger.LogInformation($"Account => Username = {account.Username} | Password = {account.Password} | Role = {account.Role}\n");
        }
コード例 #15
0
        public virtual async Task RenderListAsync(AccountRecord page, int pageIndex = 1)
        {
            try
            {
                var rows     = 20;
                var gteTime  = Convert.ToDateTime(page.DpStartTime.Text);
                var lteTime  = Convert.ToDateTime(page.DpEndTime.Text);
                var type     = (EnumAccountRecordType)Convert.ToInt32(((ComboBoxItem)page.CmbType.SelectedValue).Tag.ToString());
                var response = await _onMainHostRequestPlugins.QueryAccountRecorrdAsync(new AccountRecordRequest()
                {
                    Page        = pageIndex,
                    Rows        = rows,
                    Type        = (int)type,
                    GteTime     = gteTime,
                    LteTime     = lteTime,
                    AccessToken = AccountCache.Persist.AccessToken
                });

                if (response != null && response.Code == Application.Enums.ApiCodeEnums.ERROR_NOLOGIN)
                {
                    _onTipRender.ExecuteTip(page.BodyPanel, "登陆失效,请退出重新登陆");
                    _onRedirectRender.RedirectLogin();
                    return;
                }

                var resp = response.Data;
                #region 数据绑定

                _onControlRender.ThreadExecuteUI(() =>
                {
                    _onControlRender.BindFrameworkElement(page.DataGridOrderList, resp?.Data?.ToList() ?? null);

                    if ((resp?.Data?.Count() ?? 0) <= 0)
                    {
                        page.SpPager.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        page.SpPager.Visibility = Visibility.Visible;
                    }

                    var sump                    = Convert.ToInt32(resp.TotalCount) % rows;
                    var totalPage               = Convert.ToInt32(resp?.TotalCount ?? 0) / rows + (sump > 0 ? 1 : 0);
                    page.labTotalPage.Content   = $"/{totalPage}";
                    page.labCurrentPage.Content = $"{pageIndex}";

                    page.labPrePage.Tag        = $"{pageIndex - 1}";
                    page.labPrePage.IsEnabled  = pageIndex > 1;
                    page.labNextPage.Tag       = $"{pageIndex + 1}";
                    page.labNextPage.IsEnabled = (pageIndex + 1) <= totalPage;
                    page.txbJumb.Tag           = totalPage;
                });
                #endregion
            }
            catch (Exception ex)
            {
                TextHelper.Error("RenderList 异常", ex);
                _onTipRender.ExecuteTip(page.BodyPanel, "查询异常[0001]");
            }
        }
コード例 #16
0
ファイル: DBAccess.cs プロジェクト: wangjcStrive/DailyTask
 public void addAccountRecord(AccountRecord newRecord)
 {
     try
     {
         using (var dbc = new DailyTaskContext())
         {
             var query = dbc.accountRecords.SingleOrDefault(p => p.ID == newRecord.ID);
             if (query != null)    //modify record
             {
                 query.AccountName = newRecord.AccountName;
                 query.Password    = newRecord.Password;
                 query.Comments    = newRecord.Comments;
                 dbc.SaveChanges();
                 MessageBox.Show($"modify account record {newRecord.ID}-{newRecord.Comments}");
             }
             else
             {
                 dbc.accountRecords.Add(newRecord);
                 dbc.SaveChanges();
                 MessageBox.Show($"add account record {newRecord.ID}-{newRecord.Comments}");
             }
         }
     }
     catch (Exception e)
     {
         m_logger.Error($"save account record {newRecord.ID} faile! {e.Message}");
         MessageBox.Show($"save account record {newRecord.ID} faile! {e.Message}");
     }
 }
コード例 #17
0
        public static void LoginWithServerId(Client client, IdentificationMessageWithServerIdMessage message)
        {
            if (message.version.ToString() != "2.0.0.0")
            {
                client.Send(new IdentificationFailedForBadVersionMessage((sbyte)IdentificationFailureReasonEnum.BAD_VERSION, new Protocol.Types.Version(2, 0, 0, 0)));
            }
            AccountRecord account = AccountRecord.ReturnAccount(message.login);

            if (account == null || Functions.CipherPassword(account.Password, client.Ticket) != message.password)
            {
                client.Send(new IdentificationFailedMessage((sbyte)IdentificationFailureReasonEnum.WRONG_CREDENTIALS));
            }
            else
            {
                if (account.BannedUntil > DateTime.Now)
                {
                    client.Send(new IdentificationFailedMessage((sbyte)IdentificationFailureReasonEnum.BANNED));
                }
                if (Server.Clients.Count(x => x.Account == account) > 1)
                {
                    Server.Clients.FirstOrDefault(x => x.Account == account).Disconnect();
                }
                client.Account = account;
                client.Send(new IdentificationSuccessMessage(account.HasRights, false, account.Nickname, 0, account.SecretQuestion, 42195168000000));
                SendSelectedServerDataMessage(client, message.serverId);
            }
        }
コード例 #18
0
        private CTMS_ACCOUNTRECORD ModelToEntity(AccountRecord model)
        {
            if (model == null)
            {
                return(null);
            }
            return(new CTMS_ACCOUNTRECORD()
            {
                ID = string.IsNullOrEmpty(model.ID) ? Guid.NewGuid().ToString() : model.ID,
                USERID = model.UserID,
                LOGINNAME = model.LoginName,
                ORDERID = model.OrderID,
                PRODUCTID = model.ProductID,
                PRODUCTNAME = model.ProductName,
                BALANCE = model.Balance,
                ACCOUNT = model.Account,
                ACCOUNTDESCRIPTION = model.AccountDescription,
                SPENDTYPE = (int)model.SpendType,


                CREATEDATETIME = model.CreateDateTime,
                CREATEUSERID = model.CreateUserID,
                CREATEUSERNAME = model.CreateUserName,
                EDITDATETIME = model.EditTime,
                EDITUSERID = model.EditUserID,
                EDITUSERNAME = model.EditUserName,
                OWNERID = model.OwnerID,
                OWNERNAME = model.OwnerName,
                ISDELETED = model.IsDeleted
            });
        }
コード例 #19
0
        private static AccountRecord CreateAccount(this ModelBuilder builder, UserRecord user, string name, int id)
        {
            var account = new AccountRecord {
                Id = id, Name = name, UserId = user.Id
            };

            builder.Entity <AccountRecord>().HasData(account);
            return(account);
        }
コード例 #20
0
ファイル: AccountBus.cs プロジェクト: depweili/sxc
 public void SaveRecord(AccountRecord record)
 {
     try
     {
     }
     catch (Exception ex)
     {
         throw;
     }
 }
コード例 #21
0
        public ActionResult AjaxPosts(AccountRecord input)
        {
            if (ModelState.IsValid)
            {
                var accountbook = Mapper.Map <AccountBook>(input);
                _recordService.createNewRecord(accountbook);
                _recordService.save( );
            }

            return(RedirectToAction("RenderAjaxPartialView"));
        }
コード例 #22
0
        private AccountBook getUpdatedRecord(Guid recordId, AccountRecord accountRecord)
        {
            var updateRecord = _recordService.getRecordById(recordId);

            updateRecord.Dateee     = accountRecord.Date;
            updateRecord.Amounttt   = ( int )accountRecord.Amount;
            updateRecord.Categoryyy = ( int )accountRecord.Category;
            updateRecord.Remarkkk   = accountRecord.Remark;

            return(updateRecord);
        }
コード例 #23
0
 public void LoadAccountRecord()
 {
     if (AccountRecord.Displayed)
     {
         AccountRecord.Click();
     }
     else
     {
         throw new Exception("Record is not found or not clickable");
     }
 }
コード例 #24
0
        private static void CreateWallet(this ModelBuilder builder, CurrencyRecord currency,
                                         AccountRecord account, double value, int id)
        {
            var wallet = new WalletRecord
            {
                Id    = id, CurrencyId = currency.Id, AccountId = account.Id,
                Value = value
            };

            builder.Entity <WalletRecord>().HasData(wallet);
        }
コード例 #25
0
 private void InitProp(AccountRecord accountRecord)
 {
     if (accountRecord.Apps != null)
     {
         AppsAndUrls.AddRange(AccountUtility.Split(accountRecord.Apps).Select(u => new AppViewModel(u)));
     }
     if (accountRecord.Urls != null)
     {
         AppsAndUrls.AddRange(AccountUtility.Split(accountRecord.Urls).Select(u => new AppViewModel(u, true)));
     }
 }
コード例 #26
0
 public static MarginTradingAccount ConvertToDomain(this AccountRecord account)
 {
     return(new MarginTradingAccount
     {
         Id = account.Id,
         ClientId = account.ClientId,
         TradingConditionId = account.TradingConditionId,
         BaseAssetId = account.BaseAssetId,
         Balance = account.Balance,
         WithdrawTransferLimit = account.WithdrawTransferLimit
     });
 }
コード例 #27
0
 /// <summary>
 /// 修改账单
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Edit(AccountRecord model)
 {
     if (string.IsNullOrEmpty(model.ID))
     {
         LogService.WriteInfoLog(logTitle, "试图修改为空的AccountRecord实体!");
         throw new KeyNotFoundException();
     }
     using (DbContext db = new CRDatabase())
     {
         db.Entry(ModelToEntity(model)).State = EntityState.Modified;
         return(db.SaveChanges() > 0);
     }
 }
コード例 #28
0
        public AccountInfoViewModel(AccountRecord accountRecord)
        {
            this.accountRecord = accountRecord;

            if (accountRecord.Apps != null)
            {
                AppsUrls.AddRange(AccountUtility.Split(accountRecord.Apps));
            }
            if (accountRecord.Urls != null)
            {
                AppsUrls.AddRange(AccountUtility.Split(accountRecord.Urls));
            }
        }
コード例 #29
0
        protected void ProcessCreditLimitUpdatesThread(object param)
        {
            DoLog(string.Format("Starting ProcessCreditLimitUpdatesThread thread"), MessageType.Information);

            object[]                  parameters = (object[])param;
            IWebSocketConnection      socket     = (IWebSocketConnection)parameters[0];
            WebSocketSubscribeMessage subscrMsg  = (WebSocketSubscribeMessage)parameters[1];

            string firmId = subscrMsg.ServiceKey;

            if (subscrMsg.ServiceKey.Contains("@"))
            {
                firmId = subscrMsg.ServiceKey.Split(new string[] { "@" }, StringSplitOptions.RemoveEmptyEntries)[0];
            }

            DoLog(string.Format("Getting account record for firmId {0}", firmId), MessageType.Information);
            AccountRecord accRecord = AccountRecords.Where(x => x.EPFirmId == firmId).FirstOrDefault();

            DoLog(string.Format("Account record for firmId {0} {1} found", firmId, accRecord != null? "do": "not"), MessageType.Information);

            if (accRecord == null)
            {
                return;
            }

            double maxNotional = accRecord.MaxNotional;
            double creditLimit = accRecord.CreditLimit;

            while (true)
            {
                Thread.Sleep(10000);
                TimeSpan elapsed = DateTime.Now - new DateTime(1970, 1, 1);

                creditLimit += 1000d;
                maxNotional += 10000;

                CreditLimitUpdate climUpd = new CreditLimitUpdate();
                climUpd.Active      = true;
                climUpd.CreditLimit = creditLimit;
                climUpd.FirmId      = accRecord.EPFirmId;
                climUpd.MaxNotional = maxNotional;
                climUpd.Msg         = "CreditLimitUpdate";
                climUpd.RouteId     = accRecord.RouteId;
                climUpd.Sender      = 0;
                climUpd.Time        = Convert.ToInt64(elapsed.TotalMilliseconds);


                DoLog(string.Format("Sending Credit Limit Update New MaxLimit:{0} New MaxNotional:{1}", creditLimit, maxNotional), MessageType.Information);
                DoSend <CreditLimitUpdate>(socket, climUpd);
            }
        }
コード例 #30
0
ファイル: CaisGenerate.cs プロジェクト: vijayamazon/ezbob
        private AccountRecord CreateConsumerRecord(string accountNumber, DateTime startDate, DateTime dateClose, int scheduledRepayments,
                                                   decimal currentBalance, string fullName, string line1, string line23, string town,
                                                   string county, string postcode, DateTime dateOfBirth,
                                                   string transferredToCollectionFlag, string caisFlag)
        {
            // TODO: investigate if we need all the assigments to 0 and empty strings
            var account = new AccountRecord {
                AccountNumber                     = accountNumber,
                AccountType                       = "02",
                StartDate                         = startDate,
                CloseDate                         = startDate > dateClose ? DateTime.MinValue : dateClose,
                MonthlyPayment                    = Convert.ToInt32(monthlyPayment),
                RepaymentPeriod                   = Convert.ToInt32(scheduledRepayments),
                CurrentBalance                    = Convert.ToInt32(currentBalance),
                CreditBalanceIndicator            = string.Empty,
                AccountStatus                     = accountStatus,
                SpecialInstructionIndicator       = string.Empty,
                PaymentAmount                     = 0,
                CreditPaymentIndicator            = string.Empty,
                PreviousStatementBalance          = 0,
                PreviousStatementBalanceIndicator = string.Empty,
                NumberCashAdvances                = 0,
                ValueCashAdvances                 = 0,
                PaymentCode                       = string.Empty,
                PromotionActivityFlag             = string.Empty,
                TransientAssociationFlag          = string.Empty,
                AirtimeFlag                       = string.Empty,
                FlagSettings                      = caisFlag,
                NameAndAddress                    = new NameAndAddressData {
                    Name         = fullName,
                    AddressLine1 = line1,
                    AddressLine2 = line23,
                    AddressLine3 = town,
                    AddressLine4 = county,
                    Postcode     = postcode
                },
                CreditLimit = 0,
                DateBirth   = dateOfBirth,
                TransferredCollectionAccountFlag = transferredToCollectionFlag,
                BalanceType             = string.Empty,
                CreditTurnover          = 0,
                PrimaryAccountIndicator = string.Empty,
                DefaultSatisfactionDate = DateTime.MinValue,
                TransactionFlag         = string.Empty,
                OriginalDefaultBalance  = Convert.ToInt32(originalDefaultBalance),
                PaymentFrequency        = "M",
                NewAccountNumber        = string.Empty
            };

            return(account);
        }