public GasStationsMapsView(GasStationModel gasStationSelected) { InitializeComponent(); gasStationSelected.Picture = new ImageService().SaveImageFromBase64(gasStationSelected.Picture, gasStationSelected.ID); MapGasStations.GasStation = gasStationSelected; //centra el mapa con las coordenadas de la mascota MapGasStations.MoveToRegion( MapSpan.FromCenterAndRadius( new Position( gasStationSelected.Latitude, gasStationSelected.Longitude ), Distance.FromMiles(.5) ) ); //agrega un pin al mapa con las coordenadas de la mascota MapGasStations.Pins.Add( new Pin { Type = PinType.Place, Label = gasStationSelected.BranchOffice, Position = new Position( gasStationSelected.Latitude, gasStationSelected.Longitude ) } ); }
private void CreateInformation() { using (GasStationModel db = new GasStationModel()) { _infoFuel = db.Type_Fuel.ToList(); } var infoTable = new DataTable(); infoTable.Columns.Add("Назва", typeof(string)); infoTable.Columns.Add("Ціна грн\\л", typeof(float)); infoTable.Columns.Add("Запаси", typeof(float)); if (_client != null) { infoTable.Columns.Add("Ціна клієнту", typeof(float)); } for (int i = 0; i < _infoFuel.Count; i++) { var row = infoTable.NewRow(); row[0] = _infoFuel[i].Name_Fuel; row[1] = _infoFuel[i].Price; row[2] = _infoFuel[i].Count_Fuel; if (_client != null) { row[3] = _infoFuel[i].Price - _client.Personal_Discount; } infoTable.Rows.Add(row); } Information = infoTable; }
public MapWindow(GasStationModel gasStation) { this.InitializeComponent(); WindowPicture.Source = new BitmapImage(new Uri(gasStation.Picture)); WindowBranchOffice.Text = gasStation.BranchOffice; WindowCompany.Text = gasStation.Company; }
public Task <int> SaveGasStationAsync(GasStationModel item) { if (item.ID != 0) { return(Connection.UpdateAsync(item)); } else { return(Connection.InsertAsync(item)); } }
public List <TmpJoinClass> GetListStatistic() { List <TmpJoinClass> rez; using (var db = new GasStationModel()) { rez = db.Sell_Fuel.Join(db.Type_Fuel, s => s.Fuel_Id, t => t.Fuel_Id, (s, t) => new { Name = t.Name_Fuel, Count = s.Count_Sell }).GroupBy(x => x.Name).Select(g => new TmpJoinClass { Name = g.Key, Count = g.Sum(x => x.Count) }).ToList(); } return(rez); }
protected override void OnElementChanged(ElementChangedEventArgs <Map> e) { base.OnElementChanged(e); if (e.OldElement != null) { NativeMap.MapElementClick -= OnMapElementClick; NativeMap.Children.Clear(); NativeMap = null; GasStationWindow = null; } if (e.NewElement != null) { this.GasStation = (e.NewElement as MyMap).GasStation; var formsMap = (MyMap)e.NewElement; NativeMap = Control as MapControl; NativeMap.Children.Clear(); NativeMap.MapElementClick += OnMapElementClick; var position = new BasicGeoposition { Latitude = GasStation.Latitude, Longitude = GasStation.Longitude }; var point = new Geopoint(position); var mapIcon = new MapIcon(); mapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///pin.png")); mapIcon.CollisionBehaviorDesired = MapElementCollisionBehavior.RemainVisible; mapIcon.Location = point; mapIcon.NormalizedAnchorPoint = new Windows.Foundation.Point(0.5, 1.0); NativeMap.MapElements.Add(mapIcon); } }
public void LogIn() { if (Int32.TryParse(PersonalNum, out var id)) { using (GasStationModel db = new GasStationModel()) { if (db.Personal.Count(x => x.Personal_Num == id && x.Password == Password) == 1) { Connecting = "Вхід"; var personal = db.Personal.Single(x => x.Personal_Num == id && x.Password == Password); SignIn?.Invoke(this, new PersonalEventArgs() { Personal = personal }); } else { MessageBox.Show("Помилка входу! \nПрацівника не існує або невірний пароль", "Помилка входу", MessageBoxButton.OK); } } } }
public GasStationDetailView(GasStationsListViewModel gasStationsListViewModel, GasStationModel gasStation) { InitializeComponent(); BindingContext = new GasStationDetailViewModel(gasStationsListViewModel, gasStation); }
public Task <int> DeleteGasStationAsync(GasStationModel item) { return(Connection.DeleteAsync(item)); }