public FileMenuViewObject() { _abcModelList = ABCTestDetailsModel.GetInstance; _mushraModelList = MushraTestDetailsModel.GetInstance; _scorerDetails = ScorerDetails.GetInstance; ABCTestView.TestModeOnOff += ABCTest_TestModeOnOff; }
public MushraTestTransportControlsView() { _waveDisplay = WaveFormPlayer.Instance; _settingsObject = AudioSettingsModel.GetInstance; _scoreLogger = LogFactory.GetLoggerObject((byte)LoggerType.ScoreLogger); _scorerDetails = ScorerDetails.GetInstance; MUSHRASessionWindow.SessionCreated += MUSHRASessionWindow_SessionCreated; MUSHRASessionWindow.SessionClosed += MUSHRASessionWindow_SessionClosed; MushraTestScoreView.MushraClickedButton += OnMushraClickedButton; MushraTestScoreView.ScoringSliderEvent += ScoringSliderEvent; LoadSelectedTrialEvent += OnLoadSelectedTrialEvent; this.Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; InitializeComponent(); }
public void InitializeLogger(object testDetailsObject) { _fileStream = new FileStream(FileName, FileMode.Create); _fileWriter = new StreamWriter(_fileStream); if (testDetailsObject.GetType() == typeof(ABCTestDetailsModel)) { _modelObject = (ABCTestDetailsModel)testDetailsObject; } else if (testDetailsObject.GetType() == typeof(MushraTestDetailsModel)) { _modelObject = (MushraTestDetailsModel)testDetailsObject; } _scorerDetails = ScorerDetails.GetInstance; Log.Write(LogLevel.Info, "Score Logger is Initialized!!!!"); }
private List <ScorerDetails> setUpListDetailsScorers(DataTable dt) { List <ScorerDetails> oList = new List <ScorerDetails>(); ScorerDetails modelDetails = new ScorerDetails(); try { for (var i = 0; i < dt.Rows.Count; i++) { modelDetails = new ScorerDetails(); modelDetails.id = Convert.ToInt32(dt.Rows[i]["ID_GOLEADOR"].ToString()); modelDetails.teamID = Convert.ToInt16(dt.Rows[i]["ID_TIME"].ToString()); modelDetails.teamName = dt.Rows[i]["NM_TIME"].ToString(); modelDetails.teamType = dt.Rows[i]["DS_TIPO"].ToString(); modelDetails.DateSubscriptionFormatted = dt.Rows[i]["DT_FORMATADA"].ToString(); modelDetails.nickname = dt.Rows[i]["NM_GOLEADOR"].ToString(); modelDetails.name = dt.Rows[i]["NM_GOLEADOR_COMPLETO"].ToString(); modelDetails.country = dt.Rows[i]["DS_PAIS"].ToString(); if (!String.IsNullOrEmpty(dt.Rows[i]["ID_TIME_SOFIFA"].ToString())) { modelDetails.sofifaTeamID = dt.Rows[i]["ID_TIME_SOFIFA"].ToString(); } modelDetails.rating = dt.Rows[i]["IN_RATING"].ToString(); if (!String.IsNullOrEmpty(dt.Rows[i]["ID_USUARIO"].ToString())) { modelDetails.userID = Convert.ToInt32(dt.Rows[i]["ID_USUARIO"].ToString()); } if (!String.IsNullOrEmpty(dt.Rows[i]["DT_INSCRICAO"].ToString())) { modelDetails.DateSubscription = Convert.ToDateTime(dt.Rows[i]["DT_INSCRICAO"].ToString()); } oList.Add(modelDetails); } return(oList); } catch { return(new List <ScorerDetails>()); } finally { oList = null; modelDetails = null; } }
public ABCTestView() { InitializeComponent(); _scoreLogger = LogFactory.GetLoggerObject((byte)LoggerType.ScoreLogger); ABCSessionWindow.SessionCreated += ABCSessionWindow_SessionCreated; ABCSessionWindow.SessionClosed += ABCSessionWindow_SessionClosed; ScoringScales.ScoringSliderEvent += ScoringSliderEvent; LoadSelectedTrialEvent += OnLoadSelectedTrialEvent; _waveDisplay = WaveFormPlayer.Instance; _settingsObject = AudioSettingsModel.GetInstance; _scorerDetails = ScorerDetails.GetInstance; this.Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; var image = (Image)FindResource("NoLoop"); image.Height = 50; LoopBtn.Content = image; }
public IHttpActionResult GetDetails(string id) { ScorerDetails modelDetails = new ScorerDetails(); ScorerViewModel mainModel = new ScorerViewModel(); DataTable dt = null; db.openConnection(); try { if (id.All(char.IsDigit)) { paramName = new string[] { "pIdGoleador" }; paramValue = new string[] { id }; dt = db.executePROC("spGetGoleadorByGoleador", paramName, paramValue); if (dt.Rows.Count > 0) { if (dt.Rows[0]["NM_TIPO_TIME"].ToString() == "PRO CLUB") { modelDetails.scorerType = "PRO"; } else { modelDetails.scorerType = "H2H"; } modelDetails.id = Convert.ToInt32(id); modelDetails.teamID = Convert.ToInt16(dt.Rows[0]["ID_TIME"].ToString()); modelDetails.DateSubscriptionFormatted = dt.Rows[0]["DT_FORMATADA"].ToString(); modelDetails.nickname = dt.Rows[0]["NM_GOLEADOR"].ToString(); modelDetails.name = dt.Rows[0]["NM_GOLEADOR_COMPLETO"].ToString(); modelDetails.country = dt.Rows[0]["DS_PAIS"].ToString(); modelDetails.link = dt.Rows[0]["DS_LINK_IMAGEM"].ToString(); if (!String.IsNullOrEmpty(dt.Rows[0]["ID_TIME_SOFIFA"].ToString())) { modelDetails.sofifaTeamID = dt.Rows[0]["ID_TIME_SOFIFA"].ToString(); } modelDetails.rating = dt.Rows[0]["IN_RATING"].ToString(); if (!String.IsNullOrEmpty(dt.Rows[0]["ID_USUARIO"].ToString())) { modelDetails.userID = Convert.ToInt32(dt.Rows[0]["ID_USUARIO"].ToString()); } if (!String.IsNullOrEmpty(dt.Rows[0]["DT_INSCRICAO"].ToString())) { modelDetails.DateSubscription = Convert.ToDateTime(dt.Rows[0]["DT_INSCRICAO"].ToString()); } } modelDetails.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, modelDetails)); } else { paramName = new string[] { }; paramValue = new string[] { }; if (id == "H2H") { dt = db.executePROC("spGetAllGoleadoresNoFilterCRUDH2H", paramName, paramValue); } else { dt = db.executePROC("spGetAllGoleadoresNoFilterCRUDPRO", paramName, paramValue); } mainModel.scorerType = id; mainModel.listOfScorer = setUpListDetailsScorers(dt); mainModel.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, mainModel)); } } catch (Exception ex) { modelDetails.returnMessage = "errorGetScorer_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, modelDetails)); } finally { db.closeConnection(); modelDetails = null; dt = null; mainModel = null; } }
public IHttpActionResult postRequest(ScorerDetails model) { ScorerViewModel mainModel = new ScorerViewModel(); CurrentSeasonSummaryViewModel mainViewModel = new CurrentSeasonSummaryViewModel(); db.openConnection(); DataTable dt = null; try { if (model.actionUser == "save") { if (model.id > 0) { paramName = new string[] { "pIdGoleador", "pIdTime", "pNmGoleador", "pNmCompleto", "pDsLink", "pDsPais", "pIdSofifa", "pIdUsu" }; paramValue = new string[] { Convert.ToString(model.id), Convert.ToString(model.teamID), model.nickname, model.name, model.link, model.country, model.sofifaTeamID, Convert.ToString(model.userID) }; dt = db.executePROC("spUpdateGoleador", paramName, paramValue); } else { paramName = new string[] { "pIdGoleador", "pIdTime", "pNmGoleador", "pNmCompleto", "pDsLink", "pDsPais", "pIdSofifa", "pTipo", "pIdUsu" }; paramValue = new string[] { "0", Convert.ToString(model.teamID), model.nickname, model.name, model.link, model.country, model.sofifaTeamID, model.scorerType, Convert.ToString(model.userID) }; dt = db.executePROC("spAddGoleador", paramName, paramValue); } model.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } else if (model.actionUser == "getListOfScorerByTeam") { paramName = new string[] { "pIdTime" }; paramValue = new string[] { Convert.ToString(model.teamID) }; dt = db.executePROC("spGetAllGoleadorByTime", paramName, paramValue); mainModel.listOfScorer = setUpListDetailsScorers(dt); mainModel.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, mainModel)); } else if (model.actionUser == "getListOfScorerByChampionship") { mainViewModel.listOfScorers = GlobalFunctions.getListScorers(String.Empty, db, 0, false, model.id); mainViewModel.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, mainViewModel)); } else if (model.actionUser == "getListOfScorerByMatchTeam") { paramName = new string[] { "pIdJogo", "pIdTime" }; paramValue = new string[] { Convert.ToString(model.id), Convert.ToString(model.teamID) }; dt = db.executePROC("spGetGoleadorGolsOfTime", paramName, paramValue); mainModel.listOfScorer = setUpListDetailsScorers(dt); mainModel.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, mainModel)); } else { return(StatusCode(HttpStatusCode.NotAcceptable)); } } catch (Exception ex) { model.returnMessage = "error_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } finally { db.closeConnection(); dt = null; mainModel = null; mainViewModel = null; } }
private void processSofifaHTML(string teamSofifaHTML, ref TeamDetailsModel teamModel) { ScorerDetails scorerDetails = new ScorerDetails(); List <ScorerDetails> listOfScorer = new List <ScorerDetails>(); DataTable dt = null; int position = 0; int htmlFinish = 0; Boolean playerFound = true; string playerDetailsHtml = String.Empty; int positonStartPlayerDetals = 0; int positonEndPlayerDetals = 0; string id = String.Empty; string nickname = String.Empty; string name = String.Empty; string link = String.Empty; string country = String.Empty; string rating = String.Empty; try { position = teamSofifaHTML.IndexOf("<tbody>"); teamSofifaHTML = teamSofifaHTML.Substring(position + 1); position = teamSofifaHTML.Substring(7).IndexOf("tbody>"); teamSofifaHTML = teamSofifaHTML.Substring(0, position + 14); teamSofifaHTML = teamSofifaHTML.Replace("<tbody>", "</tbody>"); teamSofifaHTML = "<" + teamSofifaHTML; htmlFinish = teamSofifaHTML.IndexOf("</tbody>"); positonStartPlayerDetals = teamSofifaHTML.IndexOf("<tr"); positonEndPlayerDetals = teamSofifaHTML.IndexOf("</tr"); playerDetailsHtml = teamSofifaHTML.Substring(positonStartPlayerDetals, positonEndPlayerDetals); while (playerFound == true) { playerDetailsSplitFromHtml(playerDetailsHtml, ref id, ref nickname, ref name, ref link, ref country, ref rating); if (!String.IsNullOrEmpty(id) && id.All(char.IsDigit)) { scorerDetails = new ScorerDetails(); scorerDetails.id = Convert.ToInt32(id); scorerDetails.name = name; scorerDetails.nickname = nickname; scorerDetails.link = link; scorerDetails.country = country; scorerDetails.rating = rating; scorerDetails.sofifaTeamID = Convert.ToString(teamModel.teamSofifaID); scorerDetails.teamID = teamModel.id; paramName = new string[] { "pIdGoleador" }; paramValue = new string[] { id }; dt = db.executePROC("spGetGoleadorByGoleador", paramName, paramValue); if (dt.Rows.Count == 0) { paramName = new string[] { "pIdGoleador", "pIdTime", "pNmGoleador", "pNmCompleto", "pDsLink", "pDsPais", "pIdSofifa", "pTipo", "pIdUsu" }; paramValue = new string[] { Convert.ToString(scorerDetails.id), Convert.ToString(scorerDetails.teamID), scorerDetails.nickname, scorerDetails.name, scorerDetails.link, scorerDetails.country, scorerDetails.sofifaTeamID, "H2H", "0" }; dt = db.executePROC("spAddGoleador", paramName, paramValue); } listOfScorer.Add(scorerDetails); positonStartPlayerDetals = positonEndPlayerDetals + 4; positonEndPlayerDetals = teamSofifaHTML.Length - positonStartPlayerDetals; teamSofifaHTML = teamSofifaHTML.Substring(positonStartPlayerDetals, positonEndPlayerDetals); positonStartPlayerDetals = teamSofifaHTML.IndexOf("<tr"); positonEndPlayerDetals = teamSofifaHTML.IndexOf("</tr"); if (positonStartPlayerDetals > -1 && positonEndPlayerDetals > -1) { playerDetailsHtml = teamSofifaHTML.Substring(positonStartPlayerDetals, positonEndPlayerDetals - positonStartPlayerDetals); } else { playerFound = false; } } else { playerFound = false; } } teamModel.listOfScorer = listOfScorer; teamModel.returnMessage = "ModeratorSuccessfully"; } catch (Exception ex) { teamModel.listOfScorer = new List <ScorerDetails>(); teamModel.returnMessage = "errorGetTeamDetails_" + ex.Message; } finally { scorerDetails = null; listOfScorer = null; dt = null; } }