Example #1
0
        public void SetRotation(string strPicture, int iRotation)
        {
            // Continue only if it's a picture files
            if (!Util.Utils.IsPicture(strPicture))
            {
                return;
            }

            string strSQL = "";

            try
            {
                string strPic = strPicture;
                DatabaseUtility.RemoveInvalidChars(ref strPic);

                long lPicId = AddPicture(strPicture, iRotation);
                if (lPicId >= 0)
                {
                    strSQL = String.Format("update tblPicture set iRotation={0} where strFile like '{1}'", iRotation, strPic);
                    SqlServerUtility.ExecuteNonQuery(_connection, strSQL);
                }
            }
            catch (Exception ex)
            {
                Log.Error("MediaPortal.Picture.Database exception err:{0} stack:{1}", ex.Message, ex.StackTrace);
            }
        }
Example #2
0
        public void DeletePicture(string strPicture)
        {
            string strSQL = "";

            try
            {
                string strPic = strPicture;
                DatabaseUtility.RemoveInvalidChars(ref strPic);

                strSQL = String.Format("delete from tblPicture where strFile like '{0}'", strPic);
                SqlServerUtility.ExecuteNonQuery(_connection, strSQL);
            }
            catch (Exception ex)
            {
                Log.Error("MediaPortal.Picture.Database exception deleting picture err:{0} stack:{1}", ex.Message, ex.StackTrace);
            }
        }
        public void DeleteFolderSetting(string path, string Key, bool withPath)
        {
            if (path == null)
            {
                return;
            }
            if (path == string.Empty)
            {
                return;
            }
            if (Key == null)
            {
                return;
            }
            if (Key == string.Empty)
            {
                return;
            }
            try
            {
                string pathFiltered = Utils.RemoveTrailingSlash(path);
                string keyFiltered  = Key;
                DatabaseUtility.RemoveInvalidChars(ref pathFiltered);
                DatabaseUtility.RemoveInvalidChars(ref keyFiltered);

                int PathId = AddPath(pathFiltered);
                if (PathId < 0)
                {
                    return;
                }
                string strSQL = String.Format("delete from tblFolderSetting where idPath={0} and tagName ='{1}'", PathId,
                                              keyFiltered);
                SqlServerUtility.ExecuteNonQuery(_connection, strSQL);
                if (withPath)
                {
                    strSQL = String.Format("delete from tblPath where idPath={0}", PathId);
                    SqlServerUtility.ExecuteNonQuery(_connection, strSQL);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }