Ejemplo n.º 1
0
        protected void ddlCountriesVOD_SelectedIndexChanged(object sender, EventArgs e)
        {
            CheckBoxList ddlCountriesVOD = (CheckBoxList)MovieDetailsView.FindControl("ddlCountriesVOD");
            TextBox      txtBoxVODRights = (TextBox)MovieDetailsView.FindControl("txtBoxVODRights");

            txtBoxVODRights.Text = "";

            // for counting selected items
            int i = 0;

            foreach (ListItem item in (sender as ListControl).Items)
            {
                if (item.Selected)
                {
                    i++;
                    txtBoxVODRights.Text += item.Text + ", ";
                }
            }

            // "i" indicates if any item is selected, without "if" statement exception is thrown on button OK click when no item is selected
            if (i > 0)
            {
                // get the index of last occurence of coma "," in a txtBoxIPTVRights string
                int indexLastComa = txtBoxVODRights.Text.LastIndexOf(",");
                // Remove last coma "," in a txtBoxIPTVRights string
                string newtextIPTV = txtBoxVODRights.Text.ToString().Remove(indexLastComa);
                txtBoxVODRights.Text = newtextIPTV;
            }
        }
Ejemplo n.º 2
0
        protected void ddlSVODRights_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList ddl2 = (DropDownList)MovieDetailsView.FindControl("ddlSVODRights");
            TextBox      SVODRightsTextBox = (TextBox)MovieDetailsView.FindControl("txtBoxSVODRights");

            SVODRightsTextBox.Text = ddl2.SelectedItem.Text.ToString();
        }
Ejemplo n.º 3
0
        protected void ddlAncillaryRights_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList ddl = (DropDownList)MovieDetailsView.FindControl("ddlAncillaryRights");
            TextBox      ancRightsTextBox = (TextBox)MovieDetailsView.FindControl("txtBoxAncillaryRights");

            ancRightsTextBox.Text = ddl.SelectedItem.Text.ToString();
        }
Ejemplo n.º 4
0
        protected void DropDownListProductionYear_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList DropDownListProdYear  = (DropDownList)MovieDetailsView.FindControl("DropDownListProductionYear");
            TextBox      productionYearTextBox = (TextBox)MovieDetailsView.FindControl("productionYearTextBox");

            string movieProductionYear = DropDownListProdYear.SelectedValue;

            productionYearTextBox.Text = movieProductionYear;
        }
Ejemplo n.º 5
0
        private void LoadProductionYears()
        {
            DropDownList DropDownListProdYear = (DropDownList)MovieDetailsView.FindControl("DropDownListProductionYear");

            for (int intYear = 1900; intYear <= DateTime.Now.Year; intYear++)
            {
                DropDownListProdYear.Items.Add(intYear.ToString());
            }

            //Make the current year selected item in the list
            DropDownListProdYear.Items.FindByValue(DateTime.Now.Year.ToString()).Selected = true;
        }
Ejemplo n.º 6
0
        public MainViewModel()
        {
            try
            {
                CurrentDate = DateTime.Today.ToShortDateString();
                IsMovieDetailsButtonChecked = false;
                MovieDetailsVisibility      = "Hidden";
                HomeVM = new HomeViewModel()
                {
                    Model = this
                };
                DiscoveryVM = new DiscoveryViewModel()
                {
                    Model = this
                };
                MovieDetailsVM = new MovieDetailsViewModel()
                {
                    Model = this
                };

                discoveryView = new DiscoveryView()
                {
                    DataContext = DiscoveryVM
                };
                homeView = new HomeView()
                {
                    DataContext = HomeVM
                };
                movieDetailsView = new MovieDetailsView()
                {
                    DataContext = tmdb.ExampleMovieDetails()
                };
                CurrentView = HomeVM;
            }
            catch
            {
                CustomMessageBox.Show(AllResources.InternetConnectionError, MessageBoxButton.OK);
            }
            HomeViewCommand = new RelayCommand(o =>
            {
                CurrentView            = homeView;
                MovieDetailsVisibility = "Hidden";
            });
            DiscoveryViewCommand = new RelayCommand(o =>
            {
                CurrentView            = discoveryView;
                MovieDetailsVisibility = "Hidden";
            });
            MovieDetailsViewCommand = new RelayCommand(o =>
            {
                CurrentView = movieDetailsView;
            });
        }
Ejemplo n.º 7
0
        protected void DurationChange(object sender, EventArgs e)
        {
            DropDownList ddlHours   = (DropDownList)MovieDetailsView.FindControl("ddlHours");
            DropDownList ddlMinutes = (DropDownList)MovieDetailsView.FindControl("ddlMinutes");
            DropDownList ddlSeconds = (DropDownList)MovieDetailsView.FindControl("ddlSeconds");

            string hours   = ddlHours.SelectedValue.ToString();
            string minutes = ddlMinutes.SelectedValue.ToString();
            string seconds = ddlSeconds.SelectedValue.ToString();

            TextBox durationTextBox = (TextBox)MovieDetailsView.FindControl("txtBoxDuration");

            durationTextBox.Text = hours + ":" + minutes + ":" + seconds;
        }
Ejemplo n.º 8
0
        protected void DropDownListExpireMonth_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList DropDownListExpYear  = (DropDownList)MovieDetailsView.FindControl("DropDownListExpireYear");
            DropDownList DropDownListExpMonth = (DropDownList)MovieDetailsView.FindControl("DropDownListExpireMonth");

            int year  = Convert.ToInt16(DropDownListExpYear.SelectedValue);
            int month = Convert.ToInt16(DropDownListExpMonth.SelectedValue);

            System.Web.UI.WebControls.Calendar expDateCalendar = (System.Web.UI.WebControls.Calendar)MovieDetailsView.FindControl("expireDateCalendar");
            expDateCalendar.VisibleDate  = new DateTime(year, month, 1);
            expDateCalendar.SelectedDate = new DateTime(year, month, 1);

            expireDateCalendar_SelectionChanged(sender, e);
        }
Ejemplo n.º 9
0
        protected void DropDownListYear_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList DropDownListYear  = (DropDownList)MovieDetailsView.FindControl("DropDownListYear");
            DropDownList DropDownListMonth = (DropDownList)MovieDetailsView.FindControl("DropDownListMonth");

            int year  = Convert.ToInt16(DropDownListYear.SelectedValue);
            int month = Convert.ToInt16(DropDownListMonth.SelectedValue);

            System.Web.UI.WebControls.Calendar startDateCalendar = (System.Web.UI.WebControls.Calendar)MovieDetailsView.FindControl("startDateCalendar");
            startDateCalendar.VisibleDate  = new DateTime(year, month, 1);
            startDateCalendar.SelectedDate = new DateTime(year, month, 1);

            // show selected Year in TextBox - startDateTextBox
            startDateCalendar_SelectionChanged(sender, e);
        }
Ejemplo n.º 10
0
        protected void startDateCalendar_SelectionChanged(object sender, EventArgs e)
        {
            System.Web.UI.WebControls.Calendar calendar = (System.Web.UI.WebControls.Calendar)MovieDetailsView.FindControl("startDateCalendar");
            TextBox startDateTextBox = (TextBox)MovieDetailsView.FindControl("startDateTextBox");

            startDateTextBox.Text = calendar.SelectedDate.ToShortDateString();
            calendar.Visible      = false;

            // get Year and Month on Calendar selectionChanged and change it in DropDownLists (Year and Month ddl's)
            string year1  = calendar.SelectedDate.Year.ToString();
            string month1 = calendar.SelectedDate.Month.ToString();

            DropDownList DropDownListYear  = (DropDownList)MovieDetailsView.FindControl("DropDownListYear");
            DropDownList DropDownListMonth = (DropDownList)MovieDetailsView.FindControl("DropDownListMonth");

            DropDownListYear.Text  = year1;
            DropDownListMonth.Text = month1;
        }
Ejemplo n.º 11
0
        private void LoadMonths()
        {
            DataSet dsMonths = new DataSet();

            dsMonths.ReadXml(Server.MapPath("~/Data/Months.xml"));

            DropDownList DropDownListMonth    = (DropDownList)MovieDetailsView.FindControl("DropDownListMonth");
            DropDownList DropDownListExpMonth = (DropDownList)MovieDetailsView.FindControl("DropDownListExpireMonth");

            DropDownListMonth.DataTextField     = "Name";
            DropDownListMonth.DataValueField    = "Number";
            DropDownListExpMonth.DataTextField  = "Name";
            DropDownListExpMonth.DataValueField = "Number";

            DropDownListMonth.DataSource    = dsMonths;
            DropDownListExpMonth.DataSource = dsMonths;
            DropDownListMonth.DataBind();
            DropDownListExpMonth.DataBind();
        }
Ejemplo n.º 12
0
        protected void expireDateCalendar_SelectionChanged(object sender, EventArgs e)
        {
            System.Web.UI.WebControls.Calendar calendar = (System.Web.UI.WebControls.Calendar)MovieDetailsView.FindControl("expireDateCalendar");
            TextBox expireDateTextBox = (TextBox)MovieDetailsView.FindControl("expireDateTextBox");

            expireDateTextBox.Text = calendar.SelectedDate.ToShortDateString();
            calendar.Visible       = false;

            // get Year and Month on Calendar selectionChanged and change it in DropDownLists (Year and Month ddl's)
            string year2  = calendar.SelectedDate.Year.ToString();
            string month2 = calendar.SelectedDate.Month.ToString();

            DropDownList DropDownListExpYear  = (DropDownList)MovieDetailsView.FindControl("DropDownListExpireYear");
            DropDownList DropDownListExpMonth = (DropDownList)MovieDetailsView.FindControl("DropDownListExpireMonth");

            //string year = DropDownListYear.Items.FindByValue(year2).ToString();
            DropDownListExpYear.Text  = year2;
            DropDownListExpMonth.Text = month2;
        }
Ejemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // for Calendar control -- Year & Month DropDownLists
                LoadYears();
                LoadMonths();
                // for movie production (make) year
                LoadProductionYears();

                // find DropDownList control inside DetailsView
                DropDownList ddlHours   = (DropDownList)MovieDetailsView.FindControl("ddlHours");
                DropDownList ddlMinutes = (DropDownList)MovieDetailsView.FindControl("ddlMinutes");
                DropDownList ddlSeconds = (DropDownList)MovieDetailsView.FindControl("ddlSeconds");
                // Time DropDownList
                for (int index = 0; index < 24; index++)
                {
                    ddlHours.Items.Add(index.ToString("00"));
                }
                for (int index = 0; index < 60; index++)
                {
                    ddlMinutes.Items.Add(index.ToString("00"));
                    ddlSeconds.Items.Add(index.ToString("00"));
                }


                CheckBoxList ddlCountry = (CheckBoxList)MovieDetailsView.FindControl("ddlCountry");
                ddlCountry.DataSource = CountriesList();
                ddlCountry.DataBind();

                CheckBoxList ddlCountriesIPTV = (CheckBoxList)MovieDetailsView.FindControl("ddlCountriesIPTV");
                ddlCountriesIPTV.DataSource = CountriesList();
                ddlCountriesIPTV.DataBind();

                CheckBoxList ddlCountriesVOD = (CheckBoxList)MovieDetailsView.FindControl("ddlCountriesVOD");
                ddlCountriesVOD.DataSource = CountriesList();
                ddlCountriesVOD.DataBind();
            }
        }
Ejemplo n.º 14
0
        protected void MovieDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            try
            {
                MovieCatalogBL contextBL = new MovieCatalogBL();

                string contentProvider = null;
                if (e.Values["ContentProvider"] == null || e.Values["ContentProvider"].ToString() == "")
                {
                    contentProvider = "";
                }
                else
                {
                    contentProvider = e.Values["ContentProvider"].ToString();
                }

                string title = e.Values["OriginalName"].ToString();
                string genre = e.Values["Genre"].ToString();

                //msdn.microsoft.com/en-us/library/system.timespan%28v=vs.110%29.aspx
                //string value = "12:12:15";
                //TimeSpan ts = TimeSpan.Parse(value);
                TimeSpan movieDuration = TimeSpan.Zero;

                // find DropDownList control inside DetailsView
                DropDownList ddlHours   = (DropDownList)MovieDetailsView.FindControl("ddlHours");
                DropDownList ddlMinutes = (DropDownList)MovieDetailsView.FindControl("ddlMinutes");
                DropDownList ddlSeconds = (DropDownList)MovieDetailsView.FindControl("ddlSeconds");

                string hours   = ddlHours.SelectedValue.ToString().Trim();
                string minutes = ddlMinutes.SelectedValue.ToString().Trim();
                string seconds = ddlSeconds.SelectedValue.ToString().Trim();

                //string value = "12:12:15";
                //TimeSpan ts = TimeSpan.Parse(value);
                string duration1 = hours + ":" + minutes + ":" + seconds;
                movieDuration = TimeSpan.Parse(duration1);


                string country = e.Values["Country"].ToString();

                string rightsIPTV = null;
                if (e.Values["RightsIPTV"] == null || e.Values["RightsIPTV"].ToString() == "")
                {
                    rightsIPTV = string.Empty;
                }
                else
                {
                    rightsIPTV = e.Values["RightsIPTV"].ToString();
                }

                string rightsVOD = null;
                if (e.Values["RightsVOD"] == null || e.Values["RightsVOD"].ToString() == "")
                {
                    rightsVOD = string.Empty;
                }
                else
                {
                    rightsVOD = e.Values["RightsVOD"].ToString();
                }

                string svodRights = null;
                if (e.Values["SVODRights"] == null || e.Values["SVODRights"].ToString() == "")
                {
                    svodRights = string.Empty;
                }
                else
                {
                    svodRights = e.Values["SVODRights"].ToString();
                }

                string ancillaryRights = null;
                if (e.Values["AncillaryRights"] == null || e.Values["AncillaryRights"].ToString() == "")
                {
                    ancillaryRights = string.Empty;
                }
                else
                {
                    ancillaryRights = e.Values["AncillaryRights"].ToString();
                }


                DateTime startDate    = Convert.ToDateTime(e.Values["StartDate"]);
                DateTime expireDate   = Convert.ToDateTime(e.Values["ExpireDate"]);
                int      result       = DateTime.Compare(startDate, expireDate);
                string   relationship = "Expiry Date is earlier than Start Date !";
                //msdn.microsoft.com/en-us/library/5ata5aya%28v=vs.110%29.aspx
                // if startDate is later than expireDate result is (1) greater than 0 (zero)
                if (result > 0)
                {
                    e.Cancel = true;
                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + relationship + "');", true);
                    return;
                }


                string comment = null;
                if (e.Values["Comment"] == null || e.Values["Comment"].ToString() == "")
                {
                    comment = string.Empty;
                }
                else
                {
                    comment = e.Values["Comment"].ToString();
                }

                Int16 year = Convert.ToInt16(e.Values["Year"]);

                contextBL.InsertMovie(contentProvider, title, genre, movieDuration, country, rightsIPTV, rightsVOD, svodRights, ancillaryRights, startDate, expireDate, comment, year);
                lblMessage.ForeColor = System.Drawing.Color.Black;
                lblMessage.Text      = "Movie " + title + " added.";
            }

            catch (InvalidOperationException)
            {
                lblMessage.ForeColor = System.Drawing.Color.Red;
                lblMessage.Text      = "Error while adding new movie. Invalid data provided. Please try again.";
            }
            catch (Exception)
            {
                lblMessage.ForeColor = System.Drawing.Color.Red;
                lblMessage.Text      = "Error while adding new movie. Please try again.";
            }
        }
Ejemplo n.º 15
0
        protected void MovieDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            try
            {
                MovieCatalogBL contextBL     = new MovieCatalogBL();
                var            movieToUpdate = contextBL.GetMovieByID(movieID);

                string contentProvider = null;
                if (e.NewValues["ContentProvider"] == null || e.NewValues["ContentProvider"].ToString() == "")
                {
                    contentProvider = "";
                }
                else
                {
                    contentProvider = e.NewValues["ContentProvider"].ToString();
                }

                string title = e.NewValues["OriginalName"].ToString();
                string genre = e.NewValues["Genre"].ToString();

                //msdn.microsoft.com/en-us/library/system.timespan%28v=vs.110%29.aspx
                //string value = "12:12:15";
                //TimeSpan ts = TimeSpan.Parse(value);
                TimeSpan movieDuration = TimeSpan.Zero;

                // find DropDownList control inside DetailsView
                DropDownList ddlHours   = (DropDownList)MovieDetailsView.FindControl("ddlHours");
                DropDownList ddlMinutes = (DropDownList)MovieDetailsView.FindControl("ddlMinutes");
                DropDownList ddlSeconds = (DropDownList)MovieDetailsView.FindControl("ddlSeconds");

                string hours   = ddlHours.SelectedValue.ToString().Trim();
                string minutes = ddlMinutes.SelectedValue.ToString().Trim();
                string seconds = ddlSeconds.SelectedValue.ToString().Trim();

                //string value = "12:12:15";
                //TimeSpan ts = TimeSpan.Parse(value);
                string duration1 = hours + ":" + minutes + ":" + seconds;
                movieDuration = TimeSpan.Parse(duration1);


                string country = e.NewValues["Country"].ToString();

                string rightsIPTV = null;
                if (e.NewValues["RightsIPTV"] == null || e.NewValues["RightsIPTV"].ToString() == "")
                {
                    rightsIPTV = string.Empty;
                }
                else
                {
                    rightsIPTV = e.NewValues["RightsIPTV"].ToString();
                }

                string rightsVOD = null;
                if (e.NewValues["RightsVOD"] == null || e.NewValues["RightsVOD"].ToString() == "")
                {
                    rightsVOD = string.Empty;
                }
                else
                {
                    rightsVOD = e.NewValues["RightsVOD"].ToString();
                }

                string svodRights = null;
                if (e.NewValues["SVODRights"] == null || e.NewValues["SVODRights"].ToString() == "")
                {
                    svodRights = string.Empty;
                }
                else
                {
                    svodRights = e.NewValues["SVODRights"].ToString();
                }

                string ancillaryRights = null;
                if (e.NewValues["AncillaryRights"] == null || e.NewValues["AncillaryRights"].ToString() == "")
                {
                    ancillaryRights = string.Empty;
                }
                else
                {
                    ancillaryRights = e.NewValues["AncillaryRights"].ToString();
                }


                DateTime startDate    = Convert.ToDateTime(e.NewValues["StartDate"]);
                DateTime expireDate   = Convert.ToDateTime(e.NewValues["ExpireDate"]);
                int      result       = DateTime.Compare(startDate, expireDate);
                string   relationship = "Expiry Date is earlier than Start Date !";
                //msdn.microsoft.com/en-us/library/5ata5aya%28v=vs.110%29.aspx
                // if startDate is later than expireDate result is (1) greater than 0 (zero)
                if (result > 0)
                {
                    // instead of "e.Cancel = true;" can be -> ((DetailsViewInsertEventArgs)e).Cancel = true;
                    // www.noordam.it/validating-detailsview-field-NewValues-during-insert-and-update/
                    // has to be 'return' after 'e.Cancel = true;'  -> at least in some cases
                    e.Cancel = true;
                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + relationship + "');", true);
                    return;
                }


                string comment = null;
                if (e.NewValues["Comment"] == null || e.NewValues["Comment"].ToString() == "")
                {
                    comment = string.Empty;
                }
                else
                {
                    comment = e.NewValues["Comment"].ToString();
                }

                Int16 year = Convert.ToInt16(e.NewValues["Year"]);

                contextBL.UpdateMovieByID(movieID, contentProvider, title, genre, movieDuration, country, rightsIPTV, rightsVOD, svodRights, ancillaryRights, startDate, expireDate, comment, year);
                lblMessage.ForeColor = System.Drawing.Color.Black;
                lblMessage.Text      = "Movie " + title + " updated.";
            }
            catch (DbUpdateException)
            {
                lblMessage.Text = "Update Exception. Error while updating movie data. Please try again.";
            }
            catch (NullReferenceException)
            {
                lblMessage.Text = "An error occurred while updating movie. Make sure that movie exists.";
            }
            catch (ArgumentNullException)
            {
                lblMessage.Text = "ArgumentNullException: An error occurred while updating movie. Make sure that movie exists.";
            }
            catch (Exception)
            {
                lblMessage.Text = "An error occurred while updating movie. Please try again.";
            }
        }
Ejemplo n.º 16
0
 protected void Page_Init(object sender, EventArgs e)
 {
     MovieDetailsView.EnableDynamicData(typeof(Movie));
 }
Ejemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // check QueryString not null OR empty - if null OR empty redirect to Previous page
            if (Request.QueryString["Id"] == null || Request.QueryString["Id"] == "")
            {
                Response.Redirect("Default.aspx");
            }

            movieID = Convert.ToInt32(Request.QueryString["Id"]);

            if (!IsPostBack)
            {
                MovieCatalogBL contextBL = new MovieCatalogBL();

                try
                {
                    var queryMovieByID2 = contextBL.GetMovieByID(movieID);
                    // needs to be List
                    MovieDetailsView.DataSource = queryMovieByID2.ToList();
                    MovieDetailsView.DataBind();

                    // find DropDownList control inside DetailsView
                    DropDownList ddlHours   = (DropDownList)MovieDetailsView.FindControl("ddlHours");
                    DropDownList ddlMinutes = (DropDownList)MovieDetailsView.FindControl("ddlMinutes");
                    DropDownList ddlSeconds = (DropDownList)MovieDetailsView.FindControl("ddlSeconds");
                    // Time DropDownList
                    for (int index = 0; index < 24; index++)
                    {
                        ddlHours.Items.Add(index.ToString("00"));
                    }
                    for (int index = 0; index < 60; index++)
                    {
                        ddlMinutes.Items.Add(index.ToString("00"));
                        ddlSeconds.Items.Add(index.ToString("00"));
                    }

                    // for Calendar control -- Year & Month DropDownLists
                    LoadYears();
                    LoadMonths();

                    // for movie production (make) year
                    LoadProductionYears();
                    DropDownList ddlProductionYear = (DropDownList)MovieDetailsView.FindControl("DropDownListProductionYear");
                    // set year in DropDownListProductionYear
                    ddlProductionYear.Text = queryMovieByID2.FirstOrDefault().Year.ToString();

                    // get Duration of movie
                    TimeSpan duration = queryMovieByID2.FirstOrDefault().Duration.Value;
                    // set the text of ddl's for hours, minutes and seconds
                    ddlHours.Text   = duration.Hours.ToString("00");
                    ddlMinutes.Text = duration.Minutes.ToString("00");
                    ddlSeconds.Text = duration.Seconds.ToString("00");

                    // Fill CheckBoxLists with countries
                    CheckBoxList ddlCountry = (CheckBoxList)MovieDetailsView.FindControl("ddlCountry");
                    ddlCountry.DataSource = CountriesList();
                    ddlCountry.DataBind();

                    CheckBoxList ddlCountriesIPTV = (CheckBoxList)MovieDetailsView.FindControl("ddlCountriesIPTV");
                    ddlCountriesIPTV.DataSource = CountriesList();
                    ddlCountriesIPTV.DataBind();

                    CheckBoxList ddlCountriesVOD = (CheckBoxList)MovieDetailsView.FindControl("ddlCountriesVOD");
                    ddlCountriesVOD.DataSource = CountriesList();
                    ddlCountriesVOD.DataBind();


                    // select countries in ddlCountry
                    string countriesMovie = queryMovieByID2.FirstOrDefault().Country;
                    //Convert the string into an array of words
                    string[] countryArray = countriesMovie.Split(new char[] { '?', '!', ';', ':', ',' }, StringSplitOptions.RemoveEmptyEntries);

                    // has to be 'ListItem' "(ListItem item in ddlCountry.Items)" -> NOT "var"(var item in ddlCountries.Items)
                    foreach (ListItem item in ddlCountry.Items)
                    {
                        for (int k = 0; k < countryArray.Length; k++)
                        {
                            if (item.ToString().ToUpperInvariant() == countryArray[k].ToUpperInvariant().Trim())
                            {
                                item.Selected = true;
                            }
                        }
                    }

                    // select countries in ddlIPTV
                    string countriesIPTV = queryMovieByID2.FirstOrDefault().RightsIPTV;
                    //Convert the string into an array of words
                    string[] iptvArray = countriesIPTV.Split(new char[] { '?', '!', ';', ':', ',' }, StringSplitOptions.RemoveEmptyEntries);
                    // has to be 'ListItem' "(ListItem item in ddlcountriesIPTV.Items)" -> NOT "var"(var item in ddlCountries.Items)
                    foreach (ListItem item in ddlCountriesIPTV.Items)
                    {
                        for (int k = 0; k < iptvArray.Length; k++)
                        {
                            if (item.ToString().ToUpperInvariant() == iptvArray[k].ToUpperInvariant().Trim())
                            {
                                item.Selected = true;
                            }
                        }
                    }


                    // select countries in ddlVOD
                    string countriesVOD = queryMovieByID2.FirstOrDefault().RightsVOD;
                    //Convert the string into an array of words
                    string[] VODArray = countriesVOD.Split(new char[] { '?', '!', ';', ':', ',' }, StringSplitOptions.RemoveEmptyEntries);
                    // has to be 'ListItem' "(ListItem item in ddlCountriesVOD.Items)" -> NOT "var"(var item in ddlCountriesVOD.Items)
                    foreach (ListItem item in ddlCountriesVOD.Items)
                    {
                        for (int k = 0; k < VODArray.Length; k++)
                        {
                            if (item.ToString().ToUpperInvariant() == VODArray[k].ToUpperInvariant().Trim())
                            {
                                item.Selected = true;
                            }
                        }
                    }

                    // set text/value in DropdDownCheckBox Controls: ddlAncillaryRights and ddlSVODRights
                    string       svodRights         = queryMovieByID2.FirstOrDefault().SVODRights.ToString();
                    string       ancillaryRights    = queryMovieByID2.FirstOrDefault().AncillaryRights.ToString();
                    DropDownList ddlAncillaryRights = (DropDownList)MovieDetailsView.FindControl("ddlAncillaryRights");
                    DropDownList ddlSVODRights      = (DropDownList)MovieDetailsView.FindControl("ddlSVODRights");
                    ddlAncillaryRights.Text = ancillaryRights;
                    ddlSVODRights.Text      = svodRights;

                    // set the date in startDateCalendar and make it visible in control
                    DateTime startDate = (DateTime)queryMovieByID2.First().StartDate;
                    System.Web.UI.WebControls.Calendar startDateCalendar = (System.Web.UI.WebControls.Calendar)MovieDetailsView.FindControl("startDateCalendar");
                    startDateCalendar.SelectedDate = startDate;
                    startDateCalendar.VisibleDate  = startDate;
                    // set the Year and Month in ddlStartYear and ddlStartMonth
                    DropDownList ddlStartYear  = (DropDownList)MovieDetailsView.FindControl("DropDownListYear");
                    DropDownList ddlStartMonth = (DropDownList)MovieDetailsView.FindControl("DropDownListMonth");
                    ddlStartYear.Text  = startDate.Year.ToString();
                    ddlStartMonth.Text = startDate.Month.ToString();



                    // set the date in expiryDateCalendar and make it visible in control
                    DateTime expiryDate = (DateTime)queryMovieByID2.First().ExpireDate;
                    System.Web.UI.WebControls.Calendar expiryDateCalendar = (System.Web.UI.WebControls.Calendar)MovieDetailsView.FindControl("expireDateCalendar");
                    expiryDateCalendar.SelectedDate = expiryDate;
                    expiryDateCalendar.VisibleDate  = expiryDate;
                    // set the Year and Month in ddlExpiryYear and ddlExpiryMonth
                    DropDownList ddlExpiryYear  = (DropDownList)MovieDetailsView.FindControl("DropDownListExpireYear");
                    DropDownList ddlExpiryMonth = (DropDownList)MovieDetailsView.FindControl("DropDownListExpireMonth");
                    ddlExpiryYear.Text  = expiryDate.Year.ToString();
                    ddlExpiryMonth.Text = expiryDate.Month.ToString();
                }
                catch (Exception)
                {
                    lblMessage.Text = "An error occurred. Please try again.";
                }
            }
        }
Ejemplo n.º 18
0
 protected void calendarImage2_Click(object sender, EventArgs e)
 {
     System.Web.UI.WebControls.Calendar cal = (System.Web.UI.WebControls.Calendar)MovieDetailsView.FindControl("expireDateCalendar");
     cal.Visible = true;
 }