private string FolioElements_GetOnClickEvent(Folio folio, int index, bool isExtra, string duration_formatStr, string media_str = "")
        {
            string onclick_event = string.Empty;
            if (folio != null)
            {
                media_str = string.IsNullOrWhiteSpace(media_str) ? GetMediaTypeName(folio) : media_str;

                onclick_event = "clickTimelineElement2(" + folio.tapeID + ", " + index + "," + folio.duration + ",\"";
                onclick_event += folio.timestamp.ToString("dd'-'MM'-'yyyy HH':'mm':'ss") + "\",\"" + media_str + "\",";
                onclick_event += folio.segmentID + ", \"" + isExtra.ToString().ToLowerInvariant() + "\", \"" + folio.fileName + "\",\"";
                onclick_event += folio.filePath + "\",\"" + duration_formatStr + "\",\"" + folio.mediaType + "\",\"" + folio.fileStatus + "\")";
            }
            return onclick_event;
        }
 private static string GetMediaTypeName(Folio folio)
 {
     string media_str = "Grabación";
     if (folio != null && !string.IsNullOrWhiteSpace(media_str))
     {
         switch (folio.mediaType)
         {
             case "S":
                 {
                     media_str = "Grabación";
                     break;
                 }
             case "A":
                 {
                     media_str = "Audio";
                     break;
                 }
             case "V":
                 {
                     media_str = "Video";
                     break;
                 }
             case "D":
                 {
                     media_str = "Documento";
                     break;
                 }
             case "C":
                 {
                     media_str = "Comentario";
                     break;
                 }
             case "I":
                 {
                     media_str = "Imagen";
                     break;
                 }
         }
     }
     return media_str;
 }
        public List<Folio> GetAllFolios(string folio_textID = "")
        {
            // #1- Logger variables
            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            string className = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name;
            string methodName = stackFrame.GetMethod().Name;

            List<Folio> result = new List<Folio>();

            string query = "SELECT ";
            query += "	ifnull(tag.text, '') as 'folioID', ";
            query += "	tape.id as 'tapeID', ";
            query += "	seg.id as 'segmentID', ";
            query += "	ifnull(user.groupName, '') as 'groupName', ";
            query += "	ifnull(user.userName, '') as 'userName', ";
            query += "	seg.localparty as 'localparty', ";
            query += "	seg.remoteParty as 'remoteParty', ";
            query += "	seg.timestamp as 'timestamp', ";
            query += "	seg.duration as 'duration', ";
            query += "	tape.mediaType 'mediaType', ";
            query += "	tape.deleted as 'deleted', ";
            query += "	tape.filename as 'fileName', ";
            query += "	'' as 'filePath', ";
            query += "	'OK' as 'fileStatus', ";
            query += "	'0' as 'isExtra' ";

            query += "FROM orksegment as seg ";
            query += "JOIN orktape as tape ";
            query += "	on seg.tape_id = tape.id ";
            query += "JOIN ( ";
            query += "	SELECT taggedSegment_id, t.text ";
            query += "	FROM orktag as t JOIN orktagtype as tt ON t.tagType_id = tt.id ";
            query += "	AND tt.name = 'folio' AND t.text = '" + folio_textID + "' ";
            query += "	) as tag ";
            query += "	ON seg.id = tag.taggedSegment_id ";
            query += "LEFT JOIN ( ";
            query += "	SELECT taggedSegment_id, t.text ";
            query += "	FROM orktag as t JOIN orktagtype as tt ON t.tagType_id = tt.id ";
            query += "	AND tt.name = 'usuario' ";
            query += "	) as segUser ";
            query += "	ON seg.id = segUser.taggedSegment_id ";
            query += "LEFT JOIN incuser as user ";
            query += "	ON segUser.text = user.id  ";
            query += "WHERE tape.deleted = 0 ";

            query += "UNION ALL  ";

            query += "SELECT ";
            query += "	extras.folio as 'folioID', ";
            query += "	extras.id as 'tapeID', ";
            query += "	extras.id as 'segmentID', ";
            query += "	ifnull(user.groupName, '') as 'groupName',  ";
            query += "	ifnull(user.userName, '') as 'userName', ";
            query += "	extras.localparty as 'localparty', ";
            query += "	extras.remoteParty as 'remoteparty', ";
            query += "	extras.timestamp as 'timestamp', ";
            query += "	extras.duration as 'duration', ";
            query += "	extras.mediaType 'mediaType', ";
            query += "	extras.deleted as 'deleted', ";
            query += "	extras.filename as 'fileName', ";
            query += "	extras.filePath as 'filePath', ";
            query += "	extras.fileStatus as 'fileStatus', ";
            query += "	'1' as 'isExtra' ";

            query += "FROM incextras as extras  ";
            query += "LEFT JOIN incuser as user ";
            query += "	ON extras.userId = user.id ";
            query += "WHERE extras.folio = '" + folio_textID + "' ";
            query += "AND extras.deleted = 0 ";

            query += "ORDER BY timeStamp ASC; ";

            // #2- Logger pre query
            Logger.LogDebug("(%s) (%s) -- Ejecuta query para obtener todos los folios. QUERY: %s", className, methodName, query);

            Hashtable param = new Hashtable();
            param.Add("@folioID", folio_textID);
            using (DataTable dt = ExecuteDataTableQuery(query, param))
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    // #3- Logger post query
                    Logger.LogDebug("Row count: %s", dt.Rows.Count.ToString());

                    foreach (DataRow row in dt.Rows)
                    {
                        Folio folio = new Folio();
                        folio.folio_textID = (row["folioID"] != DBNull.Value) ? row["folioID"].ToString() : string.Empty;
                        folio.tapeID = (row["tapeID"] != DBNull.Value) ? int.Parse(row["tapeID"].ToString()) : 0;
                        folio.segmentID = (row["segmentID"] != DBNull.Value) ? int.Parse(row["segmentID"].ToString()) : 0;
                        folio.groupName = (row["groupName"] != DBNull.Value) ? row["groupName"].ToString() : string.Empty;
                        folio.userName = (row["userName"] != DBNull.Value) ? row["userName"].ToString() : string.Empty;
                        folio.localParty = (row["localParty"] != DBNull.Value) ? row["localParty"].ToString() : string.Empty;
                        folio.remoteParty = (row["remoteParty"] != DBNull.Value) ? row["remoteParty"].ToString() : string.Empty;
                        folio.timestamp = (row["timestamp"] != DBNull.Value) ? DateTime.Parse(row["timestamp"].ToString()) : DateTime.Now;
                        folio.duration = (row["duration"] != DBNull.Value) ? int.Parse(row["duration"].ToString()) : 0;
                        folio.mediaType = (row["mediaType"] != DBNull.Value) ? row["mediaType"].ToString() : string.Empty;
                        folio.deleted = (row["deleted"] != DBNull.Value) ? int.Parse(row["deleted"].ToString()) : 0;
                        folio.fileName = (row["fileName"] != DBNull.Value) ? row["fileName"].ToString() : string.Empty;
                        folio.filePath = (row["filePath"] != DBNull.Value) ? row["filePath"].ToString() : string.Empty;
                        folio.fileStatus = (row["fileStatus"] != DBNull.Value) ? row["fileStatus"].ToString() : string.Empty;

                        switch (folio.mediaType)
                        {
                            case "A":
                                {
                                    folio.TapeType_code = Folio.EnumTapeType_code.Audio;
                                    break;
                                }
                            case "S":
                                {
                                    folio.TapeType_code = Folio.EnumTapeType_code.Grabacion;
                                    break;
                                }
                            case "V":
                                {
                                    folio.TapeType_code = Folio.EnumTapeType_code.Video;
                                    break;
                                }
                            case "D":
                                {
                                    folio.TapeType_code = Folio.EnumTapeType_code.Documento;
                                    break;
                                }
                            case "C":
                                {
                                    folio.TapeType_code = Folio.EnumTapeType_code.Comentario;
                                    break;
                                }
                        }

                        result.Add(folio);
                    }
                }
            }

            return result;
        }