Example #1
0
 private void btnAddToSchedule_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     e.Handled = true;
     try
     {
         DAL.Loop newLoop = new DAL.Loop();
         newLoop = (DAL.Loop)cbMediaLoop.SelectedItem;
         AddToSchedule(newLoop);
     }
     catch (Exception ex)
     {
     }
 }
Example #2
0
 private void btnApplyAddLoop_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     e.Handled = true;
     showWait();
     gbAddEditLoop.Visibility = Visibility.Collapsed;
     DAL.Loop _loop = new DAL.Loop();
     _loop.Name = tbLoopName.Text + "/" + tbLoopDateID.Text;
     _loop.Description = tbLoopDescription.Text;
     DAL.Template _template = new DAL.Template();
     _template = (DAL.Template)cbLoopTemplate.SelectedItem;
     _loop.Templateid = _template.Id;
     _loop.Templatename = _template.Name;
     proxy.InsertLoop(_loop);
     RefreshMediaLoops();
     //_loopCollection.Add(_loop);
     cbMediaLoop.DataContext = null;
     cbMediaLoop.DataContext = _loopCollection;
     cbMediaLoop.SelectedItem = _loop;
     lbMediaLoops.DataContext = null;
     lbMediaLoops.DataContext = _loopCollection;
     foreach (DAL.Loop item in _loopCollection)
     {
         if (item.Name == _loop.Name)
         {
             lbMediaLoops.SelectedItem = item;
         }
     }
     showConfirmation();
     //lbMediaLoops.SelectedItem = _loop;
 }
Example #3
0
        private void ApplySelectedSchedule()
        {
            try
            {
                Boolean errors = false;
                if (ScheduleAddEditMode == "edit")
                //Edit ScheduleAddEditMode
                {
                }
                else
                //Add New
                {
                    scheduleItem = new DAL.Schedule();
                    DateTime datestart = new DateTime();
                    DateTime schedstart = new DateTime();
                    DateTime schedend = new DateTime();
                    DateTime timestart = new DateTime();
                    DateTime starts = new DateTime();
                    DateTime ends = new DateTime();
                    //datestart = (DateTime)radSchedulingCalender.SelectedDate;
                    //schedstart = (DateTime)radtimePickerStart.SelectedValue;
                    //schedend = (DateTime)radtimePickerEnd.SelectedValue;
                    DateTime? t1 = new DateTime(datestart.Year, datestart.Month, datestart.Day, schedstart.Hour, schedstart.Minute, schedstart.Second);
                    DateTime? t2 = new DateTime(datestart.Year, datestart.Month, datestart.Day, schedend.Hour, schedend.Minute, schedend.Second);
                    starts = (DateTime)t1;
                    ends = (DateTime)t2;
                    //MessageBox.Show(starts.ToString());

                    //configureScheduleItem
                    scheduleItem.Loopstart = starts;
                    scheduleItem.Loopend= ends;
                    try
                    {
                        DAL.Loop loop = new DAL.Loop();
                        //loop = (DAL.Loop)cbMediaLoop.SelectedItem;
                        scheduleItem.Loopid = loop.Id;
                        scheduleItem.Loopname = loop.Name;
                        scheduleItem.Createdon = (DateTime)DateTime.Now;
                    }
                    catch (Exception ex)
                    {
                        errors = true;
                    }
                    try
                    {
                        if (rbGroup.IsChecked == true)
                        {
                            scheduleItem.Screenid = "0";
                            scheduleItem.Screenname = "";
                            DAL.Screengroups scrg = new DAL.Screengroups();
                            scrg = (DAL.Screengroups)cbGroup.SelectedItem;
                            scheduleItem.Groupid = scrg.Id;
                            scheduleItem.Groupname = scrg.Name;
                        }
                        else
                        {
                            scheduleItem.Groupid = "0";
                            scheduleItem.Groupname = "";
                            DAL.Screen scr = new DAL.Screen();
                            scr = (DAL.Screen)cbDisplay.SelectedItem;
                            scheduleItem.Screenid = scr.Id;
                            scheduleItem.Screenname = scr.Screenname;
                        }
                    }
                    catch (Exception ex)
                    {
                        si.sii("Error creating schedule item");
                        si.six(ex);
                        errors = true;
                    }
                    if (errors == false)
                    {
                        si.sii("Creating OK, inserting Schedule Item");
                        proxy.InsertScheduleItem(scheduleItem);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #4
0
 private void ApplyMediatoZone()
 {
     try
     {
         //LbMediaLoops
         showWait();
         DAL.Loop sLoop = new DAL.Loop();
         sLoop = (DAL.Loop)lbMediaLoops.SelectedItem;
         //MessageBox.Show(sLoop.Id + "/" + sLoop.Name);
         //lbLoopZones
         DAL.Template sTemplateZone = new DAL.Template();
         sTemplateZone = (DAL.Template)lbLoopZones.SelectedItem;
         //MessageBox.Show(sTemplateZone.Id + "/" + sTemplateZone.Zonename);
         //lbZoneMedia - applyMediatoZone
         ObservableCollection<DAL.Loop> loopCollection = new ObservableCollection<DAL.Loop>();
         //DAL.LoopCollection loopCollection = new DAL.LoopCollection();
         ObservableCollection<DAL.LoopContent> loopContentCollection = new ObservableCollection<DAL.LoopContent>();
         //DAL.LoopContentCollection loopContentCollection = new DAL.LoopContentCollection();
         //ObservableCollection<DAL.Content> contentForZone = new ObservableCollection<DAL.Content>();
         int _order = 1;
         foreach (DAL.Content item in lbZoneMedia.Items)
         {
             //MessageBox.Show(item.Name);
             DAL.LoopContent newLoopContent = new DAL.LoopContent();
             newLoopContent.Loopid = sLoop.Id;
             newLoopContent.Loopname = sLoop.Name;
             newLoopContent.Templateid = sTemplateZone.Id;
             newLoopContent.Templatename = sTemplateZone.Name;
             newLoopContent.Mediaid = item.Id;
             newLoopContent.Medianame = item.Name;
             newLoopContent.Zoneid = sTemplateZone.Id;
             newLoopContent.Zonename = sTemplateZone.Zonename;
             newLoopContent.Order = _order;
             _order++;
             loopContentCollection.Add(newLoopContent);
         }
         proxy.ApplyLoopContentCollection(loopContentCollection);
         showConfirmation();
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.Message);
     }
 }
Example #5
0
        private void CollectMediaForLoopAndZone()
        {
            try
            {
                //LbMediaLoops
                DAL.Loop sLoop = new DAL.Loop();
                sLoop = (DAL.Loop)lbMediaLoops.SelectedItem;
                //lbLoopZones
                DAL.Template sTemplateZone = new DAL.Template();
                sTemplateZone = (DAL.Template)lbLoopZones.SelectedItem;

                ObservableCollection<DAL.Content> contentToAdd = new ObservableCollection<DAL.Content>();
                //DAL.LoopContentCollection loopContent = new DAL.LoopContentCollection();
                ObservableCollection<DAL.LoopContent> loopContent = new ObservableCollection<DAL.LoopContent>();
                loopContent = proxy.CollectLoopContentForZone(sTemplateZone, sLoop);
                var loopContentOrdered = from x in loopContent
                                         orderby x.Order ascending
                                         select x;
                lbZoneMedia.Items.Clear();
                RefreshAllMedia();
                foreach (DAL.Content item in lbAllMedia.Items)
                {
                    foreach (var lc in loopContentOrdered)
                    {
                        if (lc.Mediaid == item.Id)
                        {
                            item.Metadata9 = lc.Order.ToString();
                            contentToAdd.Add(item);
                        }
                    }
                }
                for (int i = 1; i < 100; i++)
                {
                    foreach (DAL.Content item in contentToAdd)
                    {   if (item.Metadata9 == i.ToString())
                           lbZoneMedia.Items.Add(item);
                    }
                }

            }
            catch (Exception ex)
            {
            }
        }
Example #6
0
        private void ChangeZoneGrid()
        {
            DAL.Loop _loop = new DAL.Loop();
            ObservableCollection<DAL.Template> _zoneCollection = new ObservableCollection<DAL.Template>();
            ObservableCollection<DAL.Template> _tempzoneCollection = new ObservableCollection<DAL.Template>();
            //DAL.TemplateCollection _tempzoneCollection = new DAL.TemplateCollection();
            _loop = (DAL.Loop)lbMediaLoops.SelectedItem;
            //DAL.TemplateCollection _templateC = new DAL.TemplateCollection();
            ObservableCollection<DAL.Template> _templateC = new ObservableCollection<DAL.Template>();
            _templateC = proxy.CollectTemplates();
            DAL.Template _template = new DAL.Template();
            foreach (DAL.Template item in _templateC)
            {
                try
                {
                    if (item.Id == _loop.Templateid)
                    {
                        _template = item;
                        lbLoopZones.DataContext = null;
                        _tempzoneCollection = proxy.CollectZonesForTemplate(_template);
                        foreach (DAL.Template z in _tempzoneCollection)
                        {
                            if (cbfShowBackgroundZone.IsChecked == false)
                            {
                                if (z.Zonename != "Background") _zoneCollection.Add(z);
                            }
                            else
                            {
                                _zoneCollection.Add(z);
                            }

                        }

                        //lbLoopZones.DataContext = proxy.CollectZonesForTemplate(_template);
                        lbLoopZones.DataContext = _zoneCollection;
                    }
                }
                catch (Exception ex)
                {
                    lbLoopZones.DataContext = null;
                }
            }
            try
            {
                if (lbLoopZones.SelectedIndex < 0) lbLoopZones.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
            }
        }
Example #7
0
 private void btnRemoveLoop_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     e.Handled = true;
     try
     {
         DAL.Loop _loop = new DAL.Loop();
         _loop = (DAL.Loop)lbMediaLoops.SelectedItem;
         //MessageBox.Show(_loop.Id.ToString());
         proxy.RemoveLoop(_loop);
     }
     catch (Exception ex)
     {
     }
     RefreshMediaLoops();
 }