//public void InitView(dtoDisplayItemRepository item)
        //{
        //    if (item == null)
        //        View.DisplayNoAction();
        //    else
        //        AnalyzeAction(item);
        //}

        private void AnalyzeAction(ModuleLink pLink)
        {
            int ActionID           = pLink.Action;
            BaseCommunityFile item = null;

            if ((pLink.DestinationItem != null))
            {
                item = Service.GetItem(pLink.DestinationItem.ObjectLongID);
                if ((item == null) || (pLink.DestinationItem.ObjectLongID == 0 && (ActionID == (int)CoreModuleRepository.ActionType.CreateFolder || ActionID == (int)CoreModuleRepository.ActionType.UploadFile)))
                {
                    View.DisplayRemovedObject();
                }
                else
                {
                    int IdCommunity = 0;
                    if (item.CommunityOwner != null)
                    {
                        IdCommunity = item.CommunityOwner.Id;
                    }
                    if (typeof(CommunityFile) == item.GetType())
                    {
                        View.ServiceCode = pLink.DestinationItem.ServiceCode;
                        View.ServiceID   = pLink.DestinationItem.ServiceID;
                    }
                    else
                    {
                        View.ServiceCode = pLink.SourceItem.ServiceCode;
                        View.ServiceID   = pLink.SourceItem.ServiceID;
                    }

                    if (item is ModuleInternalFile)
                    {
                        ModuleInternalFile oInternal = (ModuleInternalFile)item;
                        View.DisplayLinkForModule(pLink.Id, IdCommunity, item, oInternal.ServiceActionAjax);
                    }
                    else
                    {
                        View.DisplayLink(pLink.Id, IdCommunity, item);
                    }
                }
            }
            else
            {
                View.DisplayNoAction();
            }
        }
        //Public Sub InitView(ByVal oItem As dtoCommunityItemRepository)
        //    Me.View.FileDisplayName = ""
        //    If oItem Is Nothing Then
        //        Me.View.DisplayNoAction()
        //    Else : AnalyzeAction(oItem)
        //    End If
        //End Sub

        public void AnalyzeAction(ModuleLink link, iCoreFilePermission permission)
        {
            Int32             idAction = link.Action;
            BaseCommunityFile item     = null;

            if (link.DestinationItem != null)
            {
                item = Service.GetItem(link.DestinationItem.ObjectLongID);
                if (item == null || (link.DestinationItem.ObjectLongID == 0 && (idAction == (Int32)CoreModuleRepository.ActionType.CreateFolder || idAction == (Int32)CoreModuleRepository.ActionType.UploadFile)))
                {
                    View.DisplayRemovedObject();
                }
                else
                {
                    Int32 idCommunity = 0;
                    switch (idAction)
                    {
                    case (Int32)CoreModuleRepository.ActionType.DownloadFile:
                        if (typeof(CommunityFile) == item.GetType())
                        {
                            View.ModuleCode = link.DestinationItem.ServiceCode;
                            View.IdModule   = link.DestinationItem.ServiceID;
                        }
                        else
                        {
                            View.ModuleCode = link.SourceItem.ServiceCode;
                            View.IdModule   = link.SourceItem.ServiceID;
                        }
                        if (item.CommunityOwner != null)
                        {
                            idCommunity = item.CommunityOwner.Id;
                        }

                        View.FileDisplayName = item.DisplayName;
                        View.DisplayLinkDownload(link.Id, idCommunity, item, permission);
                        break;

                    case (Int32)CoreModuleRepository.ActionType.PlayFile:

                        if (typeof(CommunityFile) == item.GetType())
                        {
                            View.ModuleCode = link.DestinationItem.ServiceCode;
                            View.IdModule   = link.DestinationItem.ServiceID;
                        }
                        else
                        {
                            View.ModuleCode = link.SourceItem.ServiceCode;
                            View.IdModule   = link.SourceItem.ServiceID;
                        }
                        if (item.CommunityOwner != null)
                        {
                            idCommunity = item.CommunityOwner.Id;
                        }
                        View.FileDisplayName = item.DisplayName;

                        if (typeof(ModuleInternalFile) == item.GetType())
                        {
                            ModuleInternalFile intItem = (ModuleInternalFile)item;
                            View.DisplayLinkForPlayInternal(link.Id, idCommunity, item, permission, intItem.ServiceActionAjax);
                        }
                        else
                        {
                            View.DisplayLinkForPlay(link.Id, idCommunity, item, permission);
                        }
                        break;

                    default:
                        View.DisplayNoAction();
                        break;
                    }
                }
            }
            else
            {
                View.DisplayNoAction();
            }
        }