Example #1
0
 public Boolean RemoveCSMedia(CSMedia media)
 {
     InitDB();
     try
     {
         //THIS WILL PURGE THE MEDIA FROM THE CSMEDIA TABLE
         media.MarkAsDeleted();
         media.Save();
         Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"Media deleted ok");
     }
     catch (Exception ex)
     {
         Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"Error deleting media");
         return false;
     }
     return true;
 }
Example #2
0
        public Boolean InsertUpdateCSMedia(CSMedia _csmedia)
        {
            InitDB();
            //Screen newScreen = new Screen();
            CSMedia newCSMedia = new CSMedia();

            Console.WriteLine("Insert/Update CS Media");

            Console.WriteLine("Query CS Media");
            //newCSMedia.Query.Where(
            //    newCSMedia.Query.Mediafilename.IsNotNull() &&
            //    newCSMedia.Query.Mediafilename.ToLower().Equal(_csmedia.Mediafilename.ToLower()));
            //Console.WriteLine("Query CS Media Done");

            Boolean functionResult = false;
            //try
            //{
            //    if (newCSMedia.Query.Load()) //Do update
            //    {
            //        Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"Updating CSMedia");
            //        //newCSMedia.Mediablob = csmedia.Mediablob;
            //        newCSMedia.Mediatype = _csmedia.Mediatype;
            //        //newCSMedia.Isfile = 1;
            //        //newCSMedia.Importedbywho = csmedia.Importedbywho;
            //        //newCSMedia.Attributes1 = csmedia.Attributes1;
            //        //newCSMedia.Attributes2 = csmedia.Attributes2;
            //        //newCSMedia.Attributes3 = csmedia.Attributes3;
            //        //newCSMedia.Attributes1 = csmedia.Attributes1;
            //        //newCSMedia.Datetimeimported = (DateTime)DateTime.Now;
            //        newCSMedia.Save();
            //        functionResult = true;
            //    }
            //    else                         //Do update
            //    {
                    try
                    {
                        newCSMedia = new CSMedia();
                        Console.WriteLine(DateTime.Now.ToShortTimeString() + "  " + "Insert New CSMedia");
                        newCSMedia.Mediafilename = _csmedia.Mediafilename;
                        newCSMedia.Mediablob = _csmedia.Mediablob;
                        newCSMedia.Mediatype = _csmedia.Mediatype;
                        newCSMedia.Save();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }

                    functionResult = true;
                //}
            //}
            //catch (Exception ex)
            //{
            //    functionResult = false;
            //    Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"ERR:"+ex.Message);
            //}
            return functionResult;
        }