Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            LegalAmount legalAmount = db.LegalAmounts.Find(id);

            db.LegalAmounts.Remove(legalAmount);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "LegalAmountId,ValidDate,FullDayAmount,HalfDayAmount,NightAmount,MilageAmount")] LegalAmount legalAmount)
 {
     if (ModelState.IsValid)
     {
         db.Entry(legalAmount).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(legalAmount));
 }
Пример #3
0
        public ActionResult Create([Bind(Include = "LegalAmountId,ValidDate,FullDayAmount,HalfDayAmount,NightAmount,MilageAmount")] LegalAmount legalAmount)
        {
            if (ModelState.IsValid)
            {
                db.LegalAmounts.Add(legalAmount);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(legalAmount));
        }
Пример #4
0
        // GET: LegalAmounts/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LegalAmount legalAmount = db.LegalAmounts.Find(id);

            if (legalAmount == null)
            {
                return(HttpNotFound());
            }
            return(View(legalAmount));
        }
Пример #5
0
 // Calculates the sum of all allowances for current travel report
 //
 // Returns the sum if allowanse is according to tax rules, that is away for at least one night
 // Otherwise returns 0
 /// <summary>
 /// Calculates the sum of all allowances for current travel report
 /// </summary>
 /// <param name="travelReport"></param>
 /// <param name="legalAmount"></param>
 /// <returns>Returns the sum if allowanse is according to tax rules, that is if the traveller is away for at least one night
 /// Otherwise returns 0</returns>
 public decimal SumOfAllowance(TravelReport travelReport, LegalAmount legalAmount)
 {
     if (travelReport.Night != 0)
     {
         int allowanceSum = 0;
         allowanceSum = allowanceSum + (int)travelReport.Night * (int)legalAmount.NightAmount;
         allowanceSum = allowanceSum + (int)travelReport.FullDay * (int)legalAmount.FullDayAmount;
         allowanceSum = allowanceSum + (int)travelReport.HalfDay * (int)legalAmount.HalfDayAmount;
         allowanceSum = allowanceSum - (int)travelReport.BreakfastDeduction * (int)legalAmount.BreakfastAmount;
         allowanceSum = allowanceSum - (int)travelReport.LunchOrDinnerDeduction * (int)legalAmount.LunchOrDinnerAmount;
         allowanceSum = allowanceSum - (int)travelReport.LunchAndDinnerDeduction * (int)legalAmount.LunchAndDinnerAmount;
         allowanceSum = allowanceSum - (int)travelReport.AllMealsDeduction * (int)legalAmount.AllMealsAmount;
         return((decimal)allowanceSum);
     }
     else
     {
         return(0);
     }
 }