private void PostPageChanges() { EmployeeGateway employeeGateway1 = new EmployeeGateway(new DataSet()); int approvedById = employeeGateway1.GetEmployeIdByLoginId(Convert.ToInt32(Session["loginID"])); // Approve Project Times LiquiForce.LFSLive.BL.LabourHours.ProjectTime.ProjectTime projectTime = new LiquiForce.LFSLive.BL.LabourHours.ProjectTime.ProjectTime(projectTimeTDSForState); projectTime.Approve(approvedById); }
private void PostPageChanges() { int projectTimeId = (int)ViewState["projecttime_id"]; EmployeeGateway employeeGateway = new EmployeeGateway(); int employeeId = employeeGateway.GetEmployeIdByLoginId(Convert.ToInt32(Session["loginID"])); // Delete project time LiquiForce.LFSLive.BL.LabourHours.ProjectTime.ProjectTime projectTime = new LiquiForce.LFSLive.BL.LabourHours.ProjectTime.ProjectTime(projectTimeTDS); projectTime.Delete(projectTimeId, employeeId); }
/// <summary> /// MoveToProjectTime /// </summary> /// <param name="projectTimeTDS">projectTimeTDS</param> /// <param name="LHMode">LHMode</param> /// <param name="fullEditing">fullEditing</param> /// <param name="typeOfWork">typeOfWork</param> /// <param name="function">function</param> /// <param name="companyId">companyId</param> /// <param name="createdById">createdById</param> /// <returns></returns> public string MoveToProjectTime(ProjectTimeTDS projectTimeTDS, string LHMode, bool fullEditing, string typeOfWork, string function, int companyId, int createdById) { PayPeriodGateway payPeriodGateway = new PayPeriodGateway(new DataSet()); TimesheetGateway timesheetGateway = new TimesheetGateway(new DataSet()); EmployeeGateway employeeGateway = new EmployeeGateway(new DataSet()); LiquiForce.LFSLive.BL.LabourHours.ProjectTime.ProjectTime projectTime = new LiquiForce.LFSLive.BL.LabourHours.ProjectTime.ProjectTime(projectTimeTDS); string errorMessage = ""; // Clear before project times projectTime.Table.Rows.Clear(); // Insert new project times foreach (TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_DETAILRow row in ((TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_DETAILDataTable)Table)) { if (!row.Deleted) { int employeeId = row.EmployeeID; int companiesId = row.CompaniesID; int projectId = row.ProjectID; DateTime date_ = row.Date_; DateTime? startTime = null; if (!row.IsStartTimeNull()) { string[] startTimeSplit = row.StartTime.Split(':'); int startTimeHour = Int32.Parse(startTimeSplit[0].ToString()); string[] startTimeMinuteSplit = startTimeSplit[1].Split(' '); int startTimeMinute = Int32.Parse(startTimeMinuteSplit[0].ToString()); startTime = new DateTime(date_.Year, date_.Month, date_.Day, startTimeHour, startTimeMinute, 0); } DateTime? endTime = null; if (!row.IsEndTimeNull()) { string[] endTimeSplit = row.EndTime.Split(':'); int endTimeHour = Int32.Parse(endTimeSplit[0].ToString()); string[] endTimeMinuteSplit = endTimeSplit[1].Split(' '); int endTimeMinute = Int32.Parse(endTimeMinuteSplit[0].ToString()); endTime = new DateTime(date_.Year, date_.Month, date_.Day, endTimeHour, endTimeMinute, 0); } double? offset = null; if (!row.IsOffsetNull()) offset = row.Offset; double projectTimeValue = row.ProjectTime; string workingDetails = ""; if (!row.IsWorkingDetailsNull()) workingDetails = row.WorkingDetails; string location = ""; if (!row.IsLocationNull()) location = row.Location; Int64? mealsCountry = null; if (!row.IsMealsCountryNull()) mealsCountry = row.MealsCountry; string mealsAllowanceType = ""; if (!row.IsMealsAllowanceTypeNull()) mealsAllowanceType = row.MealsAllowanceType; decimal mealsAllowance = row.MealsAllowance; int? unitId = null; if (!row.IsUnitIDNull()) unitId = row.UnitID; int? towedUnitId = null; if (!row.IsTowedUnitIDNull()) towedUnitId = row.TowedUnitID; string comments = ""; if (!row.IsCommentsNull()) comments = row.Comments; string work_ = row.Work_; string function_ = row.Function_; bool fairWage = row.FairWage; string jobClass = ""; if (!row.IsJobClassTypeNull()) jobClass = row.JobClassType; string projectTimeState = row.ProjectTimeState; int projectTimeId = projectTime.Insert(employeeId, companiesId, projectId, date_, startTime, endTime, offset, workingDetails, location, mealsCountry, mealsAllowanceType, mealsAllowance, unitId, towedUnitId, projectTimeState, comments, work_, function_, fairWage, jobClass, createdById); if (typeOfWork == "Full Length") { LiquiForce.LFSLive.BL.LabourHours.ProjectTime.ProjectTimeSection projectTimeSection = new LiquiForce.LFSLive.BL.LabourHours.ProjectTime.ProjectTimeSection(projectTimeTDS); switch (function) { case "Install": foreach (TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_SECTIONRow projectTimeRow in ((TeamProjectTime2TDS)Data).LFS_TEAM_PROJECT_TIME_SECTION) { if (projectTimeRow.Selected) { projectTimeSection.Insert(projectTimeId, projectTimeRow.SectionID, projectTimeRow.FlowOrderID, true, projectTimeRow._Date, 0, 0, false, companyId); } } break; case "Prep & Measure": foreach (TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_SECTIONRow projectTimeRow in ((TeamProjectTime2TDS)Data).LFS_TEAM_PROJECT_TIME_SECTION) { if (projectTimeRow.Selected) { projectTimeSection.Insert(projectTimeId, projectTimeRow.SectionID, projectTimeRow.FlowOrderID, projectTimeRow.Completed, projectTimeRow._Date, 0, 0, false, companyId); } } break; case "Reinstate & Post Video": foreach (TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_SECTIONRow projectTimeRow in ((TeamProjectTime2TDS)Data).LFS_TEAM_PROJECT_TIME_SECTION) { if (projectTimeRow.Selected) { projectTimeSection.Insert(projectTimeId, projectTimeRow.SectionID, projectTimeRow.FlowOrderID, projectTimeRow.Completed, projectTimeRow._Date, projectTimeRow.PercentageOpened, projectTimeRow.PercentageBrushed, false, companyId); } } break; } } //if (typeOfWork == "MH Rehab")//TODO MH //{ // LiquiForce.LFSLive.BL.LabourHours.ProjectTime.ProjectTimeSection projectTimeSection = new LiquiForce.LFSLive.BL.LabourHours.ProjectTime.ProjectTimeSection(projectTimeTDS); // switch (function) // { // case "Prep": // foreach (TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_SECTIONRow projectTimeRow in ((TeamProjectTime2TDS)Data).LFS_TEAM_PROJECT_TIME_SECTION) // { // if (projectTimeRow.Selected) // { // projectTimeSection.Insert(projectTimeId, projectTimeRow.SectionID, projectTimeRow.FlowOrderID, true, projectTimeRow._Date, 0, 0, false, companyId); // } // } // break; // case "Spray": // foreach (TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_SECTIONRow projectTimeRow in ((TeamProjectTime2TDS)Data).LFS_TEAM_PROJECT_TIME_SECTION) // { // if (projectTimeRow.Selected) // { // projectTimeSection.Insert(projectTimeId, projectTimeRow.SectionID, projectTimeRow.FlowOrderID, true, projectTimeRow._Date, 0, 0, false, companyId); // } // } // break; // } //} } } return errorMessage; }