/// <summary> /// put _name into the proper position of AbsenceTypeNames list /// </summary> public void DecomposeName(long langId) { // no need to check. lazy init is implemented in property /* * if(_absenceType.AbsenceTypeNames == null) * { * _absenceType.AbsenceTypeNames = new ArrayList(); * }*/ AbsenceTypeName properATN = null; foreach (AbsenceTypeName atn in _absenceType.AbsenceTypeNames) { if (atn.LanguageID == langId) { properATN = atn; break; } } if (properATN == null) { _absenceType.AbsenceTypeNames.Add(new AbsenceTypeName(langId, _name, _absenceType)); } else { // LanguageID is already filled //properATN.LanguageID = langId; properATN.Name = _name; properATN.AbsenceType = _absenceType; } }
public override void Bind() { IList absTypeList = ClientEnvironment.AbsenceTypeService.FindAll(); _absTypeWList = new List <AbsenceTypeWrapper>(); foreach (Domain.AbsenceType at in absTypeList) { bool found = false; AbsenceTypeName neuLangATN = null; AbsenceTypeName anyLandATN = null; foreach (AbsenceTypeName atn in at.AbsenceTypeNames) { if (atn.LanguageID == ClientEnvironment.LanguageId) { found = true; _absTypeWList.Add(new AbsenceTypeWrapper(at, atn.Name)); break; } if (atn.LanguageID == SharedConsts.NeutralLangId) { neuLangATN = atn; } if (anyLandATN == null) { anyLandATN = atn; } } if (!found) { if (neuLangATN == null) { if (anyLandATN == null) { _absTypeWList.Add(new AbsenceTypeWrapper(at, "???")); } else { _absTypeWList.Add(new AbsenceTypeWrapper(at, anyLandATN.Name)); } } else { _absTypeWList.Add(new AbsenceTypeWrapper(at, neuLangATN.Name)); } } } gridControl.DataSource = _absTypeWList; }