// //////////////////////////////////////////////////////////////////////// // STEP4 - LABOUR HOUR INFORMATION - METHODS // private void StepLabourHourInformationIn() { // Set instruction Label instruction = (Label)this.Master.FindControl("lblInstruction"); instruction.Text = "Please verify Labour Hour information"; int projectId = 0; // Load ProjectCombinedCostingSheetAddLabourHoursInformationGateway projectCombinedCostingSheetAddLabourHoursInformationGateway = new ProjectCombinedCostingSheetAddLabourHoursInformationGateway(projectCostingSheetAddTDS); projectCombinedCostingSheetAddLabourHoursInformationGateway.ClearBeforeFill = false; ProjectCombinedCostingSheetAddLabourHoursInformation model = new ProjectCombinedCostingSheetAddLabourHoursInformation(projectCombinedCostingSheetAddLabourHoursInformationGateway.Data); if (projectCostingSheetAddTDS.CombinedLabourHoursInformation.Rows.Count == 0) { foreach (int projectIdSelected in projectsSelected) { projectId = projectIdSelected; ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(projectId); ArrayList works = new ArrayList(); if (cbxRehabAssessmentData.Checked) works.Add("Rehab Assessment"); if (cbxFullLengthLiningData.Checked) works.Add("Full Length"); if (cbxPointRepairData.Checked) { works.Add("Point Lining"); works.Add("Grouting"); } if (cbxJunctionLiningData.Checked) works.Add("Junction Lining"); if (cbxManholeRehabData.Checked) works.Add("MH Rehab"); if (cbxMobilizationData.Checked) works.Add("Mobilization"); if (cbxOtherData.Checked) { works.Add("Other"); works.Add("Downtime"); works.Add("Office"); works.Add("Office / Shop"); works.Add("R & D"); works.Add("Special Projects"); works.Add("Subcontractor"); works.Add("Watermain Relining"); works.Add("SOTA"); } if (!projectGateway.GetFairWageApplies(projectId)) { model.Load(works, projectId, tkrdpFrom.SelectedDate.Value, tkrdpTo.SelectedDate.Value, int.Parse(hdfCompanyId.Value), Int32.Parse(hdfClientId.Value)); } else { ArrayList jobClassType = new ArrayList(); jobClassType.Add("Laborer Group 2"); jobClassType.Add("Laborer Group 6"); jobClassType.Add("Operator Group 1"); jobClassType.Add("Operator Group 2"); jobClassType.Add("Regular Rate"); model.LoadFairWageProject(works, jobClassType, projectId, tkrdpFrom.SelectedDate.Value, tkrdpTo.SelectedDate.Value, int.Parse(hdfCompanyId.Value), Int32.Parse(hdfClientId.Value)); } projectCombinedCostingSheetAddLabourHoursInformationGateway.ClearBeforeFill = true; // Store tables Session.Remove("labourHoursInformationDummy"); labourHoursInformation = (ProjectCostingSheetAddTDS.CombinedLabourHoursInformationDataTable)model.Table; Session["labourHoursInformation"] = labourHoursInformation; Session["projectCostingSheetAddTDS"] = projectCostingSheetAddTDS; grdTeamMembers.Columns[11].Visible = false; grdTeamMembers.Columns[12].Visible = false; grdTeamMembers.Columns[13].Visible = false; grdTeamMembers.Columns[14].Visible = false; grdTeamMembers.Columns[16].Visible = false; grdTeamMembers.Columns[17].Visible = false; grdTeamMembers.Columns[20].Visible = false; grdTeamMembers.Columns[21].Visible = false; // Validate grid columns if (projectGateway.GetCountryID(projectId) == 1) //Canada { // Team Members Grid grdTeamMembers.Columns[15].Visible = true; grdTeamMembers.Columns[18].Visible = true; grdTeamMembers.Columns[19].Visible = false; grdTeamMembers.Columns[22].Visible = false; // Totals lblTeamMembersTotalCost.Text = "Total Cost (CAD) : "; tbxTeamMembersTotalCostCAD.Visible = true; tbxTeamMembersTotalCostUSD.Visible = false; } else { if (projectGateway.GetCountryID(projectId) == 2) //USA { // Team Members Grid grdTeamMembers.Columns[15].Visible = false; grdTeamMembers.Columns[18].Visible = false; grdTeamMembers.Columns[19].Visible = true; grdTeamMembers.Columns[22].Visible = true; // Totals lblTeamMembersTotalCost.Text = "Total Cost (USD) : "; tbxTeamMembersTotalCostCAD.Visible = false; tbxTeamMembersTotalCostUSD.Visible = true; } } } } grdTeamMembers.DataBind(); StepLabourHoursInformationProcessGrid(); }
protected void grdTeamMembers_RowDataBound(object sender, GridViewRowEventArgs e) { // Edit items if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate)))) { int costingSheetId = Int32.Parse(((Label)e.Row.FindControl("lblCostingSheetIDEdit")).Text.Trim()); int employeeId = Int32.Parse(((Label)e.Row.FindControl("lblEmployeeIDEdit")).Text.Trim()); int refId = Int32.Parse(((Label)e.Row.FindControl("lblRefIDEdit")).Text.Trim()); string work_ = ((Label)e.Row.FindControl("lblWork_Edit")).Text.Trim(); ProjectCombinedCostingSheetAddLabourHoursInformationGateway projectCostingSheetAddLabourHoursInformationGateway = new ProjectCombinedCostingSheetAddLabourHoursInformationGateway(projectCostingSheetAddTDS); string unitOfMeasurement = projectCostingSheetAddLabourHoursInformationGateway.GetLHUnitOfMeasurement(costingSheetId, work_, employeeId, refId); ((DropDownList)e.Row.FindControl("ddlUnitOfMeasurementLHEdit")).SelectedValue = unitOfMeasurement; string unitOfMeasurementMeals = projectCostingSheetAddLabourHoursInformationGateway.GetMealsUnitOfMeasurement(costingSheetId, work_, employeeId, refId); ((DropDownList)e.Row.FindControl("ddlUnitsOfMeasurementLHMealsEdit")).SelectedValue = unitOfMeasurementMeals; string unitOfMeasurementMotel = projectCostingSheetAddLabourHoursInformationGateway.GetMotelUnitOfMeasurement(costingSheetId, work_, employeeId, refId); ((DropDownList)e.Row.FindControl("ddlUnitsOfMeasurementLHMotelEdit")).SelectedValue = unitOfMeasurementMotel; bool fromDatabase = projectCostingSheetAddLabourHoursInformationGateway.GetFromDatabase(costingSheetId, work_, employeeId, refId); if (fromDatabase) { ((RadDatePicker)e.Row.FindControl("tkrdpEndDateEdit")).Calendar.Enabled = false; ((RadDatePicker)e.Row.FindControl("tkrdpEndDateEdit")).DateInput.ReadOnly = true; ((RadDatePicker)e.Row.FindControl("tkrdpStartDateEdit")).Calendar.Enabled = false; ((RadDatePicker)e.Row.FindControl("tkrdpStartDateEdit")).DateInput.ReadOnly = true; } ((RadDatePicker)e.Row.FindControl("hdfFrom")).SelectedDate = tkrdpFrom.SelectedDate; ((RadDatePicker)e.Row.FindControl("hdfTo")).SelectedDate = tkrdpTo.SelectedDate; } // Footer Item if (e.Row.RowType == DataControlRowType.Footer) { ((RadDatePicker)e.Row.FindControl("hdfFrom")).SelectedDate = tkrdpFrom.SelectedDate; ((RadDatePicker)e.Row.FindControl("hdfTo")).SelectedDate = tkrdpTo.SelectedDate; DropDownList ddlProject = ((DropDownList)e.Row.FindControl("ddlProject_New")); ddlProject.DataTextField = "Text"; ddlProject.DataValueField = "Value"; ddlProject.DataSource = projectList; ddlProject.DataBind(); ddlProject.SelectedIndex = 0; } }