public TigerLeadReportBoardCollection ListingClassesParsed() { var returnvalue = new TigerLeadReportBoardCollection(); var reader = new StreamReader(File.OpenRead(string.Format(@"{0}\Projects\TigerLead\FinalReport\mls_listing_types(old version).csv", ConfigurationManager.AppSettings["Drive"]))); int rowcount = 0; while (!reader.EndOfStream) { var line = reader.ReadLine(); if (rowcount > 0) { var values = line.Split(','); returnvalue.AddClass(values[0], new TigerLeadReportListingTypeEntry { TigerLeadName = values[4], ListingTable = values[2], ListingType = values[1], Resource = values[3] }); } rowcount++; } return(returnvalue); }
public TigerLeadReportRow GetClassesfromDB(TigerLeadReportRow Row, TigerLeadReportBoardCollection TLCLasses) { int MoudleInt = Convert.ToInt32(Row.ModuleID); List <cma_mls_board_connections> connections = null; using (var tcsDb = new TCSEntitiesProduction()) { var board = tcsDb.cma_mls_boards.FirstOrDefault(x => x.module_id == MoudleInt && x.board_status_id == 1); if (board != null) { var boardId = board.board_id; connections = tcsDb.cma_mls_board_connections.Where(x => x.board_id == boardId).ToList(); } } List <TigerLeadReportListingTypeEntry> CollectedClass = new List <TigerLeadReportListingTypeEntry>(); if (TLCLasses.DoesBoardExist(Row.TigerLeadCode)) { CollectedClass = TLCLasses.ReturnClasses(Row.TigerLeadCode); } else if (TLCLasses.DoesBoardExist(Row.TigerLeadCodeOld)) { CollectedClass = TLCLasses.ReturnClasses(Row.TigerLeadCodeOld); } List <string> matches = new List <string>(); foreach (var connection in connections) { bool matchfound = false; var iniReader = new IniFile(connection.definition_file); var mainscriptclass = GetMainscriptClass(iniReader.GetSectionContent("MainScript")); foreach (var Entry in CollectedClass) { if ((Entry.ListingType == connection.connection_type) || (Entry.ListingTable.ToLower().Contains("_" + mainscriptclass.ToLower() + "_")) || ((Entry.ListingType == "agent") && (connection.connection_type.ToLower().Contains("agent"))) || ((Entry.ListingType == "office") && (connection.connection_type.ToLower().Contains("office"))) ) { matches.Add(Entry.ListingType); matchfound = true; var defNotAvailable = iniReader.Read("DEFNotAvailableTo", "Common") ?? ""; if (defNotAvailable.Equals("ORCA", StringComparison.OrdinalIgnoreCase)) { if (Row.TPOnlyMatch == "") { Row.TPOnlyMatch = connection.connection_type; } else { Row.TPOnlyMatch = Row.TPOnlyMatch + ":" + connection.connection_type; } Row.TPOnlyMatchCount++; } else { if (Row.ORCAReadyMatch == "") { Row.ORCAReadyMatch = connection.connection_type; } else { Row.ORCAReadyMatch = Row.ORCAReadyMatch + ":" + connection.connection_type; } Row.ORCAReadyMatchCount++; } //check if updated for orca //if udpated for orca add to match orca, if no add to match with TP only } } if (matchfound == false) { //check if updated for orca //if udpated for orca add to extra orca, if no add to match with TP extra var defNotAvailable = iniReader.Read("DEFNotAvailableTo", "Common") ?? ""; if (defNotAvailable.Equals("ORCA", StringComparison.OrdinalIgnoreCase)) { if (Row.TPOnlyExtra == "") { Row.TPOnlyExtra = connection.connection_type; } else { Row.TPOnlyExtra = Row.TPOnlyExtra + ":" + connection.connection_type; } Row.TPOnlyExtraCount++; } else { if (Row.ORCAReadyExtra == "") { Row.ORCAReadyExtra = connection.connection_type; } else { Row.ORCAReadyExtra = Row.ORCAReadyExtra + ":" + connection.connection_type; } Row.ORCAReadyExtraCount++; } } } foreach (var Entry in CollectedClass) { if (!matches.Contains(Entry.ListingType)) { if (Row.TigerLeadOnly == "") { Row.TigerLeadOnly = Entry.ListingType; } else { Row.TigerLeadOnly = Row.TigerLeadOnly + ":" + Entry.ListingType; } Row.TigerLeadOnlyCount++; } } return(Row); }