private void PostPageChanges() { EmployeeGateway employeeGateway = new EmployeeGateway(new DataSet()); int employeeId = employeeGateway.GetEmployeIdByLoginId(Convert.ToInt32(Session["loginID"])); projectTimeTDSToSave = new ProjectTimeTDS(); LiquiForce.LFSLive.BL.LabourHours.ProjectTime.ProjectTime projectTime = new LiquiForce.LFSLive.BL.LabourHours.ProjectTime.ProjectTime(projectTimeTDS); projectTime.Insert(projectTimeTDSToSave, employeeId); }
/// <summary> /// Insert /// </summary> /// <param name="projectTimeTDSToSave">projectTimeTDSToSave</param> public void Insert(ProjectTimeTDS projectTimeTDSToSave, int createdById) { foreach (ProjectTimeTDS.LFS_PROJECT_TIME_TEMPRow projectTimeRow in ((ProjectTimeTDS)Data).LFS_PROJECT_TIME_TEMP) { if (!projectTimeRow.Deleted) { int employeeId = projectTimeRow.EmployeeID; int companiesId = projectTimeRow.CompaniesID; int projectId = projectTimeRow.ProjectID; DateTime date_ = projectTimeRow.Date_; DateTime? startTime = null; if (!projectTimeRow.IsStartTimeNull()) { string[] startTimeSplit = projectTimeRow.StartTime.Split(':'); int startTimeHour = Int32.Parse(startTimeSplit[0].ToString()); int startTimeMinute = Int32.Parse(startTimeSplit[1].ToString()); startTime = new DateTime(date_.Year, date_.Month, date_.Day, startTimeHour, startTimeMinute, 0); } DateTime? endTime = null; if (!projectTimeRow.IsEndTimeNull()) { string[] endTimeSplit = projectTimeRow.EndTime.Split(':'); int endTimeHour = Int32.Parse(endTimeSplit[0].ToString()); int endTimeMinute = Int32.Parse(endTimeSplit[1].ToString()); endTime = new DateTime(date_.Year, date_.Month, date_.Day, endTimeHour, endTimeMinute, 0); if (endTime < startTime) { endTime.Value.AddDays(1); } } double? offset = null; if (!projectTimeRow.IsOffsetNull()) offset = projectTimeRow.Offset; string workingDetails = ""; if (!projectTimeRow.IsWorkingDetailsNull()) workingDetails = projectTimeRow.WorkingDetails; string location = ""; if (!projectTimeRow.IsLocationNull()) location = projectTimeRow.Location; Int64? mealsCountry = null; if (!projectTimeRow.IsMealsCountryNull()) mealsCountry = projectTimeRow.MealsCountry; string mealsAllowanceType = ""; if (!projectTimeRow.IsMealsAllowanceTypeNull()) mealsAllowanceType = projectTimeRow.MealsAllowanceType; decimal mealsAllowance = projectTimeRow.MealsAllowance; string comments = ""; if (!projectTimeRow.IsCommentsNull()) comments = projectTimeRow.Comments; int? unitId = null; if (!projectTimeRow.IsUnitIDNull()) unitId = projectTimeRow.UnitID; int? towedUnitId = null; if (!projectTimeRow.IsTowedUnitIDNull()) towedUnitId = projectTimeRow.TowedUnitID; string projectTimeState = projectTimeRow.ProjectTimeState; bool deleted = projectTimeRow.Deleted; string work_ = ""; if (!projectTimeRow.IsWork_Null()) work_ = projectTimeRow.Work_; string function_ = ""; if (!projectTimeRow.IsFunction_Null()) function_ = projectTimeRow.Function_; bool fairWage = projectTimeRow.FairWage; string jobClassType = ""; if (!projectTimeRow.IsJobClassTypeNull()) jobClassType = projectTimeRow.JobClassType; ProjectTime projectTimeToSave = new ProjectTime(Data); projectTimeToSave.Insert(employeeId, companiesId, projectId, date_, startTime, endTime, offset, workingDetails, location, mealsCountry, mealsAllowanceType, mealsAllowance, unitId, towedUnitId, projectTimeState, comments, work_, function_, fairWage, jobClassType, createdById); } } }