public RinxterImportFactory Initialize(FederationsEnum organization) { StartedTime = DateTime.UtcNow; string ImageFolder = @"C:\WebSites\images.rdnation.com\rx\" + StartedTime.Year + @"\" + StartedTime.Month + @"\" + StartedTime.Day + @"\"; if (!Directory.Exists(ImageFolder)) Directory.CreateDirectory(ImageFolder); federationUrl = organization; bs = new BusinessLogic(federationUrl, ImageFolder); return this; }
public static Dictionary<int, string> GetBouts(FederationsEnum federationUrl) { bool isFemale = federationUrl == FederationsEnum.WFTDA; var db = new ManagementContext(); // get all Bouts by federation from the database var query = from b in db.RBouts where b.IsFemale == isFemale && b.IsDeleted == false orderby b.ID select b; Dictionary<int, string> dicBouts = new Dictionary<int, string>(); foreach (var item in query) { dicBouts.Add(item.ID, item.Venue); } return dicBouts; }
public static Dictionary<int, string> GetTeams(FederationsEnum federationUrl) { bool isFemale = federationUrl == FederationsEnum.WFTDA; var db = new ManagementContext(); // Display all Teams from the database var getTeamsByFederation = from b in db.RTeams where b.IsFemale == isFemale && b.IsDeleted == false orderby b.Name select b; Dictionary<int, string> dicSessions = new Dictionary<int, string>(); foreach (var item in getTeamsByFederation) { if (dicSessions.Where(x => x.Key == item.ID).FirstOrDefault().Key != item.ID) dicSessions.Add(item.ID, item.Name); } return dicSessions; }
public BusinessLogic(FederationsEnum organization, string iamgeFolder) { federationUrl = organization; IamgeFolder = iamgeFolder; IsFemale = federationUrl == FederationsEnum.WFTDA; }
public static ArrayList GetTournamentsIDs(FederationsEnum federationUrl) { bool isFemale = federationUrl == FederationsEnum.WFTDA; var db = new ManagementContext(); // geting all TournamentsID from the database var getTournaments = from b in db.RTournaments where b.IsFemale == isFemale && b.IsDeleted == false orderby b.ID select b; ArrayList arrTournamentsID = new ArrayList(); foreach (var item in getTournaments) { arrTournamentsID.Add(item.ID); } return arrTournamentsID; }
public bool SaveLineUpsData(string lineUpsJsonUrl, int boutId, FederationsEnum federationUrl) { bool isFemale = federationUrl == FederationsEnum.WFTDA; try { var db = new ManagementContext(); Dictionary<string, string>[] dicLineUps = WebProvider.Download_serialized_json_lineups_data(lineUpsJsonUrl); foreach (var dicitem in dicLineUps) { try { DataModels.Imports.Rinxter.RLineUps lUp = new DataModels.Imports.Rinxter.RLineUps(); string jam = dicitem["Jam"]; string teamName = dicitem["TeamName"]; var getLineups = (from b in db.RLineUps where b.BoutID == boutId && b.IsFemale == isFemale && b.Jam == jam && b.TeamName == teamName select b).FirstOrDefault(); if (getLineups == null) { lUp.Jam = dicitem["Jam"]; lUp.BoutID = boutId; lUp.TeamName = dicitem["TeamName"]; lUp.Jammer = dicitem["Jammer"]; lUp.PivotBlocker = dicitem["PivotBlocker"]; lUp.Blocker = dicitem["Blocker"]; lUp.Blocker1 = dicitem["Blocker1"]; lUp.Blocker2 = dicitem["Blocker2"]; lUp.LastModified = DateTime.UtcNow; lUp.IsFemale = isFemale; db.RLineUps.Add(lUp); int c = db.SaveChanges(); } else { getLineups.Jam = dicitem["Jam"]; getLineups.TeamName = dicitem["TeamName"]; getLineups.Jammer = dicitem["Jammer"]; getLineups.PivotBlocker = dicitem["PivotBlocker"]; getLineups.Blocker = dicitem["Blocker"]; getLineups.Blocker1 = dicitem["Blocker1"]; getLineups.Blocker2 = dicitem["Blocker2"]; getLineups.LastModified = DateTime.UtcNow; getLineups.IsDeleted = false; lUp.IsFemale = isFemale; int c = db.SaveChanges(); } } catch (Exception ex) { ErrorDatabaseManager.AddException(ex, GetType(), additionalInformation: "\n Bout=" + boutId); } } } catch (Exception ex) { ErrorDatabaseManager.AddException(ex, GetType()); return false; ; } return true; }
public static DataTable GetBouts(bool isTable, FederationsEnum federationUrl) { bool isFemale = federationUrl == FederationsEnum.WFTDA; var db = new ManagementContext(); // Display all Bouts from the database var getBouts = from b in db.RBouts where b.IsFemale == isFemale && b.IsDeleted == false orderby b.ID select b; DataTable dtBouts = new DataTable(); dtBouts.Columns.Add("BoutID"); dtBouts.Columns.Add("Name"); dtBouts.Columns.Add("Team1ID"); dtBouts.Columns.Add("Team2ID"); if (isTable) { foreach (var item in getBouts) { DataRow dr = dtBouts.NewRow(); dr["BoutID"] = item.ID; dr["Name"] = item.Venue; dr["Team1ID"] = item.Team1ID; dr["Team2ID"] = item.Team2ID; dtBouts.Rows.Add(dr); } } return dtBouts; }