Пример #1
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();

             }
        }
Пример #2
0
        //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;
        }