コード例 #1
0
ファイル: Diner.cs プロジェクト: gspeedtech/GregsCommon
        public List <TipItem> AddDinerTipItems(Check Check)
        {
            foreach (var Id in Check.items.Select(x => x.DinerId).Distinct())
            {
                double  itemTotal = 0;
                TipItem tipItem   = new TipItem();
                foreach (var row in Check.items.Where(y => y.DinerId == Id))
                {
                    itemTotal += row.Price;
                }
                tipItem.PartyId    = 0;
                tipItem.DinerId    = Id;
                tipItem.ItemTotal  = itemTotal;
                tipItem.TipAmount  = Math.Round((itemTotal * Check.CheckTipPercentage), 2);
                tipItem.TipPercent = Check.CheckTipPercentage;
                tipItem.Diviser    = 1;
                dinerTipItems.Add(tipItem);
            }

            return(dinerTipItems);
        }
コード例 #2
0
ファイル: Party.cs プロジェクト: gspeedtech/GregsCommon
        public List<TipItem> AddPartyTipItems(Check Check)
        {
            foreach (var Id in Check.items.Select(x => x.PartyId).Distinct())
            {
                double itemTotal = 0;
                TipItem tipItem = new TipItem();
                foreach (var row in Check.items.Where(y => y.PartyId == Id))
                {
                    itemTotal += row.Price;
                }
                tipItem.PartyId = Id;
                tipItem.DinerId = 0;
                tipItem.ItemTotal = itemTotal;
                tipItem.TipAmount = Math.Round((itemTotal * Check.CheckTipPercentage), 2);
                tipItem.TipPercent = Check.CheckTipPercentage;
                tipItem.Diviser = 1;
                partyTipItems.Add(tipItem);
            }

            return partyTipItems;
        }