/// <summary> /// Fills data with rows loaded from PrintHoursForProjectsGateway /// </summary> /// <param name="companyId">companyId</param> public void FillData(int companyId) { // Fill rows from original data PrintHoursForProjectOriginalGateway originalGateway = new PrintHoursForProjectOriginalGateway(Data); foreach (PrintHoursForProjectTDS.OriginalRow originalRow in (PrintHoursForProjectTDS.OriginalDataTable)originalGateway.Table) { PrintHoursForProjectTDS.PrintHoursForProjectRow newRow = ((PrintHoursForProjectTDS.PrintHoursForProjectDataTable)Table).NewPrintHoursForProjectRow(); newRow.ClientID = originalRow.ClientID; newRow.ClientName = originalRow.ClientName; newRow.ProjectName = originalRow.ProjectName; newRow.CountryID = originalRow.CountryID; newRow.CountryName = originalRow.CountryName; newRow.EmployeeID = originalRow.EmployeeID; newRow.EmployeeName = originalRow.EmployeeName; newRow.Type = originalRow.Type; newRow.Date_ = originalRow.Date_; if (originalRow.CountryID == 1) { newRow.TimeCA = originalRow.ProjectTime; newRow.TimeUS = 0; } else { newRow.TimeCA = 0; newRow.TimeUS = originalRow.ProjectTime; } if ((originalRow.WorkingDetails == "Sick Day") || (originalRow.WorkingDetails == "Holiday") || (originalRow.WorkingDetails == "Vacation / Other")) { newRow.WorkingDetails = originalRow.WorkingDetails; } else { newRow.WorkingDetails = ""; } if (!originalRow.IsMealsCountryNull()) { if (originalRow.MealsCountry == 1) { newRow.MealsCA = true; newRow.MealsUS = false; newRow.TotalCA = originalRow.MealsAllowance; newRow.TotalUS = 0; } else { newRow.MealsCA = false; newRow.MealsUS = true; newRow.TotalCA = 0; newRow.TotalUS = originalRow.MealsAllowance; } } else { newRow.MealsCA = false; newRow.MealsUS = false; newRow.TotalCA = 0; newRow.TotalUS = 0; } if (!originalRow.IsCommentsNull()) { newRow.Comments = originalRow.Comments; } if (!originalRow.IsUnitIDNull()) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGatewayForUnit = new UnitInformationUnitDetailsGateway(); unitInformationUnitDetailsGatewayForUnit.LoadAllByUnitId(originalRow.UnitID, companyId); newRow.Unit = unitInformationUnitDetailsGatewayForUnit.GetUnitCode(originalRow.UnitID); } if (!originalRow.IsProjectTimeStateNull()) { newRow.ProjectTimeState = originalRow.ProjectTimeState; } else { newRow.ProjectTimeState = "New"; } if (!originalRow.IsTowedUnitIDNull()) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGatewayForTowedUnit = new UnitInformationUnitDetailsGateway(); unitInformationUnitDetailsGatewayForTowedUnit.LoadAllByUnitId(originalRow.TowedUnitID, companyId); newRow.Towed = unitInformationUnitDetailsGatewayForTowedUnit.GetUnitCode(originalRow.TowedUnitID); } ((PrintHoursForProjectTDS.PrintHoursForProjectDataTable)Table).AddPrintHoursForProjectRow(newRow); } }