Inheritance: MonoBehaviour
Beispiel #1
0
        //普通实现方法
        public static void Demo2()
        {
            IService s1 = new Saving();
            IService s2 = new Draw();
            IService s3 = new Fund();

            //要办理业务的三个客户队列
            List<IService> list = new List<IService>();
            list.Add(s1);
            list.Add(s2);
            list.Add(s3);

            foreach (IService item in list)
            {
                if (item is Saving)
                {
                    Console.WriteLine("存款");

                }
                else if (item is Draw)
                {
                    Console.WriteLine("取款");
                }
                else if (item is Fund)
                {
                    Console.WriteLine("基金");
                }
            }
        }
Beispiel #2
0
		public void Load()
		{
			Saving myVariables = new Saving();
			Stream stream = File.Open("MyVariables.fileExtension", FileMode.Open);
			BinaryFormatter bformatter = new BinaryFormatter();
			UnityEngine.Debug.Log("Loading variables");
			MyVariables = (Saving)bformatter.Deserialize(stream);
			Debug.Log(MyVariables.name);
			Debug.Log(MyVariables.health);
			stream.Close();
		}
Beispiel #3
0
        public void Transfer_NegativeAmount_GiveException()
        {
            Saving tranferaccount = new Saving
            {
                AccountNumber = 2345,
                Balance       = 500,
                IsActive      = true
            };

            saving.IsActive = true;
            target.Transfer(saving, tranferaccount, 1234, -200);
        }
Beispiel #4
0
        public static void Demo(String[] args)
        {
            IService s1 = new Saving();
            IService s2 = new Draw();
            IService s3 = new Fund();

            Visitor visitor = new Visitor();

            s1.Accept(visitor);
            s2.Accept(visitor);
            s3.Accept(visitor);
        }
        public ActionResult Search(SearchViewModel TheSearch, Int32 SavingID)
        {
            Saving saving = db.SavingsAccount.Find(SavingID);
            List <BankingTransaction> Transactions = SearchTransactions.Search(db, TheSearch, 2, SavingID);

            // Add the list to the view bag
            ViewBag.SavingsTransactions = Transactions;
            ViewBag.Ranges       = SearchTransactions.AmountRange();
            ViewBag.Dates        = SearchTransactions.DateRanges();
            ViewBag.ResultsCount = Transactions.Count;
            return(View("Details", saving));
        }
Beispiel #6
0
        public async Task <IActionResult> Create([Bind("Id,type,accountNumber,CustomerId,InterestRate,Balance,createdAt,status,period,dateAndTime")] Saving saving)
        {
            if (ModelState.IsValid)
            {
                _context.Add(saving);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "Id", saving.CustomerId);
            return(View(saving));
        }
        /// <summary>
        /// Serialize settings values and write to given Stream</summary>
        /// <remarks>For use by SettingsLoadSaveDialog only</remarks>
        /// <param name="stream">Stream settings values written to</param>
        protected void Serialize(Stream stream)
        {
            Saving.Raise(this, EventArgs.Empty);

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.AppendChild(xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "yes"));
            XmlElement root = xmlDoc.CreateElement("settings");

            xmlDoc.AppendChild(root);

            // add application name and version to the root element.
            root.SetAttribute("appName", m_applicationName);
            root.SetAttribute("appVersion", m_versionString);

            foreach (SettingsInfo info in m_settings.Values)
            {
                XmlElement block = xmlDoc.CreateElement("block");
                block.SetAttribute("id", info.Name);

                foreach (SettingsInfo.Setting setting in info.Settings.Values)
                {
                    PropertyDescriptor descriptor = setting.PropertyDescriptor;
                    if (descriptor != null)
                    {
                        object value = descriptor.GetValue(null);
                        if (CanWriteValue(value))
                        {
                            WriteValue(descriptor.Name, value, block);
                        }
                    }
                    else
                    {
                        WriteValue(setting.Name, setting.ValueString, block);
                    }
                }
                // skip empty block
                if (block.ChildNodes.Count > 0)
                {
                    root.AppendChild(block);
                }
            }

            XmlWriterSettings settings = new XmlWriterSettings();

            settings.CloseOutput = false;
            settings.Indent      = true;

            using (XmlWriter writer = XmlWriter.Create(stream, settings))
            {
                xmlDoc.WriteTo(writer);
            }
        }
Beispiel #8
0
        public void Transfer_InvalidAccountReciver_GiveException()
        {
            Saving tranferaccount = new Saving
            {
                AccountNumber = 2345,
                Balance       = 500,
                IsActive      = false
            };

            saving.IsActive = true;
            target.Transfer(saving, tranferaccount, 1234, 60);
        }
        public Saving Delete(int savingID)
        {
            Saving dbEntry = context.Savings.Find(savingID);

            if (dbEntry != null)
            {
                context.Savings.Remove(dbEntry);
                context.SaveChanges();
            }

            return(dbEntry);
        }
Beispiel #10
0
        public void Transfer_AmountMoreThanBAlance_GiveException()
        {
            Saving tranferaccount = new Saving
            {
                AccountNumber = 2345,
                Balance       = 500,
                IsActive      = true
            };

            saving.IsActive = true;
            target.Transfer(saving, tranferaccount, 1234, 90000000);
        }
 public static void SetTitaniumObtained()
 {
     Saving.SaveTitanium();
     if ((Saving.savedTitanium) >= 100000)
     {
         upgradeMenu.Find("AscensionValue").GetComponent <Text>().text = Math.Floor((Saving.savedTitanium)).ToString("0.0##e+00") + " T";
     }
     else
     {
         upgradeMenu.Find("AscensionValue").GetComponent <Text>().text = Math.Floor((Saving.savedTitanium)).ToString() + " T";
     }
 }
Beispiel #12
0
 public void Toggle()
 {
     Saving.ToggleSetting(Saving.SettingKey.hasPartDLC);
     Ref.hasPartsExpansion = Saving.LoadSetting(Saving.SettingKey.hasPartDLC);
     if (Build.main != null)
     {
         Build.main.buildGrid.SetBuildGridSize();
         Build.main.pickGrid.SelectPickList(Build.main.pickGrid.selectedListId);
         Build.main.PositionCameraStart();
     }
     MonoBehaviour.print(Saving.LoadSetting(Saving.SettingKey.hasPartDLC));
 }
Beispiel #13
0
        public async Task <IActionResult> PostSavingItem(Saving item)
        {
            if (!ModelState.IsValid)

            {
                return(ValidationProblem(ModelState));
            }
            _context.Savings.Add(item);
            await _context.SaveChangesAsync();

            return(StatusCode(201));
        } // PUT: api/Todo/5
        public int AddSaving(Saving saving, Warehouse warehouse)
        {
            saving.Id = IdCounter;
            if (ValidateSavingInput(saving))
            {
                Flag = 1;
            }

            Savings.Add(saving);
            IdCounter++;
            return(Flag);
        }
Beispiel #15
0
        private DataRow CalcSpecjal(DataRow Action, string Rewizja, decimal Euro, ref DataTable ANC, ref DataTable PNC)
        {
            int     Month        = MonthStart[Action["StartMonth"].ToString()];
            int     RewizjaMonth = RevisionStartMonth[Rewizja];
            decimal Delta;
            decimal SteadyQuantity;
            decimal SteadySaving   = 0;
            decimal FiscalQunatity = 0;
            decimal FiscalSavings  = 0;
            decimal Probalility    = 100;
            string  Quantity;
            string  Saving;
            string  ECCC;

            ECCC     = Action["Calc" + Rewizja + "ECCC"].ToString();
            Quantity = Action["Calc" + Rewizja + "Quantity"].ToString();
            Saving   = Action["Calc" + Rewizja + "Saving"].ToString();

            if ((Saving.Split('/'))[12].ToString() != "")
            {
                FiscalSavings = decimal.Parse((Saving.Split('/'))[12].ToString());
            }
            if ((ECCC.Split('/'))[12].ToString() != "")
            {
                FiscalSavings = FiscalSavings + decimal.Parse((ECCC.Split('/'))[12].ToString());
            }
            if ((Quantity.Split('/'))[12].ToString() != "")
            {
                FiscalQunatity = decimal.Parse((Quantity.Split('/'))[12].ToString());
            }

            FiscalSavings = FiscalSavings / Euro;
            FiscalSavings = Math.Round(FiscalSavings, 0, MidpointRounding.AwayFromZero);

            Delta = FiscalSavings / FiscalQunatity;
            Delta = Math.Round(Delta, 4, MidpointRounding.AwayFromZero);

            FiscalSavings = FiscalSavings / 1000;

            SteadyQuantity = SteadyQuantityBring(Action, Rewizja, ref ANC, ref PNC);


            Action[Rewizja] = Month.ToString() + "|";
            Action[Rewizja] = Action[Rewizja].ToString() + Delta.ToString() + "|";
            Action[Rewizja] = Action[Rewizja].ToString() + SteadyQuantity.ToString() + "|";
            Action[Rewizja] = Action[Rewizja].ToString() + SteadySaving.ToString() + "|";
            Action[Rewizja] = Action[Rewizja].ToString() + FiscalQunatity.ToString() + "|";
            Action[Rewizja] = Action[Rewizja].ToString() + Probalility.ToString() + "|";
            Action[Rewizja] = Action[Rewizja].ToString() + FiscalSavings.ToString() + "|";

            return(Action);
        }
Beispiel #16
0
    public void LoadTutorial(string data)
    {
        var split = data.IndexOf("/");

        name = Saving.FindUnusedName(Saving.FixName(data.Substring(5, split - 5)));
        data = data.Substring(split + 1);

        SceneData.Name          = name;
        SceneData.Data          = data;
        SceneData.IsTutorial    = true;
        SceneData.AllowAutosave = false;
        SceneManager.LoadScene("Editor");
    }
Beispiel #17
0
    public void OnEventReceived()
    {
        Debug.Log("Saving received LevelCompleteEvent");
        if (currentSave == null)
        {
            currentSave = Saving.LoadSave();
        }
        string levelCompletedId = EventManager.GetString(GameConstants.LevelCompleteEvent);
        Level  completedLevel   = currentSave.getLevelById(levelCompletedId);

        completedLevel.setLevelStatus(2);
        SaveGame();
    }
Beispiel #18
0
        public void Transfer_OnSuccess_BalaceMatchsenderReceiver()
        {
            Saving tranferaccount = new Saving
            {
                AccountNumber = 2345,
                Balance       = 500,
                IsActive      = true
            };

            saving.IsActive = true;
            target.Transfer(saving, tranferaccount, 1234, 100);
            Assert.AreEqual(tranferaccount.Balance, 500 + 100);
        }
Beispiel #19
0
		public void save()
		{

			Saving MyVariables = new Saving();
			MyVariables.health = health;
			MyVariables.name = name;
			Stream stream = File.Open("MyVariables.randomfileextension", FileMode.Create);
			BinaryFormatter bformatter = new BinaryFormatter();
			Debug.Log("saving Variables");
			bformatter.Serialize(stream, MyVariables);
			stream.Close();
			
		}
        public void OnOk()
        {
            var walletName = nameOfWallet.text;
            var currency   = (Currency)typeOfCurrency.value;
            var wallet     = new Saving
            {
                name     = walletName,
                currency = currency
            };

            UserDataManager.AddSaving(wallet);
            gameObject.SetActive(false);
        }
Beispiel #21
0
 public void BuyFR()
 {
     FindObjectOfType <AudioManager>().Play("Click");
     if (Weapon.scrapsNum >= UpgradesSystem.CalculateScrapsCost(Weapon.fireRate.ToString()))
     {
         Weapon.scrapsNum -= UpgradesSystem.CalculateScrapsCost(Weapon.fireRate.ToString());
         Weapon.fireRate  += 1f;
     }
     Saving.SaveState();
     Saving.LoadState();
     Saving.LoadUpgradesText();
     Saving.LoadScrapsText();
 }
Beispiel #22
0
        static void Main(string[] args)
        {
            var p = new Printing();
            var s = new Saving();


            Console.WriteLine($"Printing is {(p.FeatureEnabled ? "on" : "off")}");
            Console.WriteLine($"Saving is {(s.FeatureEnabled ? "on" : "off")}");



            Console.ReadLine();
        }
Beispiel #23
0
        public void AddSaving()
        {
            string savingDefaultName = CreateUniqueName("Oszczędności", Savings.Select(x => x.Name).ToList());
            var    cashFlowGroup     = Database.Query <CashFlowGroup>("WHERE Name = 'Oszczędności'").First();
            var    saving            = new Saving
            {
                Name = savingDefaultName,
            };

            saving.CashFlow.Group = cashFlowGroup;
            SaveSaving(saving);
            LoadSavingsData();
        }
Beispiel #24
0
 public void SaveAs(string path)
 {
     Project.RaiseDocumetSaving(this);
     Saving?.Invoke(this);
     History.AddSavePoint();
     Path = path;
     WriteNodeToFile(path, Format, RootNodeUnwrapped);
     if (Format == DocumentFormat.Scene || Format == DocumentFormat.Tan)
     {
         DocumentPreview.AppendToFile(Project.Current.GetSystemPath(path, GetFileExtension(Format)), Preview);
     }
     SetModificationTimeToNow();
     Project.Current.AddRecentDocument(Path);
 }
Beispiel #25
0
 public ActionResult Edit(Saving saving)
 {
     if (ModelState.IsValid)
     {
         repository.Save(saving);
         TempData["message"] = string.Format("Zaktualizowano {0}", saving.Description);
         return(RedirectToAction("Index"));
     }
     else
     {
         ViewBag.Category = new SelectList(categoryRepository.Categories.Where(x => x.Type == "Saving"), "Name", "Name");
         return(View(saving));
     }
 }
        private Saving CreateNewSaving(User user, PhraseWithMailToSave inputObject)
        {
            var dateOfSave = DateTime.Now;

            var saving = new Saving()
            {
                CalculationValue = RemoveWhiteSpaces(input: inputObject.PhraseToSave),
                DateOnServer     = dateOfSave,
                DateOnClient     = inputObject.DateOnClient,
                UserId           = user.Id
            };

            return(saving);
        }
Beispiel #27
0
    public void LoadPlayer()
    {
        PlayerData1 data = Saving.LoadPlayer(); //set the player data to the saved value

        level  = data.level;
        health = data.health;



        sphereMat.r = data.posistion[0];
        sphereMat.g = data.posistion[1];
        sphereMat.b = data.posistion[2];
        sphereMat.a = data.posistion[3];
    }
Beispiel #28
0
        public void Close_BalanceNotZero_ShouldThrowException()
        {
            Saving saving = new Saving
            {
                Name     = "name",
                Pin      = 1234,
                Balance  = 500,
                IsActive = true
            };

            bool res = target.Close(saving);

            Assert.IsFalse(saving.IsActive);
        }
        private static List <Account> CreateAccountList()
        {
            List <Account> accounts = new List <Account>();

            Current a1 = new Current("Chacha", "123");
            Current a2 = new Current("Michael", "876");
            Saving  a3 = new Saving("Ferouz", "789", 1000);

            accounts.Add(a1);
            accounts.Add(a2);
            accounts.Add(a3);

            return(accounts);
        }
        private void RefreshUISaveSlots()
        {
            int slotIndex = 0;

            foreach (Saving.LoadedData data in Saving.LoadAllSlotData())
            {
                uiSaveSlots[slotIndex].SetUp(slotIndex,
                                             data,
                                             OverwriteSave,
                                             LoadSave);

                slotIndex++;
            }
        }
Beispiel #31
0
        public async Task CreateSavingAndPushToDbAsync(AddViewModel model)
        {
            Saving saving = new Saving()
            {
                Name        = model.Name,
                Amount      = model.Amount,
                User        = _user,
                DateCreated = DateTime.Now
            };

            await _db.Savings.AddAsync(saving);

            await _db.SaveChangesAsync();
        }
        // GET: Savings/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Saving saving = db.SavingsAccount.Find(id);

            if (saving == null)
            {
                return(HttpNotFound());
            }
            return(View(saving));
        }
Beispiel #33
0
 public void BuyAS()
 {
     FindObjectOfType <AudioManager>().Play("Click");
     if (Saving.savedTitaniumHolder >= UpgradesSystem.CalculateTitaniumCost(Weapon.asteroidScrap.ToString()))
     {
         Saving.savedTitaniumHolder -= UpgradesSystem.CalculateTitaniumCost(Weapon.asteroidScrap.ToString());
         Weapon.asteroidScrap       += 1f;
     }
     Saving.SaveState();
     Saving.LoadState();
     Saving.LoadUpgradesText();
     Saving.LoadTitaniumText();
     Saving.LoadScrapsText();
 }
Beispiel #34
0
        /// <summary>
        /// 保存临时程序集,本方法只能被调用一次,用于在调试中检查生成后的代码;
        /// </summary>
        public static void SaveTempAssembly()
        {
            ///.net core 中已经移除<see cref="AssemblyBuilder.Save(string)"/>,故.net core 中将不能保存程序集;
#if NETFRAMEWORK
            try
            {
                Saving?.Invoke(null, EventArgs.Empty);
                AsmBuilder.Save(TidaAsmName + ".dll");
            }
            catch (Exception ex) {
                LoggerService.WriteException(ex);
            }
#endif
        }
Beispiel #35
0
        public void CalculateInterest_OneDay()
        {
            SavingProduct product = new SavingProduct
            {
                Id = 1,
                InterestBase = OSavingInterestBase.Monthly,
                InterestFrequency = OSavingInterestFrequency.EndOfYear,
                CalculAmountBase = OSavingCalculAmountBase.MinimalAmount
            };
            Saving saving = new Saving(ApplicationSettings.GetInstance(""), new User(),
                1000, new DateTime(2009, 07, 01)) { Product = product, InterestRate = 0.1 };

            List<SavingInterestsAccrualEvent> list = new List<SavingInterestsAccrualEvent>();
            list = saving.CalculateInterest(new DateTime(2009, 07, 02), new User { Id = 1 });

            Assert.AreEqual(list.Count, 0);
        }
Beispiel #36
0
 public Weekly(Saving pSaving, User pUser, int pWeekEndDay2)
 {
     _saving = pSaving;
     _user = pUser;
     _weekEndDay2 = pWeekEndDay2;
 }
Beispiel #37
0
 public EndOfMonth(Saving pSaving, User pUser)
 {
     _saving = pSaving;
     _user = pUser;
 }
Beispiel #38
0
        public void CalculateInterest_OneMonth_Withdraw_FirstDayOfMonth()
        {
            SavingProduct product = new SavingProduct
            {
                Id = 1,
                InterestBase = OSavingInterestBase.Monthly,
                InterestFrequency = OSavingInterestFrequency.EndOfYear,
                CalculAmountBase = OSavingCalculAmountBase.MinimalAmount
            };
            Saving saving = new Saving(ApplicationSettings.GetInstance(""), new User(),
                1000, new DateTime(2009, 01, 01)) { Product = product, InterestRate = 0.1 };

            saving.Withdraw(100, new DateTime(2009, 01, 01), "retrait", new User());

            List<SavingInterestsAccrualEvent> list = new List<SavingInterestsAccrualEvent>();
            list = saving.CalculateInterest(new DateTime(2009, 02, 01), new User { Id = 1 });

            Assert.AreEqual(list.Count, 1);
            Assert.AreEqual(list[0].Amount, 90);
        }
Beispiel #39
0
 public Monthly(Saving pSaving, User pUser)
 {
     _saving = pSaving;
     _user = pUser;
 }
Beispiel #40
0
 public EndOfDay(Saving pSaving, User pUser)
 {
     _saving = pSaving;
     _user = pUser;
 }
Beispiel #41
0
 public void Process(Saving service)
 {
     // 存款
     Console.WriteLine("存款");
 }