static void Main(string[] args) { using (var connection = PMCConnection.Create()) { connection.Open(); PMCDatabaseInstantiator.Init(connection, "PMCDB"); Console.WriteLine("Database init done."); if (ContainerService.Count(connection) < containerArraySize || MatrixService.Count(connection) < matrixArraySize || PositionService.Count(connection) < positionArraySize || PointService.Count(connection) < pointArraySize) { WriteTestDataToDB(connection); } TestElementsFromDB(connection); var containers = LoadDataFromDbToModel(connection); TestElementsFromPMCModel(containers); Console.WriteLine("End"); connection.Close(); } Console.ReadLine(); }
public async Task Simple1() { // arrange // Buckets: // BTC/USD // Prices: // BTC/USD var btcUsdBucket = new Bucket("BTC", "BTCUSD", "BTC", "USD"); var internalQuotesService = new InternalQuotesService(NullLogger <InternalQuotesService> .Instance); var positionService = new PositionService(internalQuotesService, NullLogger <PositionService> .Instance); var bucket = new Bucket("BTC", "BTCUSD", "BTC", "USD"); positionService.AddBucket("BTC", bucket); var trade = new Trade("1", "1", "BTCUSD", "BTC", "USD", 1, -10000, 10000, DateTime.Now); // act await positionService.HandleAsync(trade); // assert var updatedBucket = positionService.GetBucket("BTC"); Assert.Equal(1, updatedBucket.BaseVolume); Assert.Equal(-10000, updatedBucket.QuoteVolume); }
public ActionResult Create() { PositionService posServ = new PositionService(); ViewBag.Structure = posServ.GetStructureListByParentID(0); return(PartialView("Create")); }
public ChirperExtension() { logger = UserMod.Services.GetService <ILogger>(); filterService = UserMod.Services.GetService <FilterService>(); inputService = UserMod.Services.GetService <InputService>(); positionService = UserMod.Services.GetService <PositionService>(); }
public UpdateWithFlyOptomotorResponse(IServiceContainer wObj, Game game) : base(wObj, game) { //load all necessary services flyPos = (KalmanFilterTrack)game.Services.GetService(typeof(KalmanFilterTrack)); posServ = (PositionService)wObj.GetService(typeof(PositionService)); pType = (VRProtocol)game.Services.GetService(typeof(VRProtocol)); name = (NameService)wObj.GetService(typeof(NameService)); if ((UpdateSubsystem)game.Services.GetService(typeof(UpdateSubsystem)) != null) { //add this update service to the update subsystem list UpdateSubsystem us = (UpdateSubsystem)game.Services.GetService(typeof(UpdateSubsystem)); us.AddUpdateService(name.ObjectName() + "UpdateWithFlyOptomotorResponse", this); } pType.pType = VRProtocolType.ClosedLoop; //calibration values c[0] = 0.0012f; c[1] = -0.8937f; c[2] = 0.0000f; c[3] = 0.0005f; c[4] = 1; c[5] = 0.0013f; c[6] = -0.0000f; c[7] = -0.3741f; c[8] = 11.6243f; c[9] = 5.6421f; c[10] = -12.9017f; c[11] = -0.9338f; //protocol trial structure load (pre-defined) frames = GetFrames(); protocol = GetProtocol(); }
public IHttpActionResult Get() { PositionService positionService = CreatePositionService(); var positions = positionService.GetPositions(); return(Ok(positions)); }
public IHttpActionResult GetPositionByDeptId(int DeptId) { PositionService positionService = CreatePositionService(); var position = positionService.GetPositionsByDept(DeptId); return(Ok(position)); }
public ActionResult Edit(int id) { PositionService service = new PositionService(); PositionVM selectVM = service.SelectById(id); return(View(selectVM)); }
static Program() { client = CreateClient(GetTokenDictionary("Admin", "Password")["access_token"]); portfolioService = new PortfolioService(path, client); positionService = new PositionService(path, client); userService = new UserService(path, client); }
public ActionResult Details() { Employee employee = AuthenticationManager.LoggedEmployee; DetailsEmployeeVM model = new DetailsEmployeeVM(); model.Id = employee.Id; model.Email = employee.Email; model.FirstName = employee.FirstName; model.SecondName = employee.SecondName; model.LastName = employee.LastName; model.Phone = employee.Phone; model.AdminRole = employee.AdminRole; EmployeeService EmployeeService = new EmployeeService(); model.Manager = employee.ManagerId != 0 ? EmployeeService.GetById(employee.ManagerId).FirstName + " " + EmployeeService.GetById(employee.ManagerId).LastName : ""; PositionService PositionService = new PositionService(); model.Position = PositionService.GetById(employee.PositionId).Name; TeamService TeamService = new TeamService(); model.Team = TeamService.GetById(employee.TeamId).Name; model.Adress = employee.Adress; model.DateOfBirth = employee.DateofBirth; return(View(model)); }
public ActionResult List() { PositionService service = new PositionService(); List <PositionVM> list = service.SelectList(); return(View(list)); }
public override void Initialize(IServiceProvider provider, VirtualWorld VW) { var wo = (IServiceContainer)provider.GetService(typeof(IServiceContainer)); var pos = new PositionService(wo, VW, new Vector3(x, y, z), new Vector3(rx, ry, rz), scale); wo.AddService(typeof(PositionService), pos); }
public void MostrarLugares() { ViewModel.Estaciones.Clear(); var bicicletaEstacionTables = BicicletaEstacionDC.GetAll(); foreach (var bicicletaEstacionTable in bicicletaEstacionTables) { bicicletaEstacionTable.Distance = App.Configuration.IsLocationEnabled ? GetMeasureString(bicicletaEstacionTable) : string.Empty; } var list = App.Configuration.IsLocationEnabled ? bicicletaEstacionTables.OrderBy(x => x.GetDistanceTo(PositionService.GetCurrentLocation())) : bicicletaEstacionTables.OrderBy(x => x.Nombre); var lugares = new ObservableCollection <BicicletaEstacionTable>(list); foreach (var lugar in lugares) { if (!App.Configuration.IsLocationEnabled) { lugar.Distance = string.Empty; } ViewModel.AddEstacion(lugar); } }
private string GetMeasureString(BicicletaEstacionTable ll) { var currentLocation = PositionService.GetCurrentLocation(); return(StringExtensions.GetMeasureString(ll.Latitud, ll.Longitud, currentLocation.Location.Latitude, currentLocation.Location.Longitude)); }
public ActionResult FindPageList() { int count = 0; var list = PositionService.GetPageList(Request.Params); return(ToDataGrid(list, count)); }
public ActionResult AddPosition(string positionTitle) { if (string.IsNullOrEmpty(positionTitle)) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Json(new { error = "Некорректное название должности." })); } else { var positionItem = new Position() { Title = positionTitle.Trim() }; try { var dbPosition = new PositionService(); positionItem = dbPosition.Create(positionItem); } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Json(new { error = ex.Message })); } return(Json(positionItem)); } }
/* Store the X position defined by the user */ private void StringX_TextChanged(object sender, EventArgs e) { double i; if (Double.TryParse(this.StringX.Text, NumberStyles.Float, provider, out i)) { if (!this.wObj.ContainService(typeof(PositionService))) { PositionService positionService = new PositionService(this.createWorld.game); positionService.position.X = (float)i; this.wObj.AddService(typeof(PositionService), positionService); } else { PositionService positionService = (PositionService)this.wObj.GetService(typeof(PositionService)); positionService.position.X = (float)i; } } else { if (this.StringX.Text != "" && this.StringX.Text != "-") { this.StringX.Text = "0"; InsertNumber insNumb = new InsertNumber(); insNumb.ShowDialog(); } } }
public async Task <List <Store_PositionDTO> > SingleListPosition([FromBody] Store_PositionFilterDTO Store_PositionFilterDTO) { if (!ModelState.IsValid) { throw new BindException(ModelState); } PositionFilter PositionFilter = new PositionFilter(); PositionFilter.Skip = 0; PositionFilter.Take = int.MaxValue; PositionFilter.OrderBy = PositionOrder.Id; PositionFilter.OrderType = OrderType.ASC; PositionFilter.Selects = PositionSelect.ALL; PositionFilter.Id = Store_PositionFilterDTO.Id; PositionFilter.Code = Store_PositionFilterDTO.Code; PositionFilter.Name = Store_PositionFilterDTO.Name; List <Position> Positions = await PositionService.List(PositionFilter); List <Store_PositionDTO> Store_PositionDTOs = Positions .Select(x => new Store_PositionDTO(x)).ToList(); return(Store_PositionDTOs); }
public IHttpActionResult GetPositionByPositionId(int PositionId) { PositionService positionService = CreatePositionService(); var position = positionService.GetPositionById(PositionId); return(Ok(position)); }
// GET: Position // Position/Index public ActionResult Index() { PositionService service = CreatePositionService(); var model = service.GetPositions(); return(View(model)); }
public PositionServiceTest() { var fixture = new Fixture(); repositoryMock = fixture.Freeze <Mock <IRepositoryWrapper> >(); positionService = new PositionService(repositoryMock.Object); }
private PositionService CreatePositionService() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new PositionService(userId); return(service); }
// Включение\выключение видеочата public void OnTakePhotoButtonClicked() { //chat.TakeScreenShotAndSend(); chat.StartVideoChat(); // запоминаем положение модели в синглтон PositionService.getInstance().ModelPosition = Model.transform.position; }
public ActionResult Edit([Bind(Include = "Employee, availablePositions, availableDepartments, availableManagers")] EmployeeViewModel employeeView) { var context = new EmployeeManagerContext(); var positionService = new PositionService(context); var departmentService = new DepartmentService(context); var employeeService = new EmployeeService(context); employeeView.Employee.Position = positionService.GetPositionByID(employeeView.Employee.Position.PositionID); employeeView.Employee.Department = departmentService.GetDepartmentByID(employeeView.Employee.Department.DepartmentID); employeeView.Employee.Manager = employeeService.GetEmployeeByID(employeeView.Employee.Manager.EmployeeID); try { if (ModelState.IsValid) { employeeService.UpdateEmployee(employeeView.Employee); employeeService.Save(); return(RedirectToAction("Index")); } } catch (DataException /* dex */) { //Log the error (uncomment dex variable name after DataException and add a line here to write a log. ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(View(employeeView)); }
public ComoLlegar() { InitializeComponent(); var markerLayer = new MapLayer(); var posicion = new GeoCoordinate(-34.5584560886206, -58.4167098999023); var pushpin = new MapOverlay() { GeoCoordinate = posicion, }; markerLayer.Add(pushpin); Mapa.Layers.Add(markerLayer); Mapa.Center = posicion; Mapa.ZoomLevel = 14; if (App.Configuration.IsLocationEnabled && PositionService.GetCurrentLocation().Location != null) { pushpin = new MapOverlay { GeoCoordinate = PositionService.GetCurrentLocation().Location, ContentTemplate = App.Current.Resources["locationPushpinTemplate"] as DataTemplate, }; markerLayer.Add(pushpin); Mapa.SetView(Mapa.CreateBoundingRectangle()); } }
// 呼叫service將資料新增至資料庫 public void AddPosition() { this._positionService = new PositionService(_positionModel); int errorFlag = 0; if (this._positionModel.GetId() == "" || this._positionModel.GetName() == "" || this._positionModel.GetAuthoId() == "") { MessageBox.Show("尚有欄位為空白, 請重新確認是否填寫完畢!"); errorFlag = 1; } if (errorFlag == 1) { return; } if (_positionService.AddPosition()) { MessageBox.Show("新增成功!"); } else { MessageBox.Show("新增失敗!"); } }
private void DenunciaButton_OnClick(object sender, RoutedEventArgs e) { Loading.Visibility = Visibility.Visible; var position = PositionService.GetCurrentLocation(); RequestModel = new DenunciaPreciosModel { Date = DateTime.UtcNow, InstallationId = App.Configuration.InstallationId.ToString(), AppId = App.Configuration.Name, AppVersion = App.Configuration.Version, Lat = position.Location.Latitude, Lon = position.Location.Longitude, MarketId = App.Configuration.SelectedMarket.Value, RegionId = App.Configuration.SelectedRegion.Value, Type = ((ListPickerItem)TypeList.SelectedItem).Content.ToString(), Address = ProdDireccion.Text, ProductId = _estacion.Id, Comment = ProdComentarios.Text, MarketName = ((CategoryItem)MarketList.SelectedItem).Id, }; var webRequest = WebRequest.CreateHttp("/api/denunciaprecios".ToApiCallUri()); webRequest.Method = "POST"; webRequest.BeginGetRequestStream(GetRequestStreamCallback, webRequest); }
//呼叫service 利用positionID查詢position資料 public PositionPresentationModel SearchDataByPositionID() { PositionPresentationModel positionPresentationModel = new PositionPresentationModel(); if (this._positionModel.GetId() == null || this._positionModel.GetId() == "") { MessageBox.Show("請輸入職位ID"); } else { //MessageBox.Show("yes"); _positionService = new PositionService(this._positionModel); _positionModel = _positionService.searchByPositionID(); positionPresentationModel.SetPositionID(_positionModel.GetId()); positionPresentationModel.SetPositionName(_positionModel.GetName()); positionPresentationModel.SetPositionBasicSalary(_positionModel.GetBasicSalary()); positionPresentationModel.SetPositionAuthoID(_positionModel.GetAuthoId()); if (positionPresentationModel.GetPositionName() == null || positionPresentationModel.GetPositionName() == "") { MessageBox.Show("此職位ID不存在!"); //MessageBox.Show(_authoModel.GetAuthoID()); positionPresentationModel.SetPositionID(null); } } return(positionPresentationModel); }
public PositionDTO NetPosition(NetPositionFormDTO form) { var cache = WebCache.Instance; var prodDef = cache.ProdDefs.FirstOrDefault(o => o.Id == form.securityId); if (prodDef.QuoteType == enmQuoteType.Closed || prodDef.QuoteType == enmQuoteType.Inactive) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, Resources.Resource.ProductClosed)); } var quote = cache.Quotes.FirstOrDefault(o => o.Id == form.securityId); var positionService = new PositionService(); var closedPosition = positionService.DoClosePosition(UserId, form.posId, form.securityId, Quotes.GetLastPrice(quote)); var posIdToFollowClose = closedPosition.Id; Task.Run(() => { YJYGlobal.LogLine("NEW THREAD: check and CLOSE follow positions for pos " + posIdToFollowClose); var checkAndCloseFollowPositions = PositionService.CheckAndCloseFollowPositions(posIdToFollowClose); MessageService.AddAutoCloseMessages(checkAndCloseFollowPositions); }); var result = Mapper.Map <PositionDTO>(closedPosition); return(result); }
public override void DoProcess() { PositionService service = new PositionService(); Position newData = new Position() { // 代码. CommodityCode = this.Code, // 用户. UserCode = this.UserCode, // 数量. Quantity = this.Quantity, // 做多. IsLong = true, // 有效. IsActive = true, }; bool result = service.ClosePosition(newData); if (result) { logger.Info("Success!"); } else { logger.Info("Fail!"); logger.Info(service.ResultMessage); } }