Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        emiNumber = 0;
        SetEmiAmount();

        emi = (Emi)AssetDatabase.LoadAssetAtPath("Assets/Prefab/Drops/1Emi.prefab", typeof(Emi));
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        arrow    = GameObject.Find("ArrowPivot");
        _3dSword = GameObject.Find("3DBlade");
        _3dPivot = GameObject.Find("3DPivot");

        rb = GetComponent <Rigidbody>();

        //exclamationPoint is Sprite's child
        exclamationPoint = this.gameObject.transform.GetChild(0).GetChild(1).gameObject;
        exclamationPoint.SetActive(false);

        health = maxHealth;
        hp     = GameObject.FindGameObjectWithTag("HP").GetComponent <Image>();
        SetHealthAmount();

        cosmicPower = maxCP;
        cp          = GameObject.FindGameObjectWithTag("CP").GetComponent <Image>();
        SetCosmicPowerAmount();

        emiNumber = 0;
        SetEmiAmount();

        emi = (Emi)AssetDatabase.LoadAssetAtPath("Assets/Prefab/Drops/1Emi.prefab", typeof(Emi));

        eQ = FindObjectOfType <EquipLoaded>();

        nMA = GetComponent <NavMeshAgent>();

        mM = FindObjectOfType <MenuManager>();
    }
        public ActionResult Approve(int id)
        {
            var application = context.CustomerLoanMortages.Find(id);

            try
            {
                application.LoanStatus = "approve";
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                Session.Add("ErrorMessage", ex.Message);
                return(View("ErrorView"));
            }

            //emi calculation
            var p = application.Amount;
            var r = application.InterestRate / 1200;
            var n = application.LoanTenure * 12;

            var emiAmt = (p * r * Math.Pow((1 + r), n)) / (Math.Pow((1 + r), n) - 1);

            var totalAmt = emiAmt * n;

            //date calculation
            var date  = 5;
            var month = DateTime.Now.Month;
            var year  = DateTime.Now.Year;

            DateTime dateTime = new DateTime(year, month, date).AddMonths(1);

            Emi emi = new Emi()
            {
                AmountToPaid   = totalAmt,
                MonthlyAmt     = emiAmt,
                OutstandingBal = totalAmt,
                LDayOfPayment  = null,
                NDayOfPayment  = dateTime,
                LoanNumber     = application.LoanNumber
            };

            try
            {
                context.Emis.Add(emi);

                context.SaveChanges();
            }
            catch (Exception ex)
            {
                Session.Add("ErrorMessage", ex.Message);
                return(View("ErrorView"));
            }

            return(RedirectToAction("New"));
        }