コード例 #1
0
ファイル: FeedLogic.cs プロジェクト: alexsp17/SnookerByb
        public NewsfeedWebModel GetNewsfeedForMetro(int myAthleteID, int metroID)
        {
            Metro  metro   = db.Metros.Where(i => i.MetroID == metroID).Single();
            string country = metro.Country;

            NewsfeedWebModel newsfeed = new NewsfeedWebModel();

            newsfeed.Items = new List <NewsfeedItemWebModel>();

            newsfeed.Items.AddRange(this.getPosts(myAthleteID,
                                                  (from i in db.Posts
                                                   where i.MetroID == metroID || (i.MetroID == null && i.Country == country)
                                                   select i)));
            newsfeed.Items.AddRange(this.getResults(myAthleteID,
                                                    (from i in db.Results
                                                     where i.Athlete.MetroID == metroID
                                                     select i)));
            newsfeed.Items.AddRange(this.getScores(myAthleteID,
                                                   (from i in db.Scores
                                                    where i.AthleteA.MetroID == metroID
                                                    select i)));
            newsfeed.Items.AddRange(this.getGameHosts(myAthleteID,
                                                      (from i in db.GameHosts
                                                       where i.EventType != (int)EventTypeEnum.Private
                                                       where i.Venue.MetroID == metroID
                                                       select i)));
            newsfeed.Items.AddRange(this.getNewUsers(myAthleteID,
                                                     (from i in db.Athletes
                                                      where i.MetroID == metroID
                                                      select i)));

            newsfeed.Items = newsfeed.Items.OrderByDescending(i => i.Time).Take(NewsfeedWebModel.MaxItems).ToList();
            return(newsfeed);
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("id,Name,Information,Photo")] Metro metro)
        {
            if (id != metro.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(metro);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MetroExists(metro.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(metro));
        }
コード例 #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (city_ != null)
            {
                hash ^= City.GetHashCode();
            }
            if (country_ != null)
            {
                hash ^= Country.GetHashCode();
            }
            if (metro_ != null)
            {
                hash ^= Metro.GetHashCode();
            }
            if (mostSpecific_ != null)
            {
                hash ^= MostSpecific.GetHashCode();
            }
            if (region_ != null)
            {
                hash ^= Region.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            mapBing.Children.Clear();
            var Lat   = lat.Text;
            var Lon   = lon.Text;
            var Rayon = rayon.Text;


            Metro metro = new Metro();

            List <BusStop> donnees = JsonConvert.DeserializeObject <List <BusStop> >(metro.getMetro($"http://data.metromobilite.fr/api/linesNear/json?x={Lon}&y={Lat}&dist={Rayon}&details=false"));

            List <BusStop> noDoublon = donnees.GroupBy(u => u.name).Select(grp => grp.First()).ToList();

            foreach (BusStop busStop in noDoublon)
            {
                listBusStop.Items.Add(busStop.name);

                //Console.Write(busStop.id + busStop.name + busStop.lon + busStop.lat);

                foreach (string line in busStop.lines)
                {
                    Pushpin  pushpin  = new Pushpin();
                    Location location = new Location(busStop.lat, busStop.lon);
                    pushpin.Location = location;
                    mapBing.Children.Add(pushpin);
                    listLines.Items.Add(line);

                    //Console.WriteLine(line);
                }
            }
            //Console.Read();
        }
コード例 #5
0
ファイル: MainWindow.cs プロジェクト: jsmsalt/curso-csharp
    protected void OnButton3Clicked(object sender, EventArgs e)
    {
        float metros      = float.Parse(txtBoxMetros1.Buffer.Text);
        Metro m           = new Metro(metros);
        float centimetros = ((Centimetro)m).getValor();

        txtBoxCentimetros1.Buffer.Text = centimetros.ToString();
    }
コード例 #6
0
ファイル: Train.cs プロジェクト: mambotuna/DOTS-training
 void SetupCarriages()
 {
     carriages = new List <TrainCarriage>();
     for (int i = 0; i < totalCarriages; i++)
     {
         GameObject    _tempCarriage_OBJ = (GameObject)Metro.Instantiate(Metro.INSTANCE.prefab_trainCarriage);
         TrainCarriage _TC = _tempCarriage_OBJ.GetComponent <TrainCarriage>();
         carriages.Add(_TC);
         _TC.SetColour(parentLine.lineColour);
     }
 }
コード例 #7
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Metro metro)
        {
            if (ModelState.IsValid)
            {
                _context.Add(metro);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(metro));
        }
コード例 #8
0
ファイル: SeederMetros.cs プロジェクト: alexsp17/SnookerByb
        public void PopulateMetrosIntoTheDatabase(List <Metro> metros, out int countNew, out int countModified, out int countError)
        {
            countNew      = 0;
            countModified = 0;
            countError    = 0;

            foreach (var metro in metros)
            {
                try
                {
                    Metro metroInDb = null;
                    if (metro.MetroID != 0)
                    {
                        metroInDb = db.Metros.Where(i => i.MetroID == metro.MetroID).FirstOrDefault();
                    }
                    if (metroInDb == null)
                    {
                        metroInDb = db.Metros.Where(i => i.Name == metro.Name && i.Latitude == metro.Latitude && i.Longitude == metro.Longitude).FirstOrDefault();
                    }

                    if (metroInDb == null)
                    {
                        metroInDb = new Metro()
                        {
                            Name      = metro.Name,
                            Country   = metro.Country,
                            Latitude  = metro.Latitude,
                            Longitude = metro.Longitude,
                        };
                        db.Metros.Add(metroInDb);
                        db.SaveChanges();
                        countNew++;
                    }
                    else if (metroInDb.Name != metro.Name ||
                             metroInDb.Country != metro.Country ||
                             metroInDb.Latitude != metro.Latitude ||
                             metroInDb.Longitude != metro.Longitude)
                    {
                        metroInDb.Name      = metro.Name;
                        metroInDb.Country   = metro.Country;
                        metroInDb.Latitude  = metro.Latitude;
                        metroInDb.Longitude = metro.Longitude;
                        db.SaveChanges();
                        countModified++;
                    }

                    metro.MetroID = metroInDb.MetroID;
                }
                catch (Exception)
                {
                    countError++;
                }
            }
        }
コード例 #9
0
        public MainViewModel()
        {
            MetroNavig = new Metro();
            Navigate   = new Command(arg => PassStationsToMetro(arg));

            string path = AppDomain.CurrentDomain.BaseDirectory;

            MetroNavig.ConnectionsSrc = path + CONNECTIONS_PATH;
            MetroNavig.NamesSrc       = path + STATIONS_PATH;
            MetroNavig.LinesSrc       = path + LINES_PATH;
            MetroNavig.LoadData();
        }
コード例 #10
0
        public void TestMetro4()
        {
            Metro metro = new Metro(points, edges);

            (List <Tuple <Station, Line> > path, int transfers) = metro.Find(Station.C, Station.L);
            Assert.AreEqual(path, new List <Tuple <Station, Line> >()
            {
                Tuple.Create(Station.K, Line.Green),
                Tuple.Create(Station.L, Line.Green),
            });
            Assert.AreEqual(transfers, 0);
        }
コード例 #11
0
    Platform AddPlatform(int _index_platform_START, int _index_platform_END)
    {
        BezierPoint _PT_START    = bezierPath.points[_index_platform_START];
        BezierPoint _PT_END      = bezierPath.points[_index_platform_END];
        GameObject  platform_OBJ =
            (GameObject)Metro.Instantiate(Metro.INSTANCE.prefab_platform, _PT_END.location, Quaternion.identity);
        Platform platform = platform_OBJ.GetComponent <Platform>();

        platform.SetupPlatform(this, _PT_START, _PT_END);
        platform_OBJ.transform.LookAt(bezierPath.GetPoint_PerpendicularOffset(_PT_END, -3f));
        platforms.Add(platform);
        return(platform);
    }
コード例 #12
0
        public void TestMetro2()
        {
            Metro metro = new Metro(points, edges);

            (List <Tuple <Station, Line> > path, int transfers) = metro.Find(Station.B, Station.E);
            Assert.AreEqual(path, new List <Tuple <Station, Line> >()
            {
                Tuple.Create(Station.C, Line.Red),
                Tuple.Create(Station.D, Line.Red),
                Tuple.Create(Station.E, Line.Red),
            });
            Assert.AreEqual(transfers, 0);
        }
コード例 #13
0
        public FindYourWayShow(string x = "5.727718", string y = "45.185603", int z = 500)
        {
            InitializeComponent();
            this.DataContext = this;


            Metro linemetro = new Metro();

            this.Stations = linemetro.GetLinesMetro(x, y, z, true, "http://data.metromobilite.fr/api/linesNear/json?x=5.727718&y=45.185603&dist=500&details=true");

            //Dictionary<string, SerializeProxima> LineMetro;

            //this.Stations = linemetro.GetLinesMetro("5.727718", "45.185603", 500, true, "http://data.metromobilite.fr/api/linesNear/json?x=5.727718&y=45.185603&dist=500&details=true");
        }
コード例 #14
0
    void Update_ValuesFromMetro()
    {
        Metro m = Metro.INSTANCE;

        lineName          = m.LineNames[metroLine_index];
        lineColour        = m.LineColours[metroLine_index];
        carriagesPerTrain = m.carriagesPerTrain[metroLine_index];
        if (carriagesPerTrain <= 0)
        {
            carriagesPerTrain = 1;
        }

        maxTrainSpeed = m.maxTrainSpeed[metroLine_index];
    }
コード例 #15
0
ファイル: Metro.cs プロジェクト: dcturner/ECS_METRO
    public static string GetLine_NAME_FromIndex(int _index)
    {
        string result = "";

        INSTANCE = FindObjectOfType <Metro>();
        if (INSTANCE != null)
        {
            if (INSTANCE.LineNames.Length - 1 >= _index)
            {
                result = INSTANCE.LineNames[_index];
            }
        }

        return(result);
    }
コード例 #16
0
ファイル: Metro.cs プロジェクト: dcturner/ECS_METRO
    public static Color GetLine_COLOUR_FromIndex(int _index)
    {
        Color result = Color.black;

        INSTANCE = FindObjectOfType <Metro>();
        if (INSTANCE != null)
        {
            if (INSTANCE.LineColours.Length - 1 >= _index)
            {
                result = INSTANCE.LineColours[_index];
            }
        }

        return(result);
    }
コード例 #17
0
        private async void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = true;
            Metro metro = new Metro();

            metro.ChangeAccent("Dark.Red");
            bool r = await metro.ShowConfirm("确认", "你确定关闭软件吗?");

            if (!r)
            {
                metro.ChangeAccent("Light.Blue");
            }
            else
            {
                System.Windows.Application.Current.Shutdown();
            }
        }
コード例 #18
0
        public async Task <IActionResult> Create([Bind("id,Name,Information,Photo")] Metro metro)
        {
            var   remoteIpAddres = Request.HttpContext.Connection.RemoteIpAddress.ToString();
            Users user           = _context.User.Where(x => x.IpAddress.Contains(remoteIpAddres)).FirstOrDefault();

            if (user != null && user.Status == "true")
            {
                ViewBag.user = user;
            }
            if (ModelState.IsValid)
            {
                _context.Add(metro);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(metro));
        }
コード例 #19
0
ファイル: Program.cs プロジェクト: roussim974/Csharp
        static void Main(string[] args)
        {
            Metro metro = new Metro();

            List <BusStop> donnees = JsonConvert.DeserializeObject <List <BusStop> >(metro.getMetro("http://data.metromobilite.fr/api/linesNear/json?x=5.704708&y=45.205311&dist=1600&details=false"));

            List <BusStop> noDoublon = donnees.GroupBy(u => u.name).Select(grp => grp.First()).ToList();

            foreach (BusStop busStop in noDoublon)
            {
                Console.Write(busStop.id + busStop.name + busStop.lon + busStop.lat);

                foreach (string line in busStop.lines)
                {
                    Console.WriteLine(line);
                }
            }
            Console.Read();
        }
コード例 #20
0
        public IActionResult AccountShop(string ID_Shop)
        {
            if (!HttpContext.User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Login", "Account"));
            }


            if (!CheckAdmin())
            {
                return(RedirectToAction("index", "Home"));
            }

            List <City>              cities        = City.GetCities();
            Shop                     shop          = Shop.GetItemAdmin(ID_Shop);
            List <Metro>             metros        = Metro.GetCities(shop.City.ID_City);
            List <TimeWayMetroClass> timeWayMetros = TimeWayMetroClass.GetTimewayMetro();

            List <IMG_Shop> imgsShop = IMG_Shop.GetShopIMGs(ID_Shop);

            // предустановка комбо боксов, в первом списке будут текущие значения
            cities.Insert(0, shop.City);
            timeWayMetros.Insert(0, new TimeWayMetroClass()
            {
                minutes = shop.TimeWayMetro, Comment = shop.TimeWayMetro.ToString()
            });
            if (shop.Metro != null)
            {
                metros.Insert(0, shop.Metro);
            }

            AccountShopVM accountShop = new AccountShopVM()
            {
                Shop          = shop,
                Citys         = cities,
                Metros        = metros,
                timeWayMetros = timeWayMetros,
                iMG_Shops     = imgsShop
            };


            return(View(accountShop));
        }
コード例 #21
0
        public void ApplyMetrosToVenuesWithoutMetros(out int countVenuesUpdated, out int countVenuesSkipped)
        {
            countVenuesUpdated = 0;
            countVenuesSkipped = 0;

            var metros = db.Metros.ToList();
            var venues = (from v in db.Venues
                          where v.MetroID == null
                          select v).ToList();

            foreach (var venue in venues)
            {
                var metrosInTheCountry = (from m in metros
                                          where m.Country == venue.Country
                                          select m).ToList();

                Metro    metroWithMinDistance = null;
                Distance minDistance          = null;

                foreach (var metro in metrosInTheCountry)
                {
                    Distance distance = Distance.Calculate(venue.Location, metro.Location);
                    if (minDistance == null || distance.Meters < minDistance.Meters)
                    {
                        minDistance          = distance;
                        metroWithMinDistance = metro;
                    }
                }

                if (minDistance != null && minDistance.Miles < 200)
                {
                    venue.MetroID = metroWithMinDistance.MetroID;
                    countVenuesUpdated++;
                }
                else
                {
                    countVenuesSkipped++;
                }
            }

            db.SaveChanges();
        }
コード例 #22
0
        private void MigrateMetro(Connections.ConnetionToSqlServer mssql, Connections.ConnectionToPostgre postre)
        {
            string select = @"SELECT [Id]
      ,[Name]
      ,[XCoor]
      ,[YCoor]
      ,[IdRegion]
  FROM [ParseBulding].[dbo].[Metro]";

            var reader = mssql.ExecuteReader(select);
            var dict   = new Dictionary <Guid, List <Metro> >();

            if (reader != null)
            {
                while (reader.Read())
                {
                    var metro = new Metro();
                    metro.Id    = reader.GetGuid(0);
                    metro.Name  = reader.GetString(1);
                    metro.XCoor = (float)reader.GetDouble(2);
                    metro.YCoor = (float)reader.GetDouble(3);
                    var guid = reader.GetGuid(4);
                    if (!dict.ContainsKey(guid))
                    {
                        dict.Add(guid, new List <Metro>());
                    }
                    dict[guid].Add(metro);
                }
                reader.Close();
            }

            foreach (var pair in dict)
            {
                foreach (var metro in pair.Value)
                {
                    string insert = "INSERT INTO public.\"Metro\"(" +
                                    "\"Id\", \"Name\", \"XCoor\", \"YCoor\", \"IdDistrict\")" +
                                    $"VALUES('{metro.Id.ToString()}', '{metro.Name}', {metro.XCoor.ToString(System.Globalization.CultureInfo.GetCultureInfo("en-US"))}, {metro.YCoor.ToString(System.Globalization.CultureInfo.GetCultureInfo("en-US"))}, '{pair.Key.ToString()}'); ";
                    postre.ExecuteNonQuery(insert);
                }
            }
        }
コード例 #23
0
        private bool VerifyPath(string path, int idx)
        {
            int result = -1;

            switch (idx)
            {
            case 0:
                result = Metro.verify(path);
                break;

            case 1:
                result = Zed.verify(path);
                break;

            case 2:
                result = Report.verify(path);
                break;

            default:
                break;
            }
            if (result == -1)
            {
                return(false);
            }
            switch (result)
            {
            case 0:
                MessageBox.Show("Insufficient data in file", "XferSuite");
                return(false);

            case 1:
            case 2:
                return(true);

            default:
                MessageBox.Show("Invalid file", "XferSuite");
                return(false);
            }
        }
コード例 #24
0
        public void TestMethod1()
        {
            Metro retour = new Metro(new FakeRequette());
            Dictionary <string, SerializeProxima> result = retour.GetLinesMetro();

            string         id    = "TEST:1111";
            string         name  = "TEST";
            double         lon   = 5.55555;
            double         lat   = 1.11111;
            string         zone  = "TEST_TEST";
            IList <string> lines = new List <string> {
                "TEST:11", "TEST:22"
            };

            //string result = target.Afficher(name);
            Assert.AreEqual(id, result[name].Id);
            Assert.AreEqual(name, result[name].Name);
            Assert.AreEqual(lon, result[name].Lon);
            Assert.AreEqual(lat, result[name].Lat);
            Assert.AreEqual(zone, result[name].Zone);
            Assert.AreEqual(lines, result[name].Lines);
        }
コード例 #25
0
        private async void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = true;
            Global.MIC1_1ImageViewer.Visibility = Visibility.Collapsed;
            Global.MIC1_2ImageViewer.Visibility = Visibility.Collapsed;
            Global.MIC1_3ImageViewer.Visibility = Visibility.Collapsed;
            Global.MIC1_4ImageViewer.Visibility = Visibility.Collapsed;
            Global.BottomImageViewer.Visibility = Visibility.Collapsed;
            Metro metro = new Metro();

            metro.ChangeAccent("Dark.Red");
            bool r = await metro.ShowConfirm("确认", "你确定关闭软件吗?");

            if (!r)
            {
                metro.ChangeAccent("Light.Blue");
                Global.MIC1_1ImageViewer.Visibility = Visibility.Visible;
            }
            else
            {
                System.Windows.Application.Current.Shutdown();
            }
        }
コード例 #26
0
ファイル: Form1.cs プロジェクト: jre08/SharpEditor
		void Button2Click(object sender, EventArgs e)
		{
			Metro NewForm = new Metro();
			NewForm.Show();
		}
コード例 #27
0
        /// <summary>
        /// GetOffice2010BackstageSilverItemColorTable
        /// </summary>
        /// <param name="ct"></param>
        /// <param name="factory"></param>
        /// <param name="metroColors"></param>
        /// <returns>Office2010BackstageSilverItemColorTable</returns>
        internal static SuperTabItemColorTable GetMetroBackstageItemColorTable(
            SuperTabItemColorTable ct, ColorFactory factory, Metro.ColorTables.MetroPartColors metroColors)
        {
            if (ct == null)
                ct = new SuperTabItemColorTable();

            // Top Default

            ct.Default.Normal.Text = factory.GetColor(metroColors.BaseTextColor);
            ct.Default.Normal.Background.AdaptiveGradient = false;
            ct.Default.Normal.CloseMarker = factory.GetColor(metroColors.BaseTextColor);

            // Top Selected

            ct.Default.Selected.Background = new SuperTabLinearGradientColorTable(factory.GetColor(metroColors.BaseColorLight1));
            ct.Default.Selected.Background.AdaptiveGradient = false;
            ct.Default.Selected.InnerBorder = Color.Empty;
            ct.Default.Selected.OuterBorder = Color.Empty;
            ct.Default.Selected.Text = factory.GetColor(metroColors.BaseTextColor);
            ct.Default.Selected.CloseMarker = factory.GetColor(metroColors.BaseTextColor);
            ct.Default.Selected.SelectionMarker = Color.Empty;

            // Top SelectedMouseOver
            ct.Default.SelectedMouseOver = new SuperTabItemStateColorTable();
            ct.Default.SelectedMouseOver.Background = new SuperTabLinearGradientColorTable(factory.GetColor(metroColors.BaseColorDark));
            ct.Default.SelectedMouseOver.Background.AdaptiveGradient = false;
            ct.Default.SelectedMouseOver.InnerBorder = Color.Empty;
            ct.Default.SelectedMouseOver.OuterBorder = Color.Empty;
            ct.Default.SelectedMouseOver.Text = factory.GetColor(metroColors.BaseTextColor);
            ct.Default.SelectedMouseOver.CloseMarker = factory.GetColor(metroColors.BaseTextColor);
            ct.Default.SelectedMouseOver.SelectionMarker = Color.Empty;
            
            // Top MouseOver

            ct.Default.MouseOver.Background = new SuperTabLinearGradientColorTable(factory.GetColor(metroColors.BaseColorDark));
            ct.Default.MouseOver.Background.AdaptiveGradient = false;
            ct.Default.MouseOver.InnerBorder = Color.Empty;
            ct.Default.MouseOver.OuterBorder = Color.Empty;
            ct.Default.MouseOver.Text = factory.GetColor(metroColors.BaseTextColor);
            ct.Default.MouseOver.CloseMarker = factory.GetColor(metroColors.BaseTextColor);

            // Top Disabled

            ct.Default.Disabled.Text = factory.GetColor(metroColors.TextDisabledColor);
            ct.Default.Disabled.Background.AdaptiveGradient = false;
            ct.Default.Disabled.CloseMarker = factory.GetColor(metroColors.TextDisabledColor);

            // Left, Bottom, Right

            ct.Left = ct.Default;
            ct.Bottom = ct.Default;
            ct.Right = ct.Right;

            return (ct);
        }
コード例 #28
0
        void scanner_PortReply(System.Net.IPEndPoint remoteEndPoint, Metro.Scanning.TcpPortState state)
        {
            try
            {
                lock(uiElementsLock) pendingRequests--;
                if(state == Metro.Scanning.TcpPortState.Opened)
                {
                    string protocol = Terminals.Connections.ConnectionManager.GetPortName(remoteEndPoint.Port, true);
                    AddFavorite(remoteEndPoint.Address.ToString(), remoteEndPoint.Address.ToString() + "_" + protocol, remoteEndPoint.Port);
                }

                this.Invoke(miv);
            }
            catch (Exception e) { Terminals.Logging.Log.Info("", e); }
        }
コード例 #29
0
ファイル: Ping.cs プロジェクト: DefStevo/defstevo-collection
 void ping_PingReply(Metro.NetworkLayer.IpV4.IpV4Packet ipHeader, Metro.TransportLayer.Icmp.IcmpPacket icmpHeader, int roundTripTime)
 {
     lock(threadLocker)
     {
         PingUpdate pu = new PingUpdate();
         pu.ipHeader = ipHeader;
         pu.icmpHeader = icmpHeader;
         pu.RoundTripTime = roundTripTime;
         pu.dateReceived = DateTime.Now;
         PingList.Add(pu);
         pingReady = true;
         this.Invoke(mivPing);
     }
 }
コード例 #30
0
ファイル: RailMarker.cs プロジェクト: mambotuna/DOTS-training
    public void OnDrawGizmos()
    {
        Gizmos.color = GUI.color = (railMarkerType != RailMarkerType.PLATFORM_START) ?  Metro.GetLine_COLOUR_FromIndex(metroLineID) : Color.white;

        // Draw marker X
        float xSize = 0.5f;

        Gizmos.DrawLine(transform.position + new Vector3(-xSize, 0f, -xSize), transform.position + new Vector3(xSize, 0f, xSize));
        Gizmos.DrawLine(transform.position + new Vector3(xSize, 0f, -xSize), transform.position + new Vector3(-xSize, 0f, xSize));

        // connect to next in line (if found)
        if (pointIndex != transform.parent.childCount - 1)
        {
            Gizmos.DrawLine(transform.position, transform.parent.GetChild(pointIndex + 1).position);
        }

        Handles.Label(transform.position + new Vector3(0f, 1f, 0f), metroLineID + "_" + pointIndex + ((railMarkerType == RailMarkerType.PLATFORM_START) ? " **" : ""));
    }
コード例 #31
0
 void scanner_PortReply(System.Net.IPEndPoint remoteEndPoint, Metro.Scanning.TcpPortState state)
 {
     Counter--;
     ScanResult r = new ScanResult();
     r.RemoteEndPoint = remoteEndPoint;
     r.State = state;
     Results.Add(r);
     this.Invoke(miv);
 }
コード例 #32
0
 public void Reset()
 {
     this._product = new Metro();
 }
コード例 #33
0
        public void GetFindUslugs(string connectionString, RequestFindUslug req)
        {
            //using  настройка запроса выбора товара
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                Shops_short_uslug = new List <Shop_short_Uslug>();

                ////////////
                // ОБРАБОТКА ДАННЫХ ПЕРЕД ИНСЕРТОМ
                ///////////

                string idUslug      = "";
                string id_City      = req.ID_City;//"6d0eb5f2-01fd-411b-9cf2-318a60b22604";// Москва
                int    intBuyCard   = 0;
                int    TimeWayMetro = req.TimeWayMetro;
                string idMetro      = "";

                if (req.ID_uslug != null)
                {
                    idUslug = req.ID_uslug;
                }


                // станции метро, если список не пустой
                if (req.metro != null && req.metro.Count > 0)
                {
                    for (int i = 0; i < req.metro.Count; i++)
                    {
                        if (i > 0)
                        {
                            idMetro += ",";
                        }
                        idMetro += "'" + req.metro[i].ID_metro + "'";
                    }
                }

                if (req.buy_card)
                {
                    intBuyCard = 1;
                }

                string whereID_Uslug = " AND usl.ID_USLUG =  '" + idUslug + "'";
                string whereID_CIty  = "AND sh.ID_City='" + id_City + "'   ";
                string whereTypeShop = " AND sh.ID_TYPE_SHOP='360eb5f2-0ffd-411b-9cf2-318a60b22604'";// тип оргназации услуги

                string whereTimeWayMetro = " AND sh.TimeWayMetro<=" + TimeWayMetro.ToString();
                string whereID_metro     = " AND met.ID_metro in (" + idMetro + ")";
                string whereBuy_card     = " AND sh.BuyCard=" + intBuyCard.ToString();

                if (idUslug == "")
                {
                    return;
                }

                // если оплаты за безнал нет, то тогда выводим все магазины, если есть то выводим только магазины с оплатой по карте
                if (intBuyCard == 0)
                {
                    whereBuy_card = "";
                }

                if (req.AllMetro)
                {
                    whereID_metro = "";
                }

                // параметр отвечает за кол-во минут ходьбы от метро до организации
                if (TimeWayMetro <= 0)
                {
                    whereTimeWayMetro = "";
                }

                if (String.IsNullOrEmpty(id_City))
                {
                    whereID_CIty = "";
                }


                #region SQL query
                //string sqlFirstShopUnion = @"   ";

                string sqlExpression = @"
                        SELECT 
                        sh.ID_shop,
                        sh.Name,
                        sh.TimeWayMetro,
                        
                        met.ID_Metro,
                        met.station,
                        met.Color_hex,
                                             
                        usl.ID_USLUG,
                        usl.NAME_USLUG,
                        usl.NOTE_USLUG,
                        usl.IMG_URL,

                        uss.Price
                        
                        FROM SPAVREMONT.SHOP sh
                         JOIN SPAVREMONT.USLUGS_SHOP uss ON sh.ID_Shop=uss.ID_Shop 
                         JOIN SPAVREMONT.USLUG usl ON uss.ID_USLUG=usl.ID_USLUG
                         LEFT JOIN SPAVREMONT.Metro met ON met.ID_Metro=sh.ID_metro
                        
                         WHERE 1=1
                              AND sh.VISIBLE=1
                             " + whereID_CIty + @"
                             " + whereID_Uslug + @"   
                             " + whereTypeShop + @"   
                             " + whereTimeWayMetro + @"   
                             " + whereID_metro + @"   
                             " + whereBuy_card + @"      

                            GROUP BY 
                        sh.ID_shop,
                        sh.Name,
                        sh.TimeWayMetro,
                        
                        met.ID_Metro,
                        met.station,
                        met.Color_hex,
                                        
                        usl.ID_USLUG,
                        usl.NAME_USLUG,
                        usl.NOTE_USLUG,
                        usl.IMG_URL,

                        uss.Price
        
                    ";

                #endregion

                connection.Open();
                SqlCommand command = new SqlCommand();
                command.CommandText = sqlExpression;
                command.Connection  = connection;
                SqlDataReader reader = command.ExecuteReader();


                if (reader.HasRows) // если есть данные
                {
                    int sID_shopIndex      = reader.GetOrdinal("ID_shop");
                    int sNameIndex         = reader.GetOrdinal("Name");
                    int sTimeWayMetroIndex = reader.GetOrdinal("TimeWayMetro");
                    int mID_MetroIndex     = reader.GetOrdinal("ID_Metro");
                    int mstationIndex      = reader.GetOrdinal("station");
                    int mColor_hexIndex    = reader.GetOrdinal("Color_hex");

                    int itmID_uslug_index   = reader.GetOrdinal("ID_USLUG");
                    int itmNAME_uslug_index = reader.GetOrdinal("NAME_USLUG");
                    int itmNOTE_uslug_index = reader.GetOrdinal("NOTE_USLUG");
                    int itmIMG_URL_index    = reader.GetOrdinal("IMG_URL");

                    int PRICE_Index = reader.GetOrdinal("Price");

                    while (reader.Read()) // построчно считываем данные
                    {
                        Metro metro = new Metro
                        {
                            ID_metro  = reader.IsDBNull(mID_MetroIndex)? "": reader.GetString(mID_MetroIndex),
                            Station   = reader.IsDBNull(mstationIndex) ? "" : reader.GetString(mstationIndex),
                            Color_Hex = reader.IsDBNull(mColor_hexIndex) ? "" : reader.GetString(mColor_hexIndex)
                        };


                        USLUG item_uslug = new USLUG
                        {
                            ID_USLUG   = reader.GetString(itmID_uslug_index),
                            IMG_URL    = reader.GetString(itmIMG_URL_index),
                            NAME_USLUG = reader.GetString(itmNAME_uslug_index),
                            NOTE_USLUG = reader.GetString(itmNOTE_uslug_index)
                        };

                        Shop_short_Uslug item = new Shop_short_Uslug
                        {
                            ID_shop      = reader.GetString(sID_shopIndex),
                            Name         = reader.GetString(sNameIndex),
                            Metro        = metro,
                            TimeWayMetro = reader.GetInt32(sTimeWayMetroIndex),


                            Uslug = item_uslug,
                            Price = reader.GetInt32(PRICE_Index),
                        };


                        Shops_short_uslug.Add(item);
                    }
                }
            }//return shops;
        }