Наследование: System.Web.UI.Page
Пример #1
0
        private static void CloseAccount(Bank<Account> bank)
        {
            Console.WriteLine("Введите id счета, который надо закрыть:");
            int id = Convert.ToInt32(Console.ReadLine());

            bank.Close(id);
        }
Пример #2
0
        // Write a program to model the bank system by classes and interfaces.
        // Identify the classes, interfaces, base classes and abstract actions
        // and implement the calculation of the interest functionality through overridden methods.
        private static void Main()
        {
            Client client1 = new ClientIndividual("Neo");
            Client client2 = new ClientCompany("Office 1");
            Client client3 = new ClientIndividual("Nakov");

            Account acc1 = new DepositAccount(client1, 5, "BG13TLRK01");
            Account acc2 = new LoanAccount(client2, 4.5m, "BG13TLRK02");
            Account acc3 = new MortgageAccount(client3, 8.8m, "BG13TLRK03");

            acc1.DepositMoney(1000);
            ((DepositAccount)acc1).WithdrawMoney(500);
            acc2.DepositMoney(10000);

            Bank bank = new Bank("New Bank");

            bank.AddAccount(acc1);
            bank.AddAccount(acc2);
            bank.AddAccount(acc3);

            Console.WriteLine(bank.Accounts);

            Console.WriteLine();
            Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc1.IBAN, acc1.Owner.Name, acc1.CalculateInterest(5));
            Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc2.IBAN, acc2.Owner.Name, acc2.CalculateInterest(6));
            Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc3.IBAN, acc3.Owner.Name, acc3.CalculateInterest(18));

            Console.WriteLine("\nRemoving account 1");
            bank.RemoveAccount(acc1);
            Console.WriteLine(bank.Accounts);
        }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //start of if
        // if no session variable exists for HBos
        if (Session["HBos"] == null)
        {
            hBos = new Bank();
        }
        else
        {

            hBos = (Bank)Session["HBos"];
        }


                

        //using getters to set label values to that in bank class
        lblExRate.Text = Convert.ToString(hBos.getexchange());
        lblAtmUsed.Text = Convert.ToString(hBos.gettimesused());
        lblFailedLogins.Text = Convert.ToString(hBos.getfailedlogins());
        lblBalanceAvailable.Text = Convert.ToString(hBos.gettotalbalance());
        lblCards.Text = Convert.ToString(hBos.getcards());
        lblId.Text = Convert.ToString(hBos.getatmid());
        lblTotalWithdrawls.Text = Convert.ToString(hBos.getwithdrawls());

        Session.Add("HBos", hBos);
    }
Пример #4
0
    static void Main(string[] args)
    {
        Bank myBank = new Bank();
        myBank.AddAccount(new DepositAccount(Customer.Company, 200m, 1.5m));
        myBank.AddAccount(new LoanAccount(Customer.Individual, -20, 2m));
        myBank.AddAccount(new MortgageAccount(Customer.Individual, -100m, 3m));

        Account acc = new DepositAccount(Customer.Individual, 200m, 4m);
        myBank.AddAccount(acc);

        foreach (var account in myBank.Accounts)
        {
            Console.WriteLine("{0}(Money = {1})'s interest => {2}", account.GetType(), account.Balance, account.CalculateInterest(14));
        }

        myBank.RemoveAccount(acc);

        if (acc is DepositAccount)
        {
            DepositAccount changeAcc = acc as DepositAccount;
            changeAcc.Deposit(1000);
            changeAcc.WithDraw(100);
            myBank.AddAccount(changeAcc);
        }

        Console.WriteLine();
        foreach (var account in myBank.Accounts)
        {
            Console.WriteLine("{0}(Money = {1})'s interest => {2}", account.GetType(), account.Balance, account.CalculateInterest(14));
        }
    }
Пример #5
0
    static void Main()
    {
        var bank = new Bank("International Asset Bank");

        bank.AddAccount(
            new DepositAccount(CustomerType.Individual, 2330, 45).WithDraw(250.23m), // Test WithDraw()
            new LoanAccount(CustomerType.Company, 250, 25).Deposit(250.23m), // Test Deposit()
            new LoanAccount(CustomerType.Individual, 444, 44), // Remove
            new MortgageAccount(CustomerType.Company, 2300, 15));

        bank.RemoveAccount(new LoanAccount(CustomerType.Individual, 444, 44));

        Console.WriteLine(bank);

        /* ------------ */

        Console.WriteLine(new DepositAccount(CustomerType.Individual, 2330, 45).CalculateInterestAmount(20));

        Console.WriteLine(new LoanAccount(CustomerType.Company, 250, 25).Deposit(250.23m).CalculateInterestAmount(15));

        Console.WriteLine(new MortgageAccount(CustomerType.Company, 2300, 15).CalculateInterestAmount(45) + "\n\n");

        /* ------------ */

        Console.WriteLine(new DepositAccount(CustomerType.Individual, 2330, 45));
    }
 /// <summary>
 /// 实例化一个新的转账记录
 /// </summary>
 /// <param name="comeFrom">来源银行</param>
 /// <param name="serialNumber">流水号</param>
 /// <param name="sum">金额</param>
 public TransferRecord(Bank comeFrom, string serialNumber, double sum)
 {
     this.ComeFrom = comeFrom;
     this.SerialNumber = serialNumber;
     this.Sum = sum;
     this.Status = TransferStatus.用户已经支付;
 }
Пример #7
0
 // Delete Bank <bank> from database
 public static bool delete(Bank bank)
 {
     using (DataClasses1DataContext database = new DataClasses1DataContext(Globals.connectionString))
     {
         var query = from a in database.Banks
                     where (a.BankID == bank.BankID)
                     select a;
         // It seems to me that a single account renders the foreach unnecessary. However, I can't
         // find another way to get the variable 'a' from 'query'.
         foreach (var a in query)
         {
             database.Banks.DeleteOnSubmit(a);
             try
             {
                 database.SubmitChanges();
                 return true;
             }
             catch (Exception e)
             {
                 return false;
             }
         }
         return false;
     }
 }
Пример #8
0
 public void TestBankAccountIndexerInvalidRange()
 {
     var bank = new Bank();
     var acc = new Account();
     bank.AddAccount(acc);
     var accFromBank = bank[1];
 }
 public void ReduceSum()
 {
     IExpression sum = new Sum(Money.Dollar(3), Money.Dollar(4));
     Bank bank = new Bank();
     Money result = bank.Reduce(sum, "USD");
     Assert.Equal(Money.Dollar(7), result);
 }
Пример #10
0
 public void ReduceMoneyDifferentCurrency()
 {
     Bank bank = new Bank();
     bank.AddRate("CHF", "USD", 2);
     Money result = bank.Reduce(Money.Franc(2), "USD");
     Assert.Equal(Money.Dollar(1), result);
 }
Пример #11
0
 public BankOutletsCreated(int provinceID, int cityID, Bank bank, string bankName)
 {
     this.ProvinceID = provinceID;
     this.CityID = cityID;
     this.Bank = bank;
     this.BankName = bankName;
 }
Пример #12
0
    static void Main()
    {
        Bank bank = new Bank();

        DepositAccount depAccC = new DepositAccount(new Company(), 300M, 0.4M);
        DepositAccount depAccI = new DepositAccount(new Individual(), 1000M, 0.4M);

        LoanAccount loanAccC = new LoanAccount(new Company(), 1000M, 0.4M);
        LoanAccount loanAccI = new LoanAccount(new Individual(), 1000M, 0.4M);

        MortgageAccount mortAccC = new MortgageAccount(new Company(), 1000M, 0.4M);
        MortgageAccount mortAccI = new MortgageAccount(new Individual(), 1000M, 0.4M);

        bank.AddAccount(depAccC);
        bank.AddAccount(depAccI);
        bank.AddAccount(loanAccC);
        bank.AddAccount(loanAccI);
        bank.AddAccount(mortAccC);
        bank.AddAccount(mortAccI);

        foreach (var acc in bank.Accounts)
        {
            Console.WriteLine(acc.CalculateInterestAmount(12));
        }
    }
Пример #13
0
 public static Bank BankAccount()
 {
     // Making instance of the Bank, with random values
     Bank account = new Bank("Pesho", "Ivanov", "Petrov", 200.22m, "TBI BANK", "BG80 BNBG 9661 1020 3456 78",
                              347443242294183, 344715318332002, 340121672891069);
     return account;
 }
Пример #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //start of if
        // if no session variable exists for HBos
        if (Session["Hbos"] == null)
        {
            hBos = new Bank();
        }
        else
        {

            hBos = (Bank)Session["Hbos"];
        }

        //initialising number of attempts session variable
        numberoffailedattempts = Convert.ToInt32(Session["numberoffailedattempts"]);

        cardsRetained = hBos.getcards();
        timesused = hBos.gettimesused();
        finalfailedattempts = hBos.getfailedlogins();

        //start of if statement
        //checks if manager has logged in
        //if not, disable customer button
        if (Session["HBos"] == null)
        {
            rblChoose.Items[1].Enabled = false;

        }
        else
        {
          rblChoose.Items[1].Enabled = true;

        }
    }
Пример #15
0
 static void Main(string[] args)
 {
     Bank b1 = new Bank(1000000);
     Console.WriteLine("Текущий бонусный процент: " + Bank.GetBonus());
     Console.WriteLine("Ваш депозит на {0:C}, в кассе забрать: {1:C}", 
         10000, b1.GetPercents(10000));
 }
Пример #16
0
 public void TestFirstCustomerThrowsExceptionIfNoCustomersExist()
 {
     Bank bank = new Bank();
     Assert.Throws<System.ArgumentException>(()=> 
     {
         bank.getFirstCustomer();
     });
 }
 public void TestSimpleAddition()
 {
     var five = Money.Dollar(5);
     ICurrencyExpression sum = five.Plus(five);
     Bank bank = new Bank();
     Money reduced = bank.Reduce(sum, "USD");
     Assert.AreEqual(Money.Dollar(10), reduced);
 }
Пример #18
0
 public void TestBankRemoveInvalidAccount()
 {
     Bank bank = new Bank();
     Account acc = new Account();
     bank.AddAccount(acc);
     Account anotherAcc = new Account();
     bank.RemoveAccount(anotherAcc);
 }
Пример #19
0
 public void TestBankAddAccount()
 {
     Bank bank = new Bank();
     Account acc = new Account();
     bank.AddAccount(acc);
     Assert.AreEqual(bank.AccountsCount, 1);
     Assert.AreSame(bank[0], acc);
 }
Пример #20
0
 /// <summary>
 /// Renders the bank summary in test
 /// </summary>
 /// <param name="bank">The bank.</param>
 /// <returns></returns>
 public string Render(Bank bank)
 {
     StringBuilder summary=new StringBuilder();
     summary.Append("Customer Summary");
     foreach (Customer c in bank.Customers)
         summary.Append("\n - " + c.getName() + " (" + format(c.getNumberOfAccounts(), "account") + ")");
     return summary.ToString();
 }
Пример #21
0
 public void method_1()
 {
     this.Width = 293;
     Bank b = new Bank(0, "Noname", 0);
     b.MONEY = Convert.ToInt32(tbxMoney.Text);
     b.NAME = tbxName.Text;
     b.PERCENT = Convert.ToInt32(tbxPercent.Text);
 }
Пример #22
0
 public CapitalAccountDisabled(int capitalAccountID, Bank bank, string bankAccount, string ownerName, int byUserID)
 {
     this.CapitalAccountID = capitalAccountID;
     this.Bank = bank;
     this.BankAccount = bankAccount;
     this.OwnerName = ownerName;
     this.ByUserID = byUserID;
 }
Пример #23
0
 public CapitalAccountCreated(Bank bank, string bankAccount, string ownerName, int createBy, CapitalAccount capitalAccountEntity)
 {
     this.Bank = bank;
     this.BankAccount = bankAccount;
     this.OwnerName = ownerName;
     this.CreateBy = createBy;
     this.CapitalAccountEntity = capitalAccountEntity;
 }
Пример #24
0
 public void Save(Bank bank)
 {
     DAL.Bank pd = new DAL.Bank();
     pd.AccountNbr = bank.AccountNumber;
     pd.Balance = bank.Balance;
     db.Banks.InsertOnSubmit(pd);
     db.SubmitChanges();
 }
Пример #25
0
 public Person(string person_live_id, string person_name, string token, Bank bankInstance, FriendManager friendManager)
 {
     this.person_live_id = person_live_id;
     this.person_name = person_name;
     this.token = token;
     this.bankInstance = bankInstance;
     this.friendManagerInstance = friendManagerInstance;
 }
 /// <summary>
 /// 实例化一个新的充值记录
 /// </summary>
 /// <param name="owner">用户</param>
 /// <param name="comeFrom">来源银行</param>
 /// <param name="serialNumber">流水号</param>
 public RechargeRecord(Author owner, Bank comeFrom, string serialNumber)
 {
     this.Owner = owner;
     this.ComeFrom = comeFrom;
     this.SerialNumber = serialNumber;
     this.Sum = 0;
     this.Status = RechargeStatus.等待银行确认;
 }
Пример #27
0
 public Card(Bank.Bank bank_, Client.Client client)
 {
     Random ran = new Random();
     pinCode = Convert.ToString(ran.Next(1000, 9999));
     cardNumber = Convert.ToString(ran.Next(1000000, 9999999));
     bank = bank_;
     clientName = client.Name;
 }
Пример #28
0
        public void Test_Addition_Of_Money()
        {
            var bank = new Bank();

            ICurrencyExpression sum = Money.Dollar(15).Plus(Money.Dollar(10));
            var reduced = bank.Reduce(sum, "USD");
            Assert.AreEqual(Money.Dollar(25), reduced);
        }
Пример #29
0
 public void TestBankAddRemoveAccount()
 {
     Bank bank = new Bank();
     Account acc = new Account();
     bank.AddAccount(acc);
     Assert.AreEqual(bank.AccountsCount, 1);
     bank.RemoveAccount(acc);
     Assert.AreEqual(bank.AccountsCount, 0);
 }
Пример #30
0
        public void Test_Bank_Reduces_Sum()
        {
            var bank = new Bank();
            var five = Money.Dollar(5);
            ICurrencyExpression sum = five.Plus(five);
            Money reduced = bank.Reduce(sum, "USD");

            Assert.AreEqual(Money.Dollar(10), reduced);
        }
Пример #31
0
 private void Awake()
 {
     bank            = FindObjectOfType <Bank>();
     materialChanger = GetComponentInChildren <MaterialChanger>();
 }
Пример #32
0
 private void btOpslaan_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckFields())
         {
             if (this.lid == null)
             {
                 Adres adres = new Adres(straatnaam, huisnummer, postcode, woonplaats);
                 adres.SetEmail("Geen Email");
                 //string str = bankrekening.Substring(4, 4);
                 //BankNaamEnum bankNaam = (BankNaamEnum)Enum.Parse(typeof(BankNaamEnum), str);
                 //Bank bank = new Bank(CheckBankCode(bankNaam), tbBankrekening.Text);
                 //tbBankrekening.Text = CheckBankCode(bankNaam);
                 Oudercontact oc;
                 if (tbOVoornaam.Text == "" && tbOAchternaam.Text == "")
                 {
                     oc = null;
                 }
                 else
                 {
                     oc = new Oudercontact(tbOVoornaam.Text, tbOTussenvoegsel.Text, tbOAchternaam.Text,
                                           tbOTel1.Text,
                                           tbOTel2.Text, tbOEmail1.Text, tbOTel2.Text);
                 }
                 Lid lid = new Lid(lidvanaf, bondsnummer, voornaam, tussenvoegsel, achternaam, emailadres, geslacht,
                                   geboortedatum, adres, telefoonnummer, mobielnummer);
                 //lid.SetBank(bank);
                 lid.SetOuderContact(oc);
                 App.AddLid(lid);
             }
             else
             {
                 Adres adres = new Adres(straatnaam, huisnummer, postcode, woonplaats);
                 adres.SetEmail("Geen Email");
                 string       str      = bankrekening.Substring(4, 4);
                 BankNaamEnum bankNaam = (BankNaamEnum)Enum.Parse(typeof(BankNaamEnum), str);
                 Bank         bank     = new Bank(CheckBankCode(bankNaam), tbBankrekening.Text);
                 tbBankrekening.Text = CheckBankCode(bankNaam);
                 Oudercontact oc;
                 if (tbOVoornaam.Text == "" && tbOAchternaam.Text == "")
                 {
                     oc = null;
                 }
                 else
                 {
                     oc = new Oudercontact(tbOVoornaam.Text, tbOTussenvoegsel.Text, tbOAchternaam.Text,
                                           tbOTel1.Text,
                                           tbOTel2.Text, tbOEmail1.Text, tbOTel2.Text);
                 }
                 Lid nieuwLid = new Lid(lidvanaf, bondsnummer, voornaam, tussenvoegsel, achternaam, emailadres, geslacht, geboortedatum, adres, telefoonnummer, mobielnummer);
                 lid.SetBank(bank);
                 lid.SetOuderContact(oc);
                 App.EditLid(nieuwLid, lid);
             }
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }
        public IHttpActionResult UpdateBank(Bank bank)
        {
            var NewBank = _repository.UpdateBank(bank);

            return(Ok(NewBank));
        }
Пример #34
0
        /// <summary>
        /// Input connections to device
        /// </summary>
        /// <param name="bankID">BankID of the device</param>
        /// <param name="cycle">Zero-based program cycle number</param>
        /// <returns></returns>
        private static List <Connection> Connections(Bank bankID, int cycle)
        {
            var conns = new List <Connection>();

            DevicePort mux1PortOut       = DevicePort.Default;
            DevicePort dataRamPortOut    = DevicePort.Default;
            DevicePort mux2Mux1PortIn    = DevicePort.Default;
            DevicePort mux2DataRamPortIn = DevicePort.Default;

            PortStatus mux1PortOut_Stat;
            PortStatus dataRamPortOut_Stat;
            PortStatus mux2Mux1PortIn_Stat;
            PortStatus mux2DataRamPortIn_Stat;

            var mux1_label    = Mux1Model.OutputCalc(bankID, cycle).FormattedValue;
            var dataRam_label = DataRamModel.OutputCalc(bankID, cycle).FormattedValue;

            InputsUsed(bankID, cycle,
                       out mux1PortOut_Stat,
                       out dataRamPortOut_Stat,
                       out mux2Mux1PortIn_Stat,
                       out mux2DataRamPortIn_Stat);

            switch (bankID)
            {
            case Bank.Bank_A:
                mux1PortOut       = DevicePort.Mux_1A;
                dataRamPortOut    = DevicePort.DataRam_A;
                mux2Mux1PortIn    = DevicePort.Mux_2A;
                mux2DataRamPortIn = DevicePort.Mux_2A;
                break;

            case Bank.Bank_B:
                mux1PortOut       = DevicePort.Mux_1B;
                dataRamPortOut    = DevicePort.DataRam_B;
                mux2Mux1PortIn    = DevicePort.Mux_2B;
                mux2DataRamPortIn = DevicePort.Mux_2B;
                break;

            default:
                break;
            }

            conns.Add(new Connection(
                          BusType.Data,
                          mux1PortOut,
                          mux1PortOut_Stat,
                          mux1_label,
                          null,
                          mux2Mux1PortIn,
                          mux2Mux1PortIn_Stat));

            conns.Add(new Connection(
                          BusType.Data,
                          dataRamPortOut,
                          dataRamPortOut_Stat,
                          dataRam_label,
                          null,
                          mux2DataRamPortIn,
                          mux2DataRamPortIn_Stat));

            return(conns);
        }
Пример #35
0
        /// <summary>
        /// Inputs used by the device in the active instruction
        /// </summary>
        /// <param name="bankID">BankID of the device</param>
        /// <param name="cycle">Zero-based program cycle number</param>
        /// <param name="mux1PortOut_Stat">Port status</param>
        /// <param name="dataRamPortOut_Stat">Port status</param>
        /// <param name="mux2Mux1PortIn_Stat">Port status</param>
        /// <param name="mux2DataRamPortIn_Stat">Port status</param>
        private static void InputsUsed(
            Bank bankID,
            int cycle,
            out PortStatus mux1PortOut_Stat,
            out PortStatus dataRamPortOut_Stat,
            out PortStatus mux2Mux1PortIn_Stat,
            out PortStatus mux2DataRamPortIn_Stat)
        {
            mux1PortOut_Stat       = PortStatus.Inactive;
            dataRamPortOut_Stat    = PortStatus.Inactive;
            mux2Mux1PortIn_Stat    = PortStatus.Inactive;
            mux2DataRamPortIn_Stat = PortStatus.Inactive;

            // active instruction (pipeline delayed)
            var instrWord = CodeStoreModel.Instruction(cycle - PIPELINE_DELAY);

            if (instrWord != null)
            {
                var instr = bankID == Bank.Bank_A
                                        ? instrWord.MuxA
                                        : instrWord.MuxB;

                switch (instr)
                {
                case "ba":                          // Bus to ALU
                case "sa":                          // Shifter to ALU
                case "bm":                          // Bus to MAC, MAC to ALU
                case "sm":                          // Shifter to MAC, MAC to ALU
                    mux1PortOut_Stat    = PortStatus.Active;
                    mux2Mux1PortIn_Stat = PortStatus.Active;
                    break;

                case "bra":                         // Bus to RAM, RAM to ALU
                case "sra":                         // Shifter to RAM, RAM to ALU
                case "brm":                         // Bus to RAM, to MAC
                case "srm":                         // Shifter to RAM to MAC
                    dataRamPortOut_Stat    = PortStatus.Active;
                    mux2DataRamPortIn_Stat = PortStatus.Active;
                    break;

                default:
                    break;
                }
            }

            // current instruction
            instrWord = CodeStoreModel.Instruction(cycle);
            if (instrWord != null)
            {
                var instr = bankID == Bank.Bank_A
                                        ? instrWord.MuxA
                                        : instrWord.MuxB;

                switch (instr)
                {
                // ignore - not latched in until [cycle - PIPELINE_DELAY]
                case "ba":                          // Bus to ALU
                case "sa":                          // Shifter to ALU
                case "bm":                          // Bus to MAC, MAC to ALU
                case "sm":                          // Shifter to MAC, MAC to ALU
                    break;

                // latched in now
                case "bra":                         // Bus to RAM, RAM to ALU
                case "sra":                         // Shifter to RAM, RAM to ALU
                case "brm":                         // Bus to RAM, to MAC
                case "srm":                         // Shifter to RAM to MAC
                    dataRamPortOut_Stat    = PortStatus.Active;
                    mux2DataRamPortIn_Stat = PortStatus.Active;
                    break;

                default:
                    break;
                }
            }
        }
 public WithdrawBankData(ushort step, Bank data)
 {
     Step = step;
     Data = data;
 }
Пример #37
0
 public void ChangeCurrency(Bank bank, string currencyName, float rates)
 {
     bank.currency = currencyName;
     bank.ChangeRates(rates);
 }
Пример #38
0
 public void Remove(Bank bank, Account account)
 {
     BankToAccounts.TryGetValue(bank, out var bankAccounts);
     bankAccounts !.Remove(account);
 }
Пример #39
0
 public CreditAccount(Client client, Bank bank, double overdraftLimit, double initDeposit = 0) : base(client, bank, 0, initDeposit)
 {
     OverdraftLimit = overdraftLimit;
 }
Пример #40
0
        private static void Debug()
        {
            ConsoleHandler.Start();
            Game = new Game();
            Game.Load();
            Game.Current = new Round(1);
            Game.UpdateStatic();

            ToolTipService.ShowDurationProperty.OverrideMetadata(typeof(DependencyObject), new FrameworkPropertyMetadata(Int32.MaxValue));
            GameInterface = new GameInterface();
            ((Interface.GameWindow)GameInterface.Window).grid.Children.Add(Map = Map.TileGenerator.CreateTiles());

            #region Debug
            //- Player
            CurrentPerson           = (Person)Game.FindCitizen(0);
            CurrentPerson.ImageName = "person_geecku";
            CurrentPerson.Culture   = Game.FindCulture(History.Cultures.Cultures.Deutsch);
            CurrentPerson.Ideology  = Game.FindIdeology(1);
            CurrentPerson.Party     = CurrentPerson.Location.CountryOwner.Government.RegisteredParties[0];

            //- Banks
            Bank test_bank = new Bank("Bank von Bayern");
            test_bank.GoldQuanity = 7;
            Game.Banks.Add(test_bank, test_bank.ID);

            //- Provinces
            Game.FindProvince(1).SetOwner(Game.FindCountry(1));
            Game.FindProvince(2).SetOwner(Game.FindCountry(1));
            Game.FindProvince(5).SetOwner(Game.FindCountry(1));

            //- Eckard
            Person person = (Person)Game.FindCitizen(10);
            person.Ideology = Game.FindIdeology(1);
            person.Culture  = Game.FindCulture(History.Cultures.Cultures.Deutsch);

            CurrentPerson.TalkTo(person);
            CurrentPerson.ChangeFollower(person);

            //- Göring
            person = (Person)Game.FindCitizen(11);
            person.JoinArmy(Game.FindArmy(1));
            person.Army.PromotePerson(person, 8);

            //- von Kahr
            person = (Person)Game.FindCitizen(12);
            person.Party.DefineNewLeader(person);

            //- von Lossow
            person = (Person)Game.FindCitizen(13);
            person.JoinArmy(Game.FindArmy(1));
            person.Army.PromotePerson(person, 2);
            person.Army.DefineNewLeader(person);

            //- Röhm
            person = (Person)Game.FindCitizen(14);
            person.JoinArmy(Game.FindArmy(1));
            person.Army.PromotePerson(person, 9);

            //- Hitler
            person = (Person)Game.FindCitizen(16);
            person.JoinArmy(Engine.Game.FindArmy(1));
            person.Army.PromotePerson(person, 19);

            //- Mayer
            person = (Person)Game.FindCitizen(15);
            person.JoinArmy(Engine.Game.FindArmy(1));
            person.Army.PromotePerson(person, 8);
            #endregion

            #region Historical OOB
            //- 'Infanterieführer VII (Reichswehr)' (17. Infanterie-Division)
            Person franz_epp = (Person)Game.FindCitizen(17);
            franz_epp.JoinArmy(Game.FindArmy(1));
            franz_epp.Army.PromotePerson(franz_epp, 3);

            Division inf_vii = new Division(franz_epp.LocationID);
            Game.Units.Add(inf_vii, inf_vii.ID);
            inf_vii.Name = "Infanterieführer VII. (Reichswehr)";
            inf_vii.DefineNewCommander(franz_epp);
            inf_vii.ClearLocalUnits();
            inf_vii.Owner   = Game.FindCountry(0);
            inf_vii.HQ.Name = "Divisions Kommando VII. der Reichswehr";

            #region Division LocalUnits
            RegularCavalry cav2 = new RegularCavalry(inf_vii);
            cav2.Name = "Divisions-Kavallerie 302";
            cav2.SetUnitType(UnitTypes.Platoon);
            inf_vii.AddLocalUnit(cav2);

            RegularInfantry inf = new RegularInfantry(inf_vii);
            inf.Name = "Guard Infanterie 'Landwehr'";
            inf.SetUnitType(UnitTypes.Group);
            inf_vii.AddLocalUnit(inf);

            RegularCavalry cav1 = new RegularCavalry(inf_vii);
            cav1.Name = "Kavalleriestand Reichswehr";
            cav1.SetUnitType(UnitTypes.Team);
            inf_vii.AddLocalUnit(cav1);
            #endregion

            #region Regiments
            //- 19. Infanterie-Regiment "Friedrich von Haack"
            Person p1 = (Person)Game.FindCitizen(18);
            p1.JoinArmy(Game.FindArmy(1));
            p1.Army.PromotePerson(p1, 5);
            Regiment reg1 = Regiment.CreateDefault(p1.LocationID);
            inf_vii.AddSubUnit(reg1);
            reg1.Name  = "19. Infanterie-Regiment";
            reg1.Owner = Game.FindCountry(0);
            reg1.DefineNewCommander(p1);
            reg1.Parent = inf_vii;

            //- 20. Infanterie-Regiment "Ludwig Leupold"
            Person p2 = (Person)Game.FindCitizen(19);
            p2.JoinArmy(Game.FindArmy(1));
            p2.Army.PromotePerson(p2, 5);
            Regiment reg2 = new Regiment(p2.LocationID);
            inf_vii.AddSubUnit(reg2);
            reg2.Name  = "20. Infanterie-Regiment";
            reg2.Owner = Game.FindCountry(0);
            reg2.DefineNewCommander(p2);
            reg2.Parent = inf_vii;
            Game.Units.Add(reg2, reg2.ID);
            #region 20. Inf-Regiment
            Person    c  = (Person)Game.FindCitizen(14);
            Bataillon b1 = Bataillon.CreateDefault(p2.LocationID);
            b1.Name   = "1. Bataillon 'Rheinmayer-Köln'";
            b1.Owner  = Game.FindCountry(0);
            b1.Parent = reg2;
            b1.DefineNewCommander(c);
            reg2.AddSubUnit(b1);
            reg2.LinkUp(b1);

            Bataillon b2 = Bataillon.CreateDefault(114);
            b2.Name   = "2. Bataillon 'Pait'";
            b2.Owner  = Game.FindCountry(0);
            b2.Parent = reg2;
            reg2.AddSubUnit(b2);

            Bataillon b3 = Bataillon.CreateDefault(151);
            b3.Name   = "3. Bataillon 'Kaiser'";
            b3.Owner  = Game.FindCountry(0);
            b3.Parent = reg2;
            reg2.AddSubUnit(b3);
            #endregion

            //- 21. Infanterie-Regiment "Leonhard Haussel"
            Person p3 = (Person)Game.FindCitizen(20);
            p3.JoinArmy(Game.FindArmy(1));
            p3.Army.PromotePerson(p3, 5);
            Regiment reg3 = Regiment.CreateDefault(p3.LocationID);
            inf_vii.AddSubUnit(reg3);
            reg3.Name  = "21. Infanterie-Regiment";
            reg3.Owner = Game.FindCountry(0);
            reg3.DefineNewCommander(p3);
            reg3.Parent = inf_vii;
            #endregion

            #endregion


            Game.AfterMapLoad();
        }
Пример #41
0
        static private Bank LoadBank(string path)
        {
            string bankTitle = path.Substring(path.LastIndexOf('\\') + 1, path.Length - path.LastIndexOf('\\') - 1);

            string usersPath         = path + @"\Users";
            string depositsPath      = path + @"\Deposits";
            string localDepositsPath = path + @"\LocalDeposits";

            List <SerializationUser>         serializationUsers         = new List <SerializationUser>();
            List <SerializationDeposit>      serializationDeposits      = new List <SerializationDeposit>();
            List <SerializationLocalDeposit> serializationLocalDeposits = new List <SerializationLocalDeposit>();


            if (Directory.Exists(usersPath))
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(usersPath);
                FileInfo[]    fileInfos     = directoryInfo.GetFiles();

                foreach (FileInfo fileInfo in fileInfos)
                {
                    using (StreamReader streamReader = fileInfo.OpenText())
                    {
                        string            userJson          = streamReader.ReadToEnd();
                        SerializationUser serializationUser =
                            SerializationUser.Deserialize(userJson);
                        serializationUsers.Add(serializationUser);
                    }
                }
            }


            if (Directory.Exists(depositsPath))
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(depositsPath);
                FileInfo[]    fileInfos     = directoryInfo.GetFiles();

                foreach (FileInfo fileInfo in fileInfos)
                {
                    using (StreamReader streamReader = fileInfo.OpenText())
                    {
                        string depositJson = streamReader.ReadToEnd();
                        SerializationDeposit serializationDeposit =
                            SerializationDeposit.Deserialize(depositJson);
                        serializationDeposits.Add(serializationDeposit);
                    }
                }
            }


            if (Directory.Exists(localDepositsPath))
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(localDepositsPath);
                FileInfo[]    fileInfos     = directoryInfo.GetFiles();

                foreach (FileInfo fileInfo in fileInfos)
                {
                    using (StreamReader streamReader = fileInfo.OpenText())
                    {
                        string localDepositJson = streamReader.ReadToEnd();
                        SerializationLocalDeposit serializationLocalDeposit =
                            SerializationLocalDeposit.Deserialize(localDepositJson);
                        serializationLocalDeposits.Add(serializationLocalDeposit);
                    }
                }
            }


            Bank bank = Bank.GetObject(bankTitle, serializationUsers, serializationDeposits, serializationLocalDeposits);

            return(bank);
        }
Пример #42
0
    public static void Calculate(Vector3 size, float torque, float weight, float cost)
    {
        for (int i = 0; i < CrankshaftVariations.Length; i++)
        {
            //some rules:
            // - all banks are same

            Vector2[] bankVectors = new Vector2[CrankshaftVariations[i].numBanks];
            //Calculate normalized max size of engine from crankshaft
            Vector2 normalizedMinMaxX = new Vector2(-0.05f, 0.05f);            //crankshaft takes 10% of space
            Vector2 normalizedMinMaxY = new Vector2(-0.05f, 0.05f);            //crankshaft takes 10% of space
            for (int bank = 0; bank < CrankshaftVariations[i].numBanks; bank++)
            {
                Vector2 normalizedBankVector = new Vector2(1, 0);
                float   bankAngle            = Mathf.Deg2Rad * CrankshaftVariations[i].rotations[bank];
                float   x = Mathf.Sin(bankAngle);
                float   y = Mathf.Cos(bankAngle);
                bankVectors[bank] = new Vector2(x, y);
                if (x < normalizedMinMaxX.x)
                {
                    normalizedMinMaxX.x = x;
                }
                if (x > normalizedMinMaxX.y)
                {
                    normalizedMinMaxX.y = x;
                }
                if (y < normalizedMinMaxY.x)
                {
                    normalizedMinMaxY.x = y;
                }
                if (y > normalizedMinMaxY.y)
                {
                    normalizedMinMaxY.y = y;
                }

                //fix because of precision
                if (Mathf.Abs(normalizedMinMaxX.x) < 0.001f)
                {
                    normalizedMinMaxX.x = 0f;
                }
                if (Mathf.Abs(normalizedMinMaxX.y) < 0.001f)
                {
                    normalizedMinMaxX.y = 0f;
                }
                if (Mathf.Abs(normalizedMinMaxY.x) < 0.001f)
                {
                    normalizedMinMaxY.x = 0f;
                }
                if (Mathf.Abs(normalizedMinMaxY.y) < 0.001f)
                {
                    normalizedMinMaxY.y = 0f;
                }
            }
            float spread = normalizedMinMaxX.y - normalizedMinMaxX.x;
            normalizedMinMaxX.x = normalizedMinMaxX.x / spread;
            normalizedMinMaxX.y = normalizedMinMaxX.y / spread;
            spread = normalizedMinMaxY.y - normalizedMinMaxY.x;
            normalizedMinMaxY.x = normalizedMinMaxY.x / spread;
            normalizedMinMaxY.y = normalizedMinMaxY.y / spread;

            float   maxBankHeight = float.PositiveInfinity;
            Vector2 crankshaft    = Vector2.zero;
            Rect    engineRect    = new Rect(normalizedMinMaxX.x * size.x, normalizedMinMaxY.y * size.y, size.x, size.y);
            for (int bank = 0; bank < CrankshaftVariations[i].numBanks; bank++)
            {
                float t1 = (engineRect.xMin - crankshaft.x) / bankVectors[bank].x;
                float t2 = (engineRect.xMax - crankshaft.x) / bankVectors[bank].x;
                float t3 = (engineRect.yMin - crankshaft.y) / bankVectors[bank].y;
                float t4 = (engineRect.yMax - crankshaft.y) / bankVectors[bank].y;
                //Debug.Log("ENGINE"+engineRect.xMin + " " + engineRect.xMax + " " + engineRect.yMin + " " + engineRect.yMax);
                //Debug.Log(t1 + " " + t2 + " " + t3 + " " + t4);
                float t = float.PositiveInfinity;
                if (t1 > 0 && t1 < t)
                {
                    t = t1;
                }
                if (t2 > 0 && t2 < t)
                {
                    t = t2;
                }
                if (t3 > 0 && t3 < t)
                {
                    t = t3;
                }
                if (t4 > 0 && t4 < t)
                {
                    t = t4;
                }

                Vector2 bankIntersect = new Vector2(crankshaft.x + t * bankVectors[bank].x, crankshaft.y + t * bankVectors[bank].y);
                float   bankHeight    = Vector2.Distance(crankshaft, bankIntersect);
                if (bankHeight < maxBankHeight)
                {
                    maxBankHeight = bankHeight;
                }

                //Debug.LogWarning(CrankshaftVariations[i].rotations[bank] + " " + bankIntersect.x + " " + bankIntersect.y + " ");
            }
            Debug.LogError("Max bank height " + CrankshaftVariations[i].name + " " + maxBankHeight);

            Bank.Calculate(bankVectors, maxBankHeight, engineRect, crankshaft, size.z, CrankshaftVariations[i]);
            //Debug.LogError(CrankshaftVariations[i].name + " X" + normalizedMinMaxX + " Y" + normalizedMinMaxY.x + " " + normalizedMinMaxY.y);
        }
    }
 public void EditBankDetail(Bank bank)
 {
     repository.EditBank(bank);
 }
Пример #44
0
        public void CreateAccount(Bank bank)
        {
            int password = new Random().Next(1000, 9999);
            int id       = new Random().Next(100000000, 999999999);

            int isPassword;



            WriteLine("Введите фамилию:");
            string lastName = ReadLine();

            WriteLine("\nВведите имя:");
            string firstName = ReadLine();

            Clear();

            if (lastName.Length > 0 && firstName.Length > 0)
            {
                WriteLine("Номер вашего лицевого счёта: " + id);
                WriteLine("\nВаш ПИН-КОД: " + password);
                WriteLine("\nДля продолжение нажимите на любую клавишу. ");
                ReadKey();
            }

            else
            {
                WriteLine("\nНе коректный ввод данных, пожалуйста в следущий раз введите данные коректно.");
                ReadKey();
                Environment.Exit(0);
            }


            int  count = 3;
            bool stop  = true;


            while (stop == true)
            {
                WriteLine("\nВведите ваш ПИН-КОД, у вас есть " + count + " попытки");
                bool isPars = int.TryParse(ReadLine(), out isPassword);

                if (isPars == true)
                {
                    if (isPassword == password)
                    {
                        WriteLine("\nВсё коректно.");
                        WriteLine("\nДля продолжение нажимите на любую клавишу. ");
                        ReadKey();

                        stop = false;
                    }
                    if (count == 0)
                    {
                        WriteLine("\nВы исчерпали количество попыток. ");
                        WriteLine("\nДля продолжение нажимите на любую клавишу. ");
                        ReadKey();
                        Environment.Exit(0);
                    }
                    count--;
                }

                else
                {
                    WriteLine("\nНе коректный ввод данных, пожалуйста в следущий раз введите данные коректно.");
                    WriteLine("\nДля продолжение нажимите на любую клавишу. ");
                    ReadKey();
                    Environment.Exit(0);
                }

                Clear();
            }
        }
Пример #45
0
 public static void Main()
 {
     Bank.CreateBank();
 }
Пример #46
0
        /// <summary>
        /// Input to the device for the given cycle
        /// </summary>
        /// <param name="bankID">BankID of the device</param>
        /// <param name="cycle">Zero-based program cycle number</param>
        /// <param name="input0">First input</param>
        /// <param name="input0src">First input source</param>
        /// <param name="input1">Second input</param>
        /// <param name="input1src">Second input source</param>
        private static void InputCalc(Bank bankID, int cycle,
                                      out LabeledValue <long?> input0,
                                      out LabeledValue <DevicePort?> input0src,
                                      out LabeledValue <long?> input1,
                                      out LabeledValue <DevicePort?> input1src)
        {
            var valLabel = "In:";
            var srcLabel = "Src:";

            input0    = new LabeledValue <long?>(valLabel);
            input1    = new LabeledValue <long?>(valLabel);
            input0src = new LabeledValue <DevicePort?>(srcLabel);
            input1src = new LabeledValue <DevicePort?>(srcLabel);

            // Input latching occurs as follows (variant pipeline):
            // Pipeline					[t-1]		[now]
            // Cycle					cycle		cycle-1
            // dmux(_r_, _r_)			->ram in	output->
            // dmux(__, __)							->mux1in & output->

            var ramSource = bankID == Bank.Bank_A
                                                ? DevicePort.DataRam_A
                                                : DevicePort.DataRam_B;

            var mux1Source = bankID == Bank.Bank_A
                                                ? DevicePort.Mux_1A
                                                : DevicePort.Mux_1B;

            // Get [now] / cycle-1 input values
            var instr1 = InstrForCycle(bankID, cycle - 1);

            switch (instr1)
            {
            // These inputs latched from data ram in [t-1]
            case "bra":
            case "sra":
            case "brm":
            case "srm":
                input1.Value             = DataRamModel.OutputCalc(bankID, cycle - 1).Value;
                input1.FormattedValue    = FormatValue(VALUE_WIDTH, input1.Value);
                input1src.Value          = ramSource;
                input1src.FormattedValue = input1src.Value.ToString();
                break;

            // These inputs latch from mux1 [now]
            case "ba":
            case "sa":
            case "bm":
            case "sm":
                input1.Value             = Mux1Model.OutputCalc(bankID, cycle).Value;
                input1.FormattedValue    = FormatValue(VALUE_WIDTH, input1.Value);
                input1src.Value          = mux1Source;
                input1src.FormattedValue = input1src.Value.ToString();
                break;
            }

            // Get [t-1] / cycle input values
            var instr0 = InstrForCycle(bankID, cycle);

            switch (instr0)
            {
            case "bra":
            case "sra":
            case "brm":
            case "srm":
                input0.Value             = DataRamModel.OutputCalc(bankID, cycle).Value;
                input0.FormattedValue    = FormatValue(VALUE_WIDTH, input0.Value);
                input0src.Value          = ramSource;
                input0src.FormattedValue = input0src.Value.ToString();
                break;

            // no op:
            case "ba":
            case "sa":
            case "bm":
            case "sm":
            default:
                break;
            }
        }
Пример #47
0
 public Customer CustomerLogIn(Bank bank, string username, string password)
 {
     return(bank.customers.Find(element => element.IsValidOrNot(username, password)));
 }
Пример #48
0
 public Account?Get(Bank bank, int id)
 {
     BankToAccounts.TryGetValue(bank, out var bankAccounts);
     return(bankAccounts !.FirstOrDefault(x => x.Id == id));
 }
Пример #49
0
        public Customer CustomerExistsOrNotByAccId(Bank bank, string accId)
        {
            Customer customer = bank.customers.Find(element => element.GetAccount().AccountId.Equals(accId));

            return(customer);
        }
Пример #50
0
 public void Add(Bank bank, Account account)
 {
     BankToAccounts.TryGetValue(bank, out var bankAccounts);
     bankAccounts !.Add(account);
 }
Пример #51
0
        public Staff StaffExistsOrNot(Bank bank, string userId, string password)
        {
            Staff staff = bank.staffs.Find(element => element.UserId.Equals(userId) && element.ValidatePassword(password));

            return(staff);
        }
Пример #52
0
 public BrankBank()
 {
     Bank = new Bank();
 }
Пример #53
0
        public static void GameTown()
        {
            Dungeon d = Dungeon.DungeonList[0];

            Console.Clear();
            Utilities.ColourText(Colour.SPEAK, "You are in the town of Marburgh. It is a small town, but is clearly growing. Who knows what will be here in a month?\n\n");
            Console.WriteLine("[W]eapon shop            [A]rmor shop            [I]tem shop          [D]ungeon");
            Console.WriteLine("[T]avern                 [Y]our house            [B]ank                         ");
            Console.WriteLine("[C]haracter              [H]eal                  [L]evel Master       [O]ther Places");
            Console.WriteLine("[S]ave                   [?]Help                                      [Q]uit             ");
            Utilities.ColourText(Colour.SPEAK, "\n\nWhat would you like to do?\n\n");
            Utilities.EmbedColourText(Colour.TIME, Colour.TIME, Colour.TIME, Colour.TIME, "It is day ", $"{Time.day}", ", the ", $"{Time.weeks[Time.week]}", " week of ", $"{Time.months[Time.month]}", ", ", $"{Time.year}", "\n\n");
            string choice = Console.ReadKey(true).KeyChar.ToString().ToLower();

            if (choice == "w")
            {
                Shop.GameShop(Shop.WeaponShop, Create.p);
            }
            else if (choice == "a")
            {
                Shop.GameShop(Shop.ArmorShop, Create.p);
            }
            //else if (choice == "s") Data.Save(p);
            else if (choice == "d")
            {
                Explore.DungeonCheck(d, Create.p);
            }
            else if (choice == "h")
            {
                Utilities.Heal(Create.p);
            }
            else if (choice == "i")
            {
                Shop.ItemShop(Create.p);
            }
            else if (choice == "?")
            {
                Utilities.Help();
            }
            else if (choice == "c")
            {
                Utilities.CharacterSheet(Create.p);
            }
            else if (choice == "l")
            {
                LevelMaster.VisitLevelMaster(Create.p);
            }
            else if (choice == "t")
            {
                Tavern.Inn(Create.p);
            }
            else if (choice == "y")
            {
                House.YourHouse(Create.p);
            }
            else if (choice == "b")
            {
                Bank.GameBank(Create.p);
            }
            else if (choice == "q")
            {
                Utilities.Quit();
            }
            else if (choice == "x")
            {
                Create.p.gold += 900;
            }
            else if (choice == "o")
            {
                OtherPlaces.Other(Create.p);
            }
            GameTown();
        }
Пример #54
0
        /** 更新。
         */
        public void Main()
        {
            int t_request_index = this.request_index;

            if (this.load_work != null)
            {
                //ロード中。

                this.bank      = this.load_work;
                this.load_work = null;
            }

            if (this.unload_work != null)
            {
                //アンロード中。

                t_request_index = -1;

                if (this.mode == Mode.Wait)
                {
                    if (this.unload_work.UnloadMain() == true)
                    {
                        this.unload_work = null;
                    }
                }
            }

            switch (this.mode)
            {
            case Mode.Wait:
            {
                if (t_request_index >= 0)
                {
                    if (this.bank != null)
                    {
                        //オーディオクリップ。
                        UnityEngine.AudioClip t_audioclip = null;
                        float t_data_volume = 0.0f;
                        if (this.bank != null)
                        {
                            this.bank.GetAudioClip(t_request_index, out t_audioclip, out t_data_volume);
                        }

                        //再生。
                        this.status_list[0].time = 0.0f;

                        //設定。
                        this.audiosource[0].SetDataVolume(t_data_volume);
                        this.audiosource[0].SetOperationVolume(1.0f);
                        this.audiosource[0].SetAudioClip(t_audioclip);

                        this.audiosource[0].ApplyVolume();
                        this.audiosource[0].PlayDirect();

                        this.play_index = t_request_index;
                        this.mode       = Mode.Play0;

                        this.loopcount    = 0;
                        this.playposition = 0.0f;
                    }
                }
            } break;

            case Mode.Play0:
            case Mode.Play1:
            {
                int t_index;
                int t_index_next;
                if (this.mode == Mode.Play0)
                {
                    t_index      = 0;
                    t_index_next = 1;
                }
                else
                {
                    t_index      = 1;
                    t_index_next = 0;
                }

                if (this.play_index != t_request_index)
                {
                    //クロスフェード開始。

                    this.fadetime = 0.0f;

                    //ボリューム。
                    if (Config.BGM_PLAY_FADEIN == true)
                    {
                        this.audiosource[t_index_next].SetOperationVolume(0.0f);
                        this.audiosource[t_index_next].ApplyVolume();
                    }
                    else
                    {
                        this.audiosource[t_index_next].SetOperationVolume(1.0f);
                        this.audiosource[t_index_next].ApplyVolume();
                    }

                    //再生。
                    if (t_request_index >= 0)
                    {
                        //オーディオクリップ。
                        UnityEngine.AudioClip t_audioclip = null;
                        float t_data_volume = 0.0f;
                        if (this.bank != null)
                        {
                            this.bank.GetAudioClip(t_request_index, out t_audioclip, out t_data_volume);
                        }

                        //設定。
                        this.audiosource[t_index_next].SetDataVolume(t_data_volume);
                        this.audiosource[t_index_next].SetAudioClip(t_audioclip);
                        this.audiosource[t_index_next].PlayDirect();

                        this.status_list[t_index_next].time = 0.0f;
                    }

                    this.play_index = t_request_index;

                    if (this.mode == Mode.Play0)
                    {
                        this.mode = Mode.Cross0To1;
                    }
                    else
                    {
                        this.mode = Mode.Cross1To0;
                    }

                    this.loopcount    = 0;
                    this.playposition = 0.0f;
                }
                else
                {
                    //再生中。

                    float t_old_time = this.status_list[t_index].time;
                    this.status_list[t_index].time = this.audiosource[t_index].GetTime();
                    this.playposition = this.status_list[t_index].time;

                    if (t_old_time > this.status_list[t_index].time)
                    {
                        Tool.Log("Bgm", "loop : " + t_old_time.ToString() + " : " + this.status_list[t_index].time.ToString());
                        this.loopcount++;
                    }
                }
            } break;

            case Mode.Cross0To1:
            case Mode.Cross1To0:
            {
                int t_index;
                int t_index_next;
                if (this.mode == Mode.Cross0To1)
                {
                    t_index      = 0;
                    t_index_next = 1;
                }
                else
                {
                    t_index      = 1;
                    t_index_next = 0;
                }

                this.playposition = this.audiosource[t_index_next].GetTime();

                if (Config.BGM_PLAY_FADEIN == true)
                {
                    this.fadetime += Config.BGM_CROSSFADE_SPEED;
                }
                else
                {
                    this.fadetime = 1.0f;
                }

                if (this.fadetime < 1.0f)
                {
                    //ボリューム。
                    this.audiosource[t_index_next].SetOperationVolume(this.fadetime);
                    this.audiosource[t_index_next].ApplyVolume();
                    this.audiosource[t_index].SetOperationVolume(1.0f - this.fadetime);
                    this.audiosource[t_index].ApplyVolume();

                    //再生位置。
                    this.status_list[t_index_next].time = this.audiosource[t_index_next].GetTime();
                }
                else
                {
                    //ボリューム。
                    this.audiosource[t_index_next].SetOperationVolume(1.0f);
                    this.audiosource[t_index_next].ApplyVolume();
                    this.audiosource[t_index].SetOperationVolume(0.0f);
                    this.audiosource[t_index].ApplyVolume();

                    //停止。
                    this.status_list[t_index].time = 0.0f;

                    this.audiosource[t_index].Stop();
                    this.audiosource[t_index].SetAudioClip(null);
                    this.audiosource[t_index].SetTime(0.0f);

                    if (this.play_index < 0)
                    {
                        this.mode = Mode.Wait;
                    }
                    else if (this.mode == Mode.Cross0To1)
                    {
                        this.mode = Mode.Play1;
                    }
                    else
                    {
                        this.mode = Mode.Play0;
                    }
                }
            } break;
            }
        }
 public void AddBankDetail(Bank bank)
 {
     repository.AddBank(bank);
 }
Пример #56
0
 public DebitAccount(Client.Client client, double balance, Bank bank, double percent) : base(client, balance, bank)
 {
     _percent = percent;
 }
Пример #57
0
 public BankItemViewModel(Bank entity)
 {
     this.entity = entity;
 }
Пример #58
0
        public async Task <IActionResult> OnPostAsync(string returnUrl = null)
        {
            returnUrl = returnUrl ?? Url.Content("~/");
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = Input.Email, Email = Input.Email, Nickname = Input.Nickname
                };
                var result = await _userManager.CreateAsync(user, Input.Password);

                if (result.Succeeded)
                {
                    _logger.LogInformation("User created a new account with password.");

                    //var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
                    //var callbackUrl = Url.Page(
                    //    "/Account/ConfirmEmail",
                    //    pageHandler: null,
                    //    values: new { userId = user.Id, code = code },
                    //    protocol: Request.Scheme);

                    //await _emailSender.SendEmailAsync(Input.Email, "Confirm your email",
                    //    $"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>.");

                    //Create PlayerModel
                    PlayerModel NewPlayer = new PlayerModel();

                    NewPlayer.Nickname = Input.Nickname;
                    NewPlayer.Email    = Input.Email;

                    string playerclass = Request.Form["rdUserRole"].ToString();
                    NewPlayer.Class = playerclass;

                    NewPlayer.DateCreated = (DateTime.Now).ToString();

                    Inventory NewInventory = new Inventory();
                    await _db.Inventory.AddAsync(NewInventory);

                    NewPlayer.InventoryId = NewInventory.Id;

                    Bank NewBank = new Bank();
                    await _db.Bank.AddAsync(NewBank);

                    NewPlayer.BankId = NewBank.Id;

                    await _db.PlayerModel.AddAsync(NewPlayer);

                    await _db.SaveChangesAsync();

                    //

                    HttpContext.Session.SetObject("ssPlayerModel", NewPlayer);

                    await _signInManager.SignInAsync(user, isPersistent : false);

                    return(LocalRedirect(returnUrl));
                }
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(string.Empty, error.Description);
                }
            }

            // If we got this far, something failed, redisplay form
            return(Page());
        }
Пример #59
0
        public override Task DivideLine(string line)
        {
            if (line.Length < 5)
            {
                Console.WriteLine("Line too small, skipped.");
            }

            else if (line.Contains("'s application. ("))
            {
                Applications.Add(line);
            }
            else if (line.Contains(" has submitted an application."))
            {
                Applications.Add(line);
            }

            else if (line.Contains(" is promoting "))
            {
                RankChanges.Add(line);
            }
            else if (line.Contains(" is demoting "))
            {
                RankChanges.Add(line);
            }

            else if (line.Contains(") joined the group"))
            {
                JoinsDepartures.Add(line);
            }
            else if (line.Contains(" has kicked "))
            {
                JoinsDepartures.Add(line);
            }
            else if (line.Contains(") left the group as "))
            {
                JoinsDepartures.Add(line);
            }

            else if (line.Contains(" deposited to "))
            {
                Bank.Add(line);
            }
            else if (line.Contains(" in the group bank"))
            {
                Bank.Add(line);
            }
            else if (line.Contains(" group bank for reason:"))
            {
                Bank.Add(line);
            }
            else if (line.Contains(" withdrew "))
            {
                Bank.Add(line);
            }

            else if (line.Contains(") updated the group info"))
            {
                Management.Add(line);
            }
            else if (line.Contains(" has updated group application."))
            {
                Management.Add(line);
            }
            else if (line.Contains(" blacklist."))
            {
                Management.Add(line);
            }
            else if (line.Contains("updated the group whitelist"))
            {
                Management.Add(line);
            }

            else if (line.Contains(") warned "))
            {
                Warnings.Add(line);
            }
            else if (line.Contains(") rewarded "))
            {
                Warnings.Add(line);
            }

            else if (line.Contains(") has promoted group: "))
            {
                Management.Add(line);
            }
            else if (line.Contains(") updated rank: "))
            {
                Management.Add(line);
            }
            else if (line.Contains(") added rank: "))
            {
                Management.Add(line);
            }
            else if (line.Contains(") removed rank: "))
            {
                Management.Add(line);
            }

            else if (line.Contains("custom title"))
            {
                CustomTitle.Add(line);
            }

            else
            {
                Other.Add(line);
            }
            return(Task.CompletedTask);
        }
Пример #60
0
    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        //If current session variable exists
        if (Session["BankDB"] == null)
        {
            //if not create one
            CoGB = new Bank();
        }
        else
        {
            //if there is store in variable
            CoGB = (Bank)Session["BankDB"];
        }

        login    = Login1.UserName;
        inputPin = Login1.Password;

        //If Manager selected
        if (rblChoose.SelectedValue.Equals("Manager"))
        {
            //If login and  pin are valid for a manager
            if (CoGB.isValidManagerLogin(login, inputPin))
            {
                //if login successful reset attempts
                attempts = 0;
                //Store CoGB, login & pin in Session
                Session["BankDB"] = CoGB;
                Session["login"]  = login;
                Session["pin"]    = inputPin;

                //Go to Manager Home Page
                Response.Redirect("~/Manager/ManagerHome.aspx");
            }
            else
            {
                //if login fails check previous attaempts
                if (Session["Attempts"] != null)
                {
                    attempts = (int)Session["Attempts"];
                }
                //show error message
                Login1.FailureText = "incorrect Manager details";

                //increase number of failed attempts
                attempts++;
                CoGB.FailedLogins++;

                //if failed 3 times
                if (attempts == 3)
                {
                    //display account locked error
                    Login1.FailureText = "Invalid login. Your account has been locked";
                    //disable check boxes
                    Login1.Enabled = false;
                }

                Session["BankDB"]   = CoGB;
                Session["Attempts"] = attempts;
            }
        }
        //else if Customer selected
        else if (rblChoose.SelectedValue.Equals("Customer"))
        {
            if (CoGB.isValidAccountLogin(login, inputPin))
            {
                //if login successful reset attempts
                attempts = 0;
                //update the number of successful logins
                CoGB.TimesUsed++;
                //Store CoGB, login & pin in Session
                Session["BankDB"] = CoGB;
                Session["Login"]  = login;
                Session["Pin"]    = inputPin;

                //Go to Customer Home Page
                Response.Redirect("~/Customer/CustomerHome.aspx");
            }
            else
            {
                //if login fails check previous attaempts
                if (Session["Attempts"] != null)
                {
                    attempts = (int)Session["Attempts"];
                }
                //show error message
                Login1.FailureText = "Invalid login - try again!";

                //increase number of failed attempts
                attempts++;
                CoGB.FailedLogins++;

                //if failed 3 times
                if (attempts == 3)
                {
                    //display account locked error
                    Login1.FailureText = "Invalid login. Your account has been locked";
                    //update number of locked customer accounts
                    CoGB.CardsRetained++;
                    //reset attempts for next customer
                    attempts = 0;
                }

                Session["BankDB"]   = CoGB;
                Session["Attempts"] = attempts;
            }
        }
    }