private void bindData() { try { // Create a "lookup" list of DutyCounters to show correct Duty number in grid. This fix // even allows for Duties that have no DutyKSAs and shows number skips as needed List <JobAnalysisDuty> currentJADuties = base.CurrentJobAnalysis.GetJobAnalysisDuty(); currentJADuties = currentJADuties .OrderByDescending(ob => ob.JAPercentageOfTime) .ThenBy(ob2 => ob2.JADutyID).ToList(); DutyCounters = null; int dutyNum = 1; foreach (var d in currentJADuties) { DutyCounters.Add(new DutyCounter() { Number = dutyNum, JADutyID = d.JADutyID }); dutyNum++; } this.JADutyKSAFactorList = CurrentJobAnalysis.GetJobAnalysisDutyKSAFactor(); List <JobAnalysisDutyKSAFactor> lstJobAnalysisDutyKSACollection = new List <JobAnalysisDutyKSAFactor>(); lstJobAnalysisDutyKSACollection = JADutyKSAFactorList .Where(p => (p.QualificationTypeID != (int)enumQualificationType.ConditionOfEmployment)) .ToList(); // Issue: 729/768 // Mark Deibert, 9/16/2013 // Using exact same sorting as in ctrlDutyKSA this.gridDutyKSA.DataSource = lstJobAnalysisDutyKSACollection .OrderByDescending(ob => ob.PercentageOfTime) .ThenBy(ob2 => ob2.JADutyID); this.gridDutyKSA.DataBind(); SetPageView(); } catch (Exception ex) { base.HandleException(ex); } }
private void gridDutyKSA_ItemDataBound(object sender, GridItemEventArgs e) { try { HideRefreshButton(e); JobAnalysisDutyKSAFactor currentKSAFactor = e.Item.DataItem as JobAnalysisDutyKSAFactor; if (e.Item is GridDataItem) { Literal literalKSADescription = e.Item.FindControl("literalKSADescription") as Literal; Literal literalQualificationTypeName = e.Item.FindControl("literalQualificationTypeName") as Literal; Literal literalTotalScore = e.Item.FindControl("literalTotalScore") as Literal; //Label lblDutyNumber = e.Item.FindControl("lblDutyNumber") as Label; //Label tooltipDutyNumber = e.Item.FindControl("ToolTipDutyNumber") as Label; TextBox txtDutyNumber = e.Item.FindControl("txtDutyNumber") as TextBox; CheckBox checkboxIsFinalKSA1 = e.Item.FindControl("checkboxIsFinalKSA1") as CheckBox; RadComboBox dropdownImportance = e.Item.FindControl("dropdownImportance") as RadComboBox; RadComboBox dropdownNeedAtEntry = e.Item.FindControl("dropdownNeedAtEntry") as RadComboBox; RadComboBox dropdownDistinguishingValue = e.Item.FindControl("dropdownDistinguishingValue") as RadComboBox; // bind importance scale ControlUtility.BindRadComboBoxControl(dropdownImportance, LookupWrapper.GetImportanceScale(false), null, "ImportanceName", "ImportanceID", "[-- Select --]"); // bind need at entry ControlUtility.BindRadComboBoxControl(dropdownNeedAtEntry, LookupWrapper.GetNeedAtEntryScale(false), null, "NeedAtEntryName", "NeedAtEntryID", "[-- Select --]"); // bind distinguishing value scale ControlUtility.BindRadComboBoxControl(dropdownDistinguishingValue, LookupWrapper.GetDistinguishingValueScale(false), null, "ScaleName", "ScaleID", "[-- Select --]"); // now set values ControlUtility.SafeListControlSelect(dropdownImportance, (int)currentKSAFactor.ImportanceID); ControlUtility.SafeListControlSelect(dropdownNeedAtEntry, (int)currentKSAFactor.NeedAtEntryID); ControlUtility.SafeListControlSelect(dropdownDistinguishingValue, (int)currentKSAFactor.DistinguishingValueScaleID); literalKSADescription.Text = currentKSAFactor.JQFactorTitle; literalQualificationTypeName.Text = currentKSAFactor.QualificationTypeName; literalTotalScore.Text = currentKSAFactor.TotalScore.ToString(); // Lookup the correct Duty sequence number stored in list of DutyCounters created in ctrlDutyKSA.ascx bindData() currentDutyNumber = DutyCounters.Find(c => c.JADutyID == currentKSAFactor.JADutyID).Number; txtDutyNumber.Text = "Duty " + (currentDutyNumber == null ? "" : currentDutyNumber.ToString()); //Add the image id to the tooltip manager this.RadToolTipManager1.TargetControls.Add(txtDutyNumber.ClientID, currentDutyNumber.ToString() + "|" + currentKSAFactor.JADutyID.ToString(), true); if (checkboxIsFinalKSA1 != null) { checkboxIsFinalKSA1.Checked = currentKSAFactor.IsFinalKSA; } if (currentKSAFactor.QualificationTypeID == (int)enumQualificationType.SelectiveFactor) { checkboxIsFinalKSA1.Checked = true; checkboxIsFinalKSA1.Enabled = false; } } else if (e.Item is GridEditableItem && e.Item.IsInEditMode) { RadComboBox dropdownImportance = e.Item.FindControl("dropdownImportance") as RadComboBox; RadComboBox dropdownNeedAtEntry = e.Item.FindControl("dropdownNeedAtEntry") as RadComboBox; RadComboBox dropdownDistinguishingValue = e.Item.FindControl("dropdownDistinguishingValue") as RadComboBox; CheckBox checkboxIsFinalKSA1 = e.Item.FindControl("checkboxIsFinalKSA1") as CheckBox; // bind importance scale ControlUtility.BindRadComboBoxControl(dropdownImportance, LookupWrapper.GetImportanceScale(false), null, "ImportanceName", "ImportanceID", "[-- Select --]"); // bind need at entry ControlUtility.BindRadComboBoxControl(dropdownNeedAtEntry, LookupWrapper.GetNeedAtEntryScale(false), null, "NeedAtEntryName", "NeedAtEntryID", "[-- Select --]"); // bind distinguishing value scale ControlUtility.BindRadComboBoxControl(dropdownDistinguishingValue, LookupWrapper.GetDistinguishingValueScale(false), null, "ScaleName", "ScaleID", "[-- Select --]"); // now set values ControlUtility.SafeListControlSelect(dropdownImportance, (int)currentKSAFactor.ImportanceID); ControlUtility.SafeListControlSelect(dropdownNeedAtEntry, (int)currentKSAFactor.NeedAtEntryID); ControlUtility.SafeListControlSelect(dropdownDistinguishingValue, (int)currentKSAFactor.DistinguishingValueScaleID); if (checkboxIsFinalKSA1 != null) { checkboxIsFinalKSA1.Checked = currentKSAFactor.IsFinalKSA; } if (currentKSAFactor.QualificationTypeID == (int)enumQualificationType.SelectiveFactor) { checkboxIsFinalKSA1.Checked = true; checkboxIsFinalKSA1.Enabled = false; } } SetPageView(); } catch (Exception ex) { base.HandleException(ex); } }