コード例 #1
0
        //public IList<String> GetCities()
        //{
        //  List<String> citiesList = new List<String>();
        //  using (var context = new CinemaEntities())
        //  {
        //    var cities = (from city in context.Addresses
        //                  where city.ObjectType.Description == "Theater"
        //                  select city).ToList();
        //    if (cities.Count > 0)
        //    {
        //      foreach (var city in cities)
        //      {
        //        AddressModelDTO cityRow = new AddressModelDTO();
        //        cityRow.City = city.City;



        //        citiesList.Add(cityRow);
        //      }
        //    }


        //    return citiesList;
        //  }
        //}



        public IList <AddressModelDTO> GetCities()
        {
            IList <AddressModelDTO> citiesList = new List <AddressModelDTO>();

            using (var context = new CinemaEntities())
            {
                var cities = (from city in context.Addresses
                              where city.ObjectType.Description == "Theater"
                              select city).ToList();
                if (cities.Count > 0)
                {
                    foreach (var city in cities)
                    {
                        var cityRow = new AddressModelDTO();
                        cityRow.City = city.City;
                        citiesList.Add(cityRow);
                        List <AddressModelDTO> newCitiesList = new List <AddressModelDTO>();

                        foreach (var item in citiesList)
                        {
                            if (!newCitiesList.Contains(item))
                            {
                                newCitiesList.Add(item);
                            }
                        }


                        //if (citiesList != null)
                        //{
                        //  foreach (var cit in citiesList)
                        //  {
                        //    if (cit.City != cityRow.City)
                        //    { citiesList.Add(cityRow); }

                        //  //if (cityRow.City != city.City)
                        //  //{
                        //  //  citiesList.Add(cityRow);
                        //  //}
                        //    else
                        //    {
                        //      return citiesList;
                        //    }
                    }
                }
            }
            return(citiesList);
        }
コード例 #2
0
        //	[Guid("4531D5B6-268C-4AB3-81EB-57D0845E21DF")]

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (this.LoadData != null)
                {
                    var ex = new EventArgs();
                    LoadData(ex);
                }

                Label1.Text = "it works, yeah!!!!";


                string theat     = Session["TheaterID"].ToString();
                Guid   theaterId = new Guid();
                theaterId = Guid.Parse(theat);



                TheaterServices showTheater    = new TheaterServices();
                TheaterModelDTO currentTheater = new TheaterModelDTO();
                currentTheater = showTheater.GetTheater(theaterId);

                lblName.Text = currentTheater.Name;


                AddressServices showAddress    = new AddressServices();
                AddressModelDTO currentAddress = new AddressModelDTO();

                currentAddress = showAddress.GetAddress(theaterId);

                lblAddressLine1.Text = currentAddress.AddressLine1;
                lblCity.Text         = currentAddress.City;
                lblCountry.Text      = currentAddress.Country;
                lblEmail.Text        = currentAddress.Email;
                lblPhone.Text        = currentAddress.Phone;
                lblPostalCode.Text   = currentAddress.PostalCode;
                lblProvince.Text     = currentAddress.Province;

                PerformanceServices showAllPerformances = new PerformanceServices();

                GridViewPerformance.DataSource = showAllPerformances.GetPerformances(theaterId);
                GridViewPerformance.DataBind();
            }
        }
コード例 #3
0
        //public IList<String> GetCities()
        //{
        //  List<String> citiesList = new List<String>();
        //  using (var context = new CinemaEntities())
        //  {
        //    var cities = (from city in context.Addresses
        //                  where city.ObjectType.Description == "Theater"
        //                  select city).ToList();
        //    if (cities.Count > 0)
        //    {
        //      foreach (var city in cities)
        //      {
        //        AddressModelDTO cityRow = new AddressModelDTO();
        //        cityRow.City = city.City;
        //        citiesList.Add(cityRow);
        //      }
        //    }
        //    return citiesList;
        //  }
        //}
        public IList<AddressModelDTO> GetCities()
        {
            IList<AddressModelDTO> citiesList = new List<AddressModelDTO>();
            using (var context = new CinemaEntities())
            {
                var cities = (from city in context.Addresses
                                            where city.ObjectType.Description == "Theater"
                                            select city).ToList();
                if (cities.Count > 0)
                {
                    foreach (var city in cities)
                    {
                        var cityRow = new AddressModelDTO();
                        cityRow.City = city.City;
                        citiesList.Add(cityRow);
                        List<AddressModelDTO> newCitiesList = new List<AddressModelDTO>();

                        foreach (var item in citiesList)
                        {
                            if (!newCitiesList.Contains(item))
                            { newCitiesList.Add(item);}

                        }

                        //if (citiesList != null)
                        //{
                        //  foreach (var cit in citiesList)
                        //  {
                        //    if (cit.City != cityRow.City)
                        //    { citiesList.Add(cityRow); }

                        //  //if (cityRow.City != city.City)
                        //  //{
                        //  //  citiesList.Add(cityRow);
                        //  //}
                        //    else
                        //    {
                        //      return citiesList;
                        //    }
                    }
                }
            }
            return citiesList;
        }
コード例 #4
0
        //    [Guid("4531D5B6-268C-4AB3-81EB-57D0845E21DF")]
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
             {
             if (this.LoadData != null)
             {
                 var ex = new EventArgs();
                 LoadData(ex);
             }

             Label1.Text = "it works, yeah!!!!";

             string theat = Session["TheaterID"].ToString();
             Guid theaterId = new Guid();
                theaterId= Guid.Parse(theat);

             TheaterServices showTheater=new TheaterServices();
             TheaterModelDTO currentTheater = new TheaterModelDTO();
             currentTheater = showTheater.GetTheater(theaterId);

             lblName.Text = currentTheater.Name;

             AddressServices showAddress = new AddressServices();
             AddressModelDTO currentAddress = new AddressModelDTO();

             currentAddress=showAddress.GetAddress(theaterId);

             lblAddressLine1.Text = currentAddress.AddressLine1;
             lblCity.Text = currentAddress.City;
             lblCountry.Text = currentAddress.Country;
             lblEmail.Text = currentAddress.Email;
             lblPhone.Text = currentAddress.Phone;
             lblPostalCode.Text = currentAddress.PostalCode;
             lblProvince.Text = currentAddress.Province;

             PerformanceServices showAllPerformances=new PerformanceServices();

             GridViewPerformance.DataSource = showAllPerformances.GetPerformances(theaterId);
             GridViewPerformance.DataBind();

             }
        }
コード例 #5
0
ファイル: TheaterPresenter.cs プロジェクト: ometz2012/Cinema
        //Method that extracts all data to populate the Labels and the table Performance
        private void LoadData(Guid theaterId)
        {
            //Data extraction from database

            IPerformance performanceServices = new PerformanceServices();
            IList <PerformanceModelDTO> ListOfPerformances = performanceServices.GetPerformances(theaterId);

            ITheater showTheater    = new TheaterServices();
            String   currentTheater = showTheater.GetTheater(theaterId);

            IAddress        showAddress    = new AddressServices();
            AddressModelDTO currentAddress = showAddress.GetAddress(theaterId);



            //Data transfer to Theater Model
            Myview.Model.ListOfPerformances = new List <PerformanceLine>();

            foreach (var item in ListOfPerformances)
            {
                PerformanceLine row = new PerformanceLine();
                row.PerformanceID = item.PerformanceID.ToString();
                row.Title         = item.Title;
                row.Date          = item.Date;
                row.StartingTime  = item.StartingTime;
                row.RoomNumber    = item.RoomNumber.ToString();
                row.Duration      = item.Duration;
                row.Price         = item.Price.ToString();
                Myview.Model.ListOfPerformances.Add(row);
            }

            Myview.Model.TheaterName  = currentTheater;
            Myview.Model.AddressLine1 = currentAddress.AddressLine1;
            Myview.Model.City         = currentAddress.City;
            Myview.Model.Country      = currentAddress.Country;
            Myview.Model.Province     = currentAddress.Province;
            Myview.Model.PostalCode   = currentAddress.PostalCode;
            Myview.Model.Phone        = currentAddress.Phone;
            Myview.Model.Email        = currentAddress.Email;
        }
コード例 #6
0
        public AddressModelDTO GetAddress(Guid objectId)
        {
            Address spesificAddress = new Address();

            using (var context = new CinemaEntities())
            {
                spesificAddress = (from address in context.Addresses
                                                     where address.ObjectID == objectId
                                                     select address).FirstOrDefault();
            }

            AddressModelDTO addressToReturn = new AddressModelDTO();
            addressToReturn.AddressID = spesificAddress.AddressID;
            addressToReturn.AddressLine1 = spesificAddress.AddressLine1;
            addressToReturn.City = spesificAddress.City;
            addressToReturn.PostalCode = spesificAddress.PostalCode;
            addressToReturn.Province = spesificAddress.Province;
            addressToReturn.Country = spesificAddress.Country;
            addressToReturn.Phone = spesificAddress.Phone;
            addressToReturn.Email = spesificAddress.Email;

            return addressToReturn;
        }
コード例 #7
0
        public AddressModelDTO GetAddress(Guid objectId)
        {
            Address spesificAddress = new Address();

            using (var context = new CinemaEntities())
            {
                spesificAddress = (from address in context.Addresses
                                   where address.ObjectID == objectId
                                   select address).FirstOrDefault();
            }

            AddressModelDTO addressToReturn = new AddressModelDTO();

            addressToReturn.AddressID    = spesificAddress.AddressID;
            addressToReturn.AddressLine1 = spesificAddress.AddressLine1;
            addressToReturn.City         = spesificAddress.City;
            addressToReturn.PostalCode   = spesificAddress.PostalCode;
            addressToReturn.Province     = spesificAddress.Province;
            addressToReturn.Country      = spesificAddress.Country;
            addressToReturn.Phone        = spesificAddress.Phone;
            addressToReturn.Email        = spesificAddress.Email;

            return(addressToReturn);
        }