public override IList GetFilteredList(List <WACParameter> parms) { WACEnumerations.WACSectorCodes sectorCode = (WACEnumerations.WACSectorCodes)WACParameter.GetParameterValue(parms, WACParameter.ParameterType.SectorCode); object pk = WACParameter.GetParameterValue(parms, WACParameter.ParameterType.PrimaryKey); object mk = WACParameter.GetParameterValue(parms, WACParameter.ParameterType.MasterKey); if (mk == null && pk == null) { return(docLoader(sectorCode)); } if (mk != null && pk == null) { return(docLoader(mk, sectorCode)); } if (mk == null && pk != null) { return(docLoader(pk, sectorCode)); } if (mk != null && pk != null) { return(docLoader(mk, pk, sectorCode)); } else { return(null); } }
public AttachedDocument(string _folder, string _path, string _fileName, WACEnumerations.WACSectorCodes _code) { Folder = _folder; PathName = _path; DisplayFileName = _fileName; setAreaAndSector(_code); ALink = getEncodedALink(); }
private IList docLoader(WACEnumerations.WACSectorCodes sc) { string sSectorCode = WACEnumerations.SectorCodes[sc]; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = wDataContext.documentArchives.Where(w => w.list_participantTypeSectorFolder.fk_participantTypeSector_code == sSectorCode).Select(s => s); var c = a.OrderBy(o => o.filename_display). Select(s => new AttachedDocument(s.list_participantTypeSectorFolder.folder, s.filename_actual, s.filename_display, sSectorCode)); return(c.ToList <AttachedDocument>()); } }
private void setAreaAndSector(WACEnumerations.WACSectorCodes sectorCode) { string[] sectorAndArea = null; try { sectorAndArea = WACEnumerations.SectorCodes[sectorCode].Split('_'); } catch (Exception) { } // fail silently Area = sectorAndArea != null ? sectorAndArea[0] : string.Empty; Sector = sectorAndArea.Count() > 1 ? sectorAndArea[1] : string.Empty; }
private IList docLoader(object mk, object pk, WACEnumerations.WACSectorCodes sc) { int iPK1 = Convert.ToInt32(mk); int? iPK2 = Convert.ToInt32(pk); string sSectorCode = WACEnumerations.SectorCodes[sc]; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = wDataContext.documentArchives.Where(w => w.PK_1 == iPK1 && w.PK_2 == iPK2 && w.list_participantTypeSectorFolder.fk_participantTypeSector_code == sSectorCode).Select(s => s); var c = a.OrderBy(o => o.filename_display). Select(s => new AttachedDocument(s.list_participantTypeSectorFolder.folder, s.filename_actual, s.filename_display, sSectorCode)); return(c.ToList <AttachedDocument>()); } }