コード例 #1
0
        public LogList getLogList(DateTime date)
        {
            LogList log = new LogList();
            List<ScheduledSlice> scheduledslices =getScheduledSlices(date);

            for (int i = 0; i < scheduledslices.Count; i++)
            {
                ScheduledSlice scheduledslice = scheduledslices.ElementAt(i);
                LogListPrj.Slice slice = log.newSliceOnList(scheduledslice.scheduleddate);
                for (int j = 0; j < scheduledslice.slots.Count; j++)
                {
                    ScheduledSlot schslot = scheduledslice.slots.ElementAt(j);
                    DataItem item = null;
                    if (schslot.type == "AUDIO")
                    {
                        item = new DataSongItem(schslot.iddataitem, schslot.dataitem.artist, schslot.dataitem.title, System.Configuration.ConfigurationSettings.AppSettings["MusicPath"] + "" + schslot.dataitem.file, new TimeMarker(TimeSpan.Zero, schslot.dataitem.runtime));
                        item.setField("pic1", schslot.dataitem.radiovis1);
                        item.setField("pic2", schslot.dataitem.radiovis2);
                        item.setField("pic3", schslot.dataitem.radiovis3);
                        item.setField("pic4", schslot.dataitem.radiovis4);
                        item.setField("radiovistxt", schslot.dataitem.radiovistxt);
                        item.setField("currentdescr", schslot.dataitem.radiovistxt);

                    }
                    else if (schslot.type == "LOGNOTE")
                    {
                        item = new DataLogNoteItem(schslot.idhist, schslot.param, TimeSpan.Zero);

                    }
                    else if (schslot.type == "SYNC")
                    {
                        if(schslot.param == "HARD")
                            item = new DataSyncItem(schslot.idhist, DS.SyncType.HARD, schslot.scheduleddatetime);

                        else
                            item = new DataSyncItem(schslot.idhist, DS.SyncType.SOFT, schslot.scheduleddatetime);
                    }

                    if(item != null)
                        log.addDataToSlice(item, slice, schslot.idhist, date);
                }

            }

                log.refreshAirdatetime();
                log.loadPlaylist();
            return log;
        }
コード例 #2
0
        public void loadDataFromDB(ITEMFILTER filter = ITEMFILTER.NONE, String param=null)
        {
            try
            {
                dbengine = DBengineMySql.GetInstance();



                //TODO: CHECK CHANGES???

                dataitems.Clear();

                dbengine.connect("127.0.0.1", "root", "1234", "ebuplayout-dev2");

                _datatable = dbengine.listItems(filter, param);
                if (filter == ITEMFILTER.CATEGORY)
                {
                    for (int i = 0; i < _datatable.Rows.Count; i++)
                    {
                        if (_datatable.Rows[i]["type"].ToString() == "AUDIOFILE")
                        {
                            DataRow data = _datatable.Rows[i];
                            int id = (int)data["iddataitems"];
                            String artist = data["artist"].ToString();
                            String title = data["title"].ToString();
                            String filename = data["file"].ToString();
                            String radiovis1 = data["radiovis1"].ToString();
                            String radiovis2 = data["radiovis2"].ToString();
                            String radiovis3 = data["radiovis3"].ToString();
                            String radiovis4 = data["radiovis4"].ToString();
                            String radiovistxt = data["radiovistxt"].ToString();
                            String category = data["category"].ToString();
                            TimeSpan tmcue = TimeSpan.FromMilliseconds((int)data["tmcue"]);
                            TimeSpan tmnext = TimeSpan.FromMilliseconds((int)data["tmnext"]);
                            if (tmnext == TimeSpan.Zero)
                            {
                                tmnext = TimeSpan.FromMilliseconds((int)data["runtime"]);
                            }

                            DataSongItem song = new DataSongItem(id, artist, title, filename, new TimeMarker(tmcue, tmnext));
                            song.category = category;

                            song.setField("radiovis1", radiovis1);
                            song.setField("radiovis2", radiovis2);
                            song.setField("radiovis3", radiovis3);
                            song.setField("radiovis4", radiovis4);
                            song.setField("radiovistxt", radiovistxt);

                            dataitems.Add(id, song);
                        }
                    }
                }
                else if(filter == ITEMFILTER.CANVASPERIOD){
                    slicecanvas.Clear();
                    for (int i = 0; i < _datatable.Rows.Count; i++)
                    {
                        DataRow data = _datatable.Rows[i];

                        SliceCanvasItem c = new SliceCanvasItem(data["idcanvasperiod_items"].ToString(), (int)data["position"],  data["idslice"].ToString(), data["name"].ToString(), TimeSpan.FromMilliseconds(0));
                        
                        slicecanvas.Add(Int32.Parse(c.idperioditem), c);
                    }
                }
                else if (filter == ITEMFILTER.CANVASSLICE)
                {
                    sliceitems.Clear();
                    for (int i = 0; i < _datatable.Rows.Count; i++)
                    {
                        DataRow data = _datatable.Rows[i];

                        SlotCanvas slot = new SlotCanvas(Int32.Parse(data["idcanvasitem"].ToString()), Int32.Parse(data["idcanvasslice"].ToString()), Int32.Parse(data["clockposition"].ToString()), getSlotCanvasType(data["type"]), data["param1"].ToString(), data["param2"].ToString(), data["param3"].ToString(), data["label"].ToString());

                        sliceitems.Add(slot.id, slot);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            

        }