示例#1
0
        private static void Transform()
        {
            DataTable shippers = _invoiceTable.Tables[0].DefaultView.ToTable(true, new[] { "ShipperName" });

            _freightByShipperList = new List <FreightByShipper>();
            foreach (DataRow row in shippers.Rows)
            {
                Console.WriteLine("{0}", row[0]);
                var myShipper = new FreightByShipper {
                    ShipperName = row[0].ToString()
                };
                myShipper.Freight = CalculateFreightForShipper(myShipper.ShipperName);
                _freightByShipperList.Add(myShipper);
            }
            var totalFreight = (decimal)_invoiceTable.Tables[0].Compute("sum(freight)", "");

            Console.WriteLine("Total Freight: " + totalFreight);

            _employees = new List <IEmployee>();
            foreach (DataRow row in _employeeTable.Tables[0].Rows)
            {
                var employee = CheckManager.GetEmployee((int)row[1]);
                employee.Name = row[0].ToString();
                _employees.Add(employee);
            }
            foreach (Employee employee in _employees)
            {
                employee.SetBonus(totalFreight);
            }
        }