private void DetectionCycle(PositionDataModel positions, List <ExerciceEvaluation> exoEvalList, ref SingletonReeducation ValeurReeducation, ref List <DataPosition> tempData) { if (exoEvalList[0].TypeEval == ExerciceEvalTypes.Mouvement) { ExerciceMouvement ef = (ExerciceMouvement)exoEvalList[0]; if (ef.TypeDroite == DroiteType.Vertical)//Target { Target ExMvtsRythmiques = (Target)exoEvalList[0]; ExMvtsRythmiques.DecoupeCycle(positions, ref exoEvalList, ref ValeurReeducation, ref tempData, ref dectectINIT); } else if (ef.TypeDroite == DroiteType.VerticalLong)//FreeAmplitude { Init(positions, XINIT, YINITFREEAMP, DISTFREEAMP, ref tempData); longdroitetrou = true; } } else if (exoEvalList[0].TypeEval == ExerciceEvalTypes.Forme)//Ex de type Forme { ExerciceForme exF = (ExerciceForme)exoEvalList[0]; if (exF.TypeForme == FormeType.Cercle) { Init(positions, XINIT, YINITCERCLE, DIST, ref tempData); longdroitetrou = true; } else if (exF.TypeForme == FormeType.Carré) { Init(positions, XINIT, YINITCARRE, DIST, ref tempData); longdroitetrou = true; carreCycle = true; } } }
/// <summary> /// Initializes a new instance of the MainPViewModel class. /// </summary> public MainPViewModel(ActionRobot _axrob, IMessageBoxService _mbs) { _messageBoxService = _mbs; _axrobot = _axrob; FondUi = "Resources\\Image\\Background\\Axi_FondEcran_T.png"; _positionUiBuffer = new PositionDataModel(); _position2UiBuffer = new PositionDataModel(); this._mainLoop = new System.Timers.Timer(); _mainLoop = new System.Timers.Timer(20); // Create a timer with a twenty second interval. 50Hz _mainLoop.Elapsed += new System.Timers.ElapsedEventHandler(OnMainLoopSequenceEvent); // Hook up the Elapsed event for the timer. _mainLoop.Enabled = true; _positionRobotLive = new PointCollection(); _position2RobotLive = new PointCollection(); _styleRobotLive = new PolylineConfig(false, 5, "Continu", Brushes.Orange); //7.5 _styleRobotLive2 = new PolylineConfig(false, 5, "Continu", Brushes.Orange); //7.5 _axrobot.Pss.PositionDataReceived += new onPositionDataReceived(_portSerieService_PositionDataReceived); _axrobot.Pss.Position2DataReceived += new onPosition2DataReceived(_portSerieService_Position2DataReceived); CreateMessages(); Debug.Print("MainPViewModel OK"); }
public static int Create(PositionDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Create", requestProfile); var newId = DBDML.RunScalarSQL("Position.Insert", sql, DataStoreKey); return(Convert.ToInt32(newId)); }
protected virtual void OnPositionDataReceived(PositionDataModel e) { if (PositionDataReceived != null) { PositionDataReceived(this, e); } }
void _portSerieService_PositionDataReceived(object sender, PositionDataModel e) { //lock (locker) //{ _positionUiBuffer.PositionX = (int)EchelleUtils.MiseEchelleXPosition(e.PositionX); _positionUiBuffer.PositionY = (int)EchelleUtils.MiseEchelleYPosition(e.PositionY); //} }
public PositionDataModel GetById(string value) { var dataQuery = new PositionDataModel(); dataQuery.PositionId = int.Parse(value); var result = PositionDataManager.GetEntityDetails(dataQuery, SessionVariables.RequestProfile, 1); return result[0]; }
public void Init(PositionDataModel positions, double x, double y, double dist, ref List <DataPosition> tempData) { if (dectectINIT == true) { initdetextstop.X = positions.PositionX / 100.0; initdetextstop.Y = positions.PositionY / 100.0; _notCibles = false; DistanceInitConf(x, y, dist, ref tempData); } }
public static bool DoesExist(PositionDataModel data, RequestProfile requestProfile) { var doesExistRequest = new PositionDataModel(); doesExistRequest.ApplicationId = data.ApplicationId; var list = GetEntityDetails(doesExistRequest, requestProfile, 0); return(list.Count > 0); }
public void CollecteDonneesBrutes(PositionDataModel position) { positionXYforceXY[2] = position.PositionX; positionXYforceXY[3] = position.PositionY; if (activOF == true) { AddNewLine(positionXYforceXY); } }
void Pss_PositionDataReceived(object sender, PositionDataModel e) { if (canDoMath) { this.listPos.Add(e); } if (this.canSendPos) { if (Singleton.UniBi) { // Unimanuel if (Singleton.MainGaucheX) { // gauche var posXPix = EchelleUtils.MiseEchelleXPosition(e.PositionXd); var calibXPix = EchelleUtils.MiseEchelleXPosition(Singleton.CalibrX * 100); this.pixelX = posXPix - calibXPix + this.centreX; var posYPix = EchelleUtils.MiseEchelleYPosition(e.PositionYd); var calibYPix = EchelleUtils.MiseEchelleYPosition(Singleton.CalibrY * 100); this.pixelY = posYPix - calibYPix + this.centreY; } } else { // Bimanuel if (Singleton.MainGaucheX) { // gauche var posXPix = EchelleUtils.MiseEchelleXPosition(e.PositionXd); var calibXPix = EchelleUtils.MiseEchelleXPosition(Singleton.CalibrX * 100); this.pixelX = posXPix - calibXPix + this.centreX; } else { // droite var posYPix = EchelleUtils.MiseEchelleYPosition(e.PositionYd); var calibYPix = EchelleUtils.MiseEchelleYPosition(Singleton.CalibrY * 100); this.pixelY = posYPix - calibYPix + this.centreY; } } if (this.game != null) { this.game.SetPositions(pixelX, pixelY); } } }
public static void Delete(PositionDataModel data, RequestProfile requestProfile) { const string sql = @"dbo.PositionDelete "; var parameters = new { AuditId = requestProfile.AuditId , PositionId = data.PositionId }; using (var dataAccess = new DataAccessBase(DataStoreKey)) { dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure); } }
public void DecoupageCycle(PositionDataModel positions, ref List <ExerciceEvaluation> exoEvalList, ref SingletonReeducation ValeurReeducation, ref List <DataPosition> tempData) { DetectionCycle(positions, exoEvalList, ref ValeurReeducation, ref tempData); if (longdroitetrou == true) { EnregistrerCycle(positions, ref ValeurReeducation, ref tempData); } //TODO : il faudra changer ca pour le démarrer après la zone de confort ! if (dectectSTART == false) { tempData.Add(new DataPosition(positions.PositionX / 100.0, positions.PositionY / 100.0)); // TODO : enregistrement data AddTxtLine(positionXYforceXY[0], positionXYforceXY[1], positionXYforceXY[2] / 100.0, positionXYforceXY[3] / 100.0); } }
public void DecoupeCycle(PositionDataModel positions, ref List <ExerciceEvaluation> exoEvalList, ref SingletonReeducation ValeurReeducation, ref List <DataPosition> tempData, ref bool dectectINIT) { dectectSTART = false; if (dectectSTOP == true)//Pour détecter quand le mouvement s'arrête { _detectionStop.Add(new DataPosition(positions.PositionX / 100.0, positions.PositionY / 100.0)); if (_detectionStop.Count >= endPoints) { DistanceTab(ref exoEvalList, ref ValeurReeducation, ref tempData);//Si les 50 derniers points sont compris dans un périmètre (default 0.8), on considère que le mouvement est terminé _detectionStop.Clear(); } } else { Init(positions, XINIT, YINITTARGET, DIST, ref tempData); longdroitetrou = true; } }
public static string Save(PositionDataModel data, string action, RequestProfile requestProfile) { var sql = "EXEC "; switch (action) { case "Create": sql += "dbo.PositionInsert " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId); break; case "Update": sql += "dbo.PositionUpdate " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId); break; default: break; } sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.PositionId); sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.InvestmentCode); sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.PeriodDate); sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.CustodianCode); sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.StrategyCode); sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.AccountCode); sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.Quantity); sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.CostBasis); sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.MarketValue); sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.StartMarketValue); sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.DeltaAdjustedExposure); sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.StartDeltaAdjustedExposure); sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.RealizedPnL); sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.UnrealizedPnL); sql = sql + ", " + ToSQLParameter(data, PositionDataModel.DataColumns.Mark); return(sql); }
public static List <PositionDataModel> GetEntityDetails(PositionDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails) { const string sql = @"dbo.PositionSearch "; var parameters = new { AuditId = requestProfile.AuditId , ApplicationId = requestProfile.ApplicationId , ReturnAuditInfo = returnAuditInfo , PositionId = dataQuery.PositionId }; List <PositionDataModel> result; using (var dataAccess = new DataAccessBase(DataStoreKey)) { result = dataAccess.Connection.Query <PositionDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList(); } return(result); }
private void Pss_PositionDataReceived(object sender, PositionDataModel e) { // Sauvegarde des derniére positions connue if (Singleton.UniBi) { // Unimanuel if (Singleton.MainGaucheX) { // gauche this.calibrX = e.PositionX; this.calibrY = e.PositionY; this.pixelX = EchelleUtils.MiseEchelleXPosition(e.PositionX); this.pixelY = EchelleUtils.MiseEchelleYPosition(e.PositionY); } } else { // Bimanuel if (Singleton.MainGaucheX) { // gauche this.calibrX = e.PositionX; this.pixelX = EchelleUtils.MiseEchelleXPosition(e.PositionX); } else { // droite this.calibrY = e.PositionY; this.pixelY = EchelleUtils.MiseEchelleYPosition(e.PositionY); } } if (this.game != null) { this.game.SetPositions(pixelX, pixelY); } }
public static void Update(PositionDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Update", requestProfile); DBDML.RunSQL("Position.Update", sql, DataStoreKey); }
public static string ToSQLParameter(PositionDataModel data, string dataColumnName) { var returnValue = "NULL"; switch (dataColumnName) { case PositionDataModel.DataColumns.PositionId: if (data.PositionId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, PositionDataModel.DataColumns.PositionId, data.PositionId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, PositionDataModel.DataColumns.PositionId); } break; case PositionDataModel.DataColumns.InvestmentCode: if (!string.IsNullOrEmpty(data.InvestmentCode)) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, PositionDataModel.DataColumns.InvestmentCode, data.InvestmentCode); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, PositionDataModel.DataColumns.InvestmentCode); } break; case PositionDataModel.DataColumns.PeriodDate: if (data.PeriodDate != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, PositionDataModel.DataColumns.PeriodDate, data.PeriodDate); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, PositionDataModel.DataColumns.PeriodDate); } break; case PositionDataModel.DataColumns.CustodianCode: if (!string.IsNullOrEmpty(data.CustodianCode)) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, PositionDataModel.DataColumns.CustodianCode, data.CustodianCode); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, PositionDataModel.DataColumns.CustodianCode); } break; case PositionDataModel.DataColumns.StrategyCode: if (!string.IsNullOrEmpty(data.StrategyCode)) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, PositionDataModel.DataColumns.StrategyCode, data.StrategyCode); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, PositionDataModel.DataColumns.StrategyCode); } break; case PositionDataModel.DataColumns.AccountCode: if (!string.IsNullOrEmpty(data.AccountCode)) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, PositionDataModel.DataColumns.AccountCode, data.AccountCode); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, PositionDataModel.DataColumns.AccountCode); } break; case PositionDataModel.DataColumns.Quantity: if (data.Quantity != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, PositionDataModel.DataColumns.Quantity, data.Quantity); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, PositionDataModel.DataColumns.Quantity); } break; case PositionDataModel.DataColumns.CostBasis: if (data.CostBasis != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, PositionDataModel.DataColumns.CostBasis, data.CostBasis); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, PositionDataModel.DataColumns.CostBasis); } break; case PositionDataModel.DataColumns.MarketValue: if (data.MarketValue != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, PositionDataModel.DataColumns.MarketValue, data.MarketValue); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, PositionDataModel.DataColumns.MarketValue); } break; case PositionDataModel.DataColumns.StartMarketValue: if (data.StartMarketValue != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, PositionDataModel.DataColumns.StartMarketValue, data.StartMarketValue); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, PositionDataModel.DataColumns.StartMarketValue); } break; case PositionDataModel.DataColumns.DeltaAdjustedExposure: if (data.DeltaAdjustedExposure != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, PositionDataModel.DataColumns.DeltaAdjustedExposure, data.DeltaAdjustedExposure); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, PositionDataModel.DataColumns.DeltaAdjustedExposure); } break; case PositionDataModel.DataColumns.StartDeltaAdjustedExposure: if (data.StartDeltaAdjustedExposure != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, PositionDataModel.DataColumns.StartDeltaAdjustedExposure, data.StartDeltaAdjustedExposure); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, PositionDataModel.DataColumns.StartDeltaAdjustedExposure); } break; case PositionDataModel.DataColumns.RealizedPnL: if (data.RealizedPnL != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, PositionDataModel.DataColumns.RealizedPnL, data.RealizedPnL); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, PositionDataModel.DataColumns.RealizedPnL); } break; case PositionDataModel.DataColumns.UnrealizedPnL: if (data.UnrealizedPnL != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, PositionDataModel.DataColumns.UnrealizedPnL, data.UnrealizedPnL); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, PositionDataModel.DataColumns.UnrealizedPnL); } break; case PositionDataModel.DataColumns.Mark: returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, PositionDataModel.DataColumns.Mark, data.Mark); break; default: returnValue = BaseDataManager.ToSQLParameter(data, dataColumnName); break; } return(returnValue); }
public static DataTable Search(PositionDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 0); return(list.ToDataTable()); }
private void EnregistrerCycle(PositionDataModel positions, ref SingletonReeducation ValeurReeducation, ref List <DataPosition> tempData) { if ((positions.PositionY / 100.0 < DETECT_CYCLE)) { zzzTime = true; } if ((positions.PositionY / 100.0 >= DETECT_CYCLE) && (positions.PositionY / 100.0 > tempsMvtLongDroite.Y) && zzzTime == true)//En Cycle { _tabtempsMvtLongDroite.Add(new DataPosition(positions.PositionX / 100.0, positions.PositionY / 100.0)); if (zzzIndex == false) { tab10Index[0, CountCycle] = tempData.Count - 1; // enregistrement index debut zzzIndex = true; } cycleActif = true; } else if ((positions.PositionY / 100.0 < DETECT_CYCLE) && (positions.PositionY / 100.0 < tempsMvtLongDroite.Y) && cycleActif == true)//Fin de cycle { if (_tabtempsMvtLongDroite.Count != 0) { DataPosition min = new DataPosition(); min.X = _tabtempsMvtLongDroite[0].X; min.Y = _tabtempsMvtLongDroite[0].Y; if (carreCycle == false) { for (int i = 0; i < _tabtempsMvtLongDroite.Count; i++) { if (_tabtempsMvtLongDroite[i].Y > min.Y) { min.X = _tabtempsMvtLongDroite[i].X; min.Y = _tabtempsMvtLongDroite[i].Y; } } } _tabtempsMvtLongDroite.Clear(); // clear tableau de detection de fin de cycle tab10Index[1, CountCycle] = tempData.Count - 1; // enregistrement index fin tab10Index[2, CountCycle] = min.X; // enregistrement index fin tab10Index[3, CountCycle] = min.Y; // enregistrement index fin zzzIndex = false; CountCycle++; // incrementation compteur de cycle Messenger.Default.Send(CountCycle, "CompteurCycle"); if (CountCycle >= 10) // TODO : ici pour changer { ValeurReeducation.StartStop = false; // activer le post traitement des données longdroitetrou = false; cycleTot = CountCycle; Messenger.Default.Send(CountCycle, "CompteurCycle"); CountCycle = 0; // RAZ du compteur de cycle Messenger.Default.Send(CountCycle, "CompteurCycle"); for (int i = 0; i < tempData.Count; i++) { postTempData.Add(new DataPosition(tempData[i].X, tempData[i].Y)); } } cycleActif = false; } } longdroitetrou = false; tempsMvtLongDroite.X = positions.PositionX / 100.0; tempsMvtLongDroite.Y = positions.PositionY / 100.0; }
public void Delete(string value) { var dataDelete = new PositionDataModel(); dataDelete.PositionId = int.Parse(value); PositionDataManager.Delete(dataDelete, SessionVariables.RequestProfile); }