Exemplo n.º 1
0
        //Method that process Movie selection - the movie was selected by pressing the button
        private void MovieWasSelected(SelectedParamterArgs esp)
        {
            int  movieID    = 0;
            bool checkIfInt = int.TryParse(esp.SelectedValue.ToString(), out movieID);

            if (checkIfInt)
            {
                IUser          UserServices = new UserServices();
                IList <String> ListOfCities = new List <String>();
                ListOfCities = UserServices.GetCitiesByMovieID(movieID);
                List <String> ListOfCitiesRevised = new List <String>();
                TicketView.Model.CityList = new List <CityLine>();
                //Running loop in order to remove repeation of cities in the list
                foreach (var item in ListOfCities)
                {
                    if (!ListOfCitiesRevised.Contains(item))
                    {
                        ListOfCitiesRevised.Add(item);
                    }
                }

                TicketView.Model.CityList = new List <CityLine>();
                //Adding first value to CityList that will be dispalyed
                CityLine row1 = new CityLine();
                row1.CityID   = "None";
                row1.CityName = "Select city...";
                TicketView.Model.CityList.Add(row1);
                //Loop to transfer data from City Revised to List that will be displayed= List<CityLine>
                foreach (var item in ListOfCitiesRevised)
                {
                    CityLine row = new CityLine();
                    row.CityID   = item;
                    row.CityName = item;
                    TicketView.Model.CityList.Add(row);
                }
            }
        }
Exemplo n.º 2
0
        //Method that process Movie selection - the movie was selected by pressing the button
        private void MovieWasSelected(SelectedParamterArgs esp)
        {
            int movieID = 0;
            bool checkIfInt = int.TryParse(esp.SelectedValue.ToString(), out movieID);
            if (checkIfInt)
            {
                IUser UserServices = new UserServices();
                IList<String> ListOfCities = new List<String>();
                ListOfCities = UserServices.GetCitiesByMovieID(movieID);
                List<String> ListOfCitiesRevised = new List<String>();
                TicketView.Model.CityList = new List<CityLine>();
                //Running loop in order to remove repeation of cities in the list
                foreach (var item in ListOfCities)
                {
                    if(!ListOfCitiesRevised.Contains(item))
                    {
                        ListOfCitiesRevised.Add(item);
                    }
                }

                TicketView.Model.CityList = new List<CityLine>();
                //Adding first value to CityList that will be dispalyed
                CityLine row1 = new CityLine();
                row1.CityID = "None";
                row1.CityName = "Select city...";
                TicketView.Model.CityList.Add(row1);
                //Loop to transfer data from City Revised to List that will be displayed= List<CityLine>
                foreach (var item in ListOfCitiesRevised)
                {
                    CityLine row = new CityLine();
                    row.CityID = item;
                    row.CityName = item;
                    TicketView.Model.CityList.Add(row);
                }

            }
        }