Exemplo n.º 1
0
 public Boolean RemoveCSMediaLoop(CSMedialoop medialoop)
 {
     InitDB();
     try
     {
         //THIS WILL PURGE THE MEDIA FROM THE CSMEDIA TABLE
         medialoop.MarkAsDeleted();
         medialoop.Save();
         Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"Media Loop deleted ok");
     }
     catch (Exception ex)
     {
         Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"Error deleting media loop");
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
        public Boolean InsertUpdateCSMediaLoop(CSMedialoop loop)
        {
            InitDB();
            //Screen newScreen = new Screen();
            CSMedialoop newLoop = new CSMedialoop();

            try
            {
                newLoop.Query.Where(
                newLoop.Query.Loopname.IsNotNull() &&
                newLoop.Query.Mediafilename.IsNotNull() &&
                newLoop.Query.Mediafilename.ToLower().Equal(loop.Mediafilename.ToLower())
                );
            }
            catch (Exception)
            {
            }

            Boolean thereIsNoExistingID = false;
            try
            {
                if (loop.Id > 0)
                {
                    thereIsNoExistingID = false;
                }
                else
                {
                    thereIsNoExistingID = true;
                }
            }
            catch (Exception)
            {
                thereIsNoExistingID = true;
            }

            Boolean functionResult = false;
            try
            {
                if (newLoop.Query.Load() && thereIsNoExistingID == false) //Do an update
                {
                    Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"Updating MediaLoop Item");
                    newLoop.Order = loop.Order;
                    newLoop.Mediatype = loop.Mediatype;
                    newLoop.Loopname = loop.Loopname;
                    newLoop.Save();
                    functionResult = true;
                    Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"Updated MediaLoop item OK");
                }
                else                         //Do update
                {
                    Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"Inserting New MediaLoop Item");
                    newLoop = new CSMedialoop();
                    newLoop.Mediatype = loop.Mediatype;
                    newLoop.Mediafilename = loop.Mediafilename;
                    newLoop.Order = loop.Order;
                    newLoop.Loopname = loop.Loopname;
                    newLoop.Save();
                    functionResult = true;
                    Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"Inserting New MediaLoop Item OK");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"Error during MediaLoop Item insert/update:");
                Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"Message: " + ex.Message);
                functionResult = false;
            }

            return functionResult;
        }