当前位置: 首页>>代码示例>>C#>>正文


C# List.Sum方法代码示例

本文整理汇总了C#中Library.List.Sum方法的典型用法代码示例。如果您正苦于以下问题:C# List.Sum方法的具体用法?C# List.Sum怎么用?C# List.Sum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Library.List的用法示例。


在下文中一共展示了List.Sum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: frmRpt_SplitPayment_BookingRs

        public frmRpt_SplitPayment_BookingRs(NewPaymentEN aNewPaymentEN,int IndexSub)
        {
            InitializeComponent();
            this.aNewPaymentEN = aNewPaymentEN;
            this.IndexSub = IndexSub;
            try
            {
                lblNumberVote.Text = Convert.ToString(this.aNewPaymentEN.IDBookingR);
                lblIIDBookingR.Text = Convert.ToString(this.aNewPaymentEN.IDBookingR);
                lblNameCustomer.Text = aNewPaymentEN.NameCustomer;
                lblGroup.Text = aNewPaymentEN.NameCustomerGroup;
                lblCompany.Text =aNewPaymentEN.NameCompany;
                lblTaxNumberCode.Text =aNewPaymentEN.TaxNumberCodeCompany;

                int day = DateTime.Now.Day;
                int month = DateTime.Now.Month;
                int year = DateTime.Now.Year;
                lblDayMonthYear.Text = "Hà Nội, ngày " + day.ToString() + " tháng " + month.ToString() + " năm " + year.ToString();

                //------------- Phong ------------------------
                List<BookingRoomUsedEN> aListBookingRoomUsedEN = new List<BookingRoomUsedEN>();
                aListBookingRoomUsedEN = aNewPaymentEN.aListBookingRoomUsed.Where(r => r.IndexSubPayment == this.IndexSub).OrderBy(r => r.RoomSku).ToList();

                aListServiceUsed = aNewPaymentEN.GetAllServiceUsedInRoom().Where(r => r.IndexSubPayment == this.IndexSub).OrderBy(r => r.Sku).ToList();
                //Lấy List< IDServiceGroup>
                List<int> aTemp = new List<int>();
                int IDServiceGroup;
                foreach (ServiceUsedEN item in aListServiceUsed)
                {
                    IDServiceGroup = new int();

                    IDServiceGroup = item.IDServiceGroup;
                    aTemp.Add(IDServiceGroup);
                }
                aListIDServicesGroup = aTemp.Distinct().ToList();

                ServiceGroupEN aServicesGroupEN;
                ServiceGroupsBO aServiceGroupsBO = new ServiceGroupsBO();

                foreach (int item in aListIDServicesGroup)
                {
                    aServicesGroupEN = new ServiceGroupEN();
                    aServicesGroupEN.IDServiceGroup = item;
                    aServicesGroupEN.TotalMoneyBeforeTax = this.GetTotalMoneyServiceGroupBeforeTax(item);
                    aServicesGroupEN.DisplayMoneyTax = aNewPaymentEN.GetMoneyTax(this.GetTotalMoneyServiceGroupBeforeTax(item), 10);
                    aServicesGroupEN.TotalMoneyAfterTax = this.GetTotalMoneyServiceGroupAfterTax(item);
                    aServicesGroupEN.ServiceGroupName = aServiceGroupsBO.Sel_ByID(item).Name;
                    aListServicesGroupEN.Add(aServicesGroupEN);
                }

                decimal? sumMoneyRoomBeforeTax = aListBookingRoomUsedEN.Sum(r => r.GetOnlyMoneyRoomBeforeTax());
                decimal? SumMoneyTaxRoom = aListBookingRoomUsedEN.Sum(r => r.GetOnlyMoneyRoom());
                decimal? sumMoneyRoomAfterTax = aListBookingRoomUsedEN.Sum(r => r.GetOnlyMoneyRoom());

                decimal? sumMoneyServiceRoomBeforeTax = aListServicesGroupEN.Sum(s => s.TotalMoneyBeforeTax);
                decimal? sumMoneyTaxServices = aListServicesGroupEN.Sum(s => s.DisplayMoneyTax);
                decimal? sumMoneyServiceRoomAfterTax = aListServicesGroupEN.Sum(s => s.TotalMoneyAfterTax);

                decimal? BookingMoneyR = 0;

                //danh sach phong
                this.DetailReport.DataSource = aListBookingRoomUsedEN;
                colSkuRoom.DataBindings.Add("Text", this.DetailReport.DataSource, "RoomSku");
                colCheckIn.DataBindings.Add("Text", this.DetailReport.DataSource, "CheckInActual", "{0:dd-MM-yyyy HH:mm}");
                colCheckOut.DataBindings.Add("Text", this.DetailReport.DataSource, "CheckOutActual", "{0:dd-MM-yyyy HH:mm}");
                colBookingRoomCost.DataBindings.Add("Text", this.DetailReport.DataSource, "Cost", "{0:0,0.##}");
                colDateInUse.DataBindings.Add("Text", this.DetailReport.DataSource, "DateUsed", "{0:0,0.##}");
                colMoneyRoomBeforeTax.DataBindings.Add("Text", this.DetailReport.DataSource, "MoneyRoomBeforeTax", "{0:0,0}");
                colPercentTaxRoom.DataBindings.Add("Text", this.DetailReport.DataSource, "DisplayMoneyTaxRoom", "{0:0,0}");
                colPaymentMoneyaRoom.DataBindings.Add("Text", this.DetailReport.DataSource, "MoneyRoom", "{0:0,0}");

                //tong tien phong truoc thue
                lblSumMoneyRoomsBeforeTax.Text = String.Format("{0:0,0}", sumMoneyRoomBeforeTax);
                //Tien thue phong
                lblSumMoneyRoomTax.Text = String.Format("{0:0,0}", SumMoneyTaxRoom);
                //tong tien phong sau thue
                lblSumMoneyRoomsAfterTax.Text = String.Format("{0:0,0}", sumMoneyRoomAfterTax);

                //danh sach dich vu
                this.DetailReport2.DataSource = aListServicesGroupEN;
                colNamService.DataBindings.Add("Text", this.DetailReport2.DataSource, "ServiceGroupName");
                colTotalMoneyBeforeTax.DataBindings.Add("Text", this.DetailReport2.DataSource, "TotalMoneyBeforeTax", "{0:0,0}");
                colPercentTaxService.DataBindings.Add("Text", this.DetailReport2.DataSource, "DisplayMoneyTax", "{0:0,0}");
                colTotalMoneyServiceAfterTax.DataBindings.Add("Text", this.DetailReport2.DataSource, "TotalMoneyAfterTax", "{0:0,0}");

                //tong tien dich vu truoc thue
                lblSumMoneyService_BookingRBeforeTax.Text = String.Format("{0:0,0}", sumMoneyServiceRoomBeforeTax);
                //Tien thue dich vu
                lblSumMoneyServiceTax.Text = String.Format("{0:0,0}", sumMoneyTaxServices);
                //tong tien dich vu sau thue
                lblSumMoneyService_BookingRAfterTax.Text = String.Format("{0:0,0}", sumMoneyServiceRoomAfterTax);

                //tong tien thanh toan truoc thue
                lblTotalMoneyBookingRBeforeTax.Text = String.Format("{0:0,0}", (sumMoneyRoomBeforeTax + sumMoneyServiceRoomBeforeTax));
                //Tong tien thue
                lblTotalMoneyTax.Text = String.Format("{0:0,0}", (SumMoneyTaxRoom + sumMoneyTaxServices));
                //tong tien thanh toan sau thue
                lblTotalMoneyBookingRAfterTax.Text = String.Format("{0:0,0}", (sumMoneyRoomAfterTax + sumMoneyServiceRoomAfterTax));
                //So tien ung truoc
                lblBookingMoney_BookingR.Text = String.Format("{0:0,0}", BookingMoneyR);
//.........这里部分代码省略.........
开发者ID:BruceleeThanh,项目名称:Pro_Government_2307,代码行数:101,代码来源:frmRpt_SplitPayment_BookingRs.cs


注:本文中的Library.List.Sum方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。