Example #1
0
    private int mSetPriority()
    {
        MediaSubjects mediaSubjects = new MediaSubjects();

        mediaSubjects.LoadByIDSubjectAndIDMediaSubjectType(pSubjectID, pMediaSubjectTypeID);
        mediaSubjects.Sort = MediaSubjects.ColumnNames.Priority;
        if (mediaSubjects.RowCount > 0)
        {
            mediaSubjects.MoveTo(mediaSubjects.RowCount - 1);
            if (!mediaSubjects.IsColumnNull(MediaSubjects.ColumnNames.Priority))
            {
                return(mediaSubjects.pPriority + 1);
            }
            else
            {
                mediaSubjects.Rewind();
                int i = 1;
                if (mediaSubjects.RowCount > 0)
                {
                    do
                    {
                        mediaSubjects.pPriority = i;
                        i++;
                    }while (mediaSubjects.MoveNext());
                    mediaSubjects.Save();
                }
                return(i++);
            }
        }
        else
        {
            return(1);
        }
    }
Example #2
0
    private void mLoadMedias()
    {
        StringBuilder sb     = new StringBuilder();
        MediaSubjects medias = new MediaSubjects();

        medias.LoadByIDSubjectAndIDMediaSubjectType(pSubject.pIDSubject, (byte)MediaSubjectTypes.Enum.gallery);
        if (medias.RowCount > 0)
        {
            medias.Sort = MediaSubjects.ColumnNames.Priority;
            sb.Append("<ul class='thumbItems'>");
            do
            {
                string fileUrl, Thumbnail = string.Empty;
                if (medias.pFileExtention.Contains("flv"))
                {
                    fileUrl = System.IO.Directory.GetFiles(MapPath(Global.Constants.FOLDER_MEDIAS), medias.pIDMedia.ToString() + medias.pFileExtention)[0];
                    sb.Append(string.Format(flashObject, fileUrl, medias.pFileName, Global.Constants.FOLDER_VIDEOPLAYER.Substring(1), Global.Constants.FILE_PLAYER_SWF.Substring(1)));
                }
                else
                {
                    fileUrl   = string.Format("{0}{1}{2}", Global.Constants.FOLDER_MEDIAS.Substring(1), medias.pIDMedia.ToString(), medias.pFileExtention);
                    Thumbnail = string.Format("<img src='{0}{1}{2}' width='150px' height='150px' />", Global.Constants.FOLDER_THUMBS.Substring(1), medias.pIDMedia.ToString(), medias.pFileExtention);
                    sb.Append(string.Format(otherFiles, fileUrl, Thumbnail));
                }
            }while (medias.MoveNext());
            sb.Append("</ul>");
        }
        else
        {
            sb.Append("");
        }
        litImages.Text = sb.ToString();
    }
Example #3
0
    private void mLoadAllPageMedias()
    {
        MediaSubjects mediaSubjects = new MediaSubjects();

        mediaSubjects.LoadByIDSubjectAndIDMediaSubjectType(pSubjectID, pMediaSubjectTypeID);
        mediaSubjects.Sort     = MediaSubjects.ColumnNames.Priority;
        grvPageList.DataSource = mediaSubjects.DefaultView;
        grvPageList.DataBind();
        uplPageList.Update();
    }
Example #4
0
    private void mDeleteMediaSubject()
    {
        MediaSubjects mediaSubject = new MediaSubjects();

        mediaSubject.LoadByIDSubjectAndIDMediaSubjectType(pSubjectID, pMediaSubjectTypeID);
        if (mediaSubject.RowCount > 0)
        {
            mediaSubject.MarkAsDeleted(false);
            mediaSubject.Save();
        }
    }
Example #5
0
    public string mGetCoverImage(object IDSubject)
    {
        string        imageUrl = string.Empty;
        MediaSubjects media    = new MediaSubjects();

        media.LoadByIDSubjectAndIDMediaSubjectType(new Guid(IDSubject.ToString()), (byte)MediaSubjectTypes.Enum.thumbnail);
        if (media.RowCount > 0)
        {
            imageUrl = string.Format("{0}{1}{2}", Global.Constants.FOLDER_MEDIAS.Substring(1), media.Medias.pIDMedia.ToString(), media.Medias.pFileExtention);
        }
        return(imageUrl);
    }
Example #6
0
    private void mLoadSubject()
    {
        StringBuilder sb            = new StringBuilder();
        Subjects      widgetSubject = new Subjects(subjectID);

        MediaSubjects medias = new MediaSubjects();

        medias.LoadByIDSubjectAndIDMediaSubjectType(widgetSubject.pIDSubject, (byte)MediaSubjectTypes.Enum.thumbnail);

        sb.Append(string.Format(widget, mGetURL(widgetSubject.pAlias), mGetImage(medias), widgetSubject.pBody));

        litWidget.Text = sb.ToString();
    }
Example #7
0
    private void reorderMediaSubjects(MediaSubjects mediaSubjects)
    {
        mediaSubjects.LoadByIDSubjectAndIDMediaSubjectType(pSubjectID, pMediaSubjectTypeID);
        mediaSubjects.Sort = MediaSubjects.ColumnNames.Priority;
        int i = 1;

        if (mediaSubjects.RowCount > 0)
        {
            do
            {
                mediaSubjects.pPriority = i;
                i++;
            }while (mediaSubjects.MoveNext());
            mediaSubjects.Save();
        }
    }
Example #8
0
    private string mGetCoverImage(string IDSubject)
    {
        string        result = "{0}{1}";
        MediaSubjects cover  = new MediaSubjects();

        cover.LoadByIDSubjectAndIDMediaSubjectType(new Guid(IDSubject), (byte)MediaSubjectTypes.Enum.thumbnail);
        if (cover.RowCount > 0)
        {
            result = string.Format(result, Global.Constants.FOLDER_MEDIAS.Substring(1), cover.pIDMedia + cover.pFileExtention);
        }
        else
        {
            result = string.Format(result, Global.Constants.IMAGE_NOAVAILABLE_SMALL, string.Empty);
        }
        return(result);
    }
Example #9
0
    private void mReloadImagePath()
    {
        MediaSubjects mediaSubjects = new MediaSubjects();

        mediaSubjects.LoadByIDSubjectAndIDMediaSubjectType(pSubjectID, pMediaSubjectTypeID);
        if (mediaSubjects.RowCount > 0)
        {
            string[] imageFile = System.IO.Directory.GetFiles(MapPath(Global.Constants.FOLDER_MEDIAS), mediaSubjects.pIDMedia.ToString() + ".*");
            if (imageFile.Length > 0)
            {
                litImage.Text = string.Format(@"<a href='javascript:void(0)' onclick=""window.open('/{0}?{1}', 'Banner Image', 'height=515,width=990,top=120,left=10,scrollbars=yes,resizable=yes')"">{2}</a>",
                                              Global.Constants.FOLDER_MEDIAS.Substring(2) + System.IO.Path.GetFileName(imageFile[0]),
                                              DateTime.Now.ToString(),
                                              Farschidus.Translator.AppTranslate["ascx.media.popupLinks.title"]);
            }
        }
    }
Example #10
0
    private void mInitializing()
    {
        MediaSubjects medias = new MediaSubjects();

        medias.LoadByIDSubjectAndIDMediaSubjectType(Subject.pIDSubject, (byte)MediaSubjectTypes.Enum.attachment);
        if (medias.RowCount > 0)
        {
            rptMedia.Visible    = true;
            medias.Sort         = MediaSubjects.ColumnNames.Priority;
            rptMedia.DataSource = medias.DefaultView;
            rptMedia.DataBind();
        }
        else
        {
            rptMedia.Visible = false;
        }
        uplMedia.Update();
    }
Example #11
0
    public string mGetThumbnails(string IDSubject)
    {
        StringBuilder result    = new StringBuilder();
        string        thumbItem = "<li><a href='{0}{1}{2}' rel='lightbox[Thumbnail]'><img src='{3}{4}{5}' style='width: 50px; height: 50px; border:1px solid #555; padding:5px'></a></li>";

        MediaSubjects ThumbNails = new MediaSubjects();

        ThumbNails.LoadByIDSubjectAndIDMediaSubjectType(new Guid(IDSubject), (byte)MediaSubjectTypes.Enum.attachment);
        if (ThumbNails.RowCount > 0)
        {
            result.Append("<ul id='Thumbnails' class='jcarousel-skin-tango'>");
            do
            {
                result.AppendFormat(thumbItem, Global.Constants.FOLDER_MEDIAS.Substring(1), ThumbNails.pIDMedia, ThumbNails.pFileExtention, Global.Constants.FOLDER_THUMBS.Substring(1), ThumbNails.pIDMedia, ThumbNails.pFileExtention);
            }while (ThumbNails.MoveNext());
            result.Append("</ul>");
        }
        return(result.ToString());
    }
Example #12
0
    private void mLoadItems()
    {
        StringBuilder sb        = new StringBuilder();
        Subjects      ListItems = new Subjects();

        ListItems.LoadByIDParentAndIDLanguage(subjectID, language);
        ListItems.Sort = Subjects.ColumnNames.Priority;

        MediaSubjects medias        = new MediaSubjects();
        int           columnCounter = 1;

        do
        {
            if (columnCounter == 1)
            {
                sb.Append("<div class='row'>");
            }

            medias.LoadByIDSubjectAndIDMediaSubjectType(ListItems.pIDSubject, (byte)MediaSubjectTypes.Enum.thumbnail);
            if (medias.RowCount > 0)
            {
                if (generateAjaxUrl)
                {
                    sb.Append(string.Format(item, string.Format(@"javascript:__doPostBack(""{0}"", ""{1}"")", updatePaneClientID, ListItems.pIDSubject.ToString()), mGetImage(medias), ListItems.pTitle));
                }
                else
                {
                    sb.Append(string.Format(item, mGetURL(ListItems.pAlias), mGetImage(medias), ListItems.pTitle));
                }
            }

            if (columnCounter == 3)
            {
                sb.Append("</div>");
                columnCounter = 0;
            }
            columnCounter++;
        }while (ListItems.MoveNext());

        litItems.Text = sb.ToString();
    }
Example #13
0
    private void mLoadItems()
    {
        StringBuilder sb        = new StringBuilder();
        Subjects      ListItems = new Subjects();

        ListItems.LoadByIDParentAndIDLanguage(subjectID, language);
        ListItems.Sort = Subjects.ColumnNames.Date + " DESC";

        MediaSubjects medias = new MediaSubjects();

        sb.Append("<ul class='SideBar-SlideContainer'>");
        do
        {
            medias.LoadByIDSubjectAndIDMediaSubjectType(ListItems.pIDSubject, (byte)MediaSubjectTypes.Enum.thumbnail);
            if (medias.RowCount > 0)
            {
                sb.Append(string.Format(item, mGetURL(ListItems.pAlias), mGetImage(medias), ListItems.pTitle));
            }
        }while (ListItems.MoveNext());
        sb.Append("</ul>");

        litItems.Text = sb.ToString();
    }
Example #14
0
    private void mInitializing(Subjects.BannerTypes bannerType)
    {
        switch (bannerType)
        {
        case Subjects.BannerTypes.inActive:
        {
            imgPageBanner.Visible = false;
            rptGallery.Visible    = false;
            break;
        }

        case Subjects.BannerTypes.picture:
        {
            imgPageBanner.Visible = true;
            rptGallery.Visible    = false;

            MediaSubjects mediaSubject = new MediaSubjects();
            mediaSubject.LoadByIDSubjectAndIDMediaSubjectType(Subject.pIDSubject, (byte)MediaSubjectTypes.Enum.headerImage);
            if (mediaSubject.RowCount > 0)
            {
                string   strImageDestinationFolder = Global.Constants.FOLDER_MEDIAS;
                string[] files = System.IO.Directory.GetFiles(MapPath(strImageDestinationFolder), mediaSubject.pIDMedia.ToString() + ".*");
                if (files.Length > 0)
                {
                    imgPageBanner.ImageUrl = string.Format("{0}{1}", Global.Constants.FOLDER_MEDIAS.Substring(1), System.IO.Path.GetFileName(files[0]));
                }
            }
            break;
        }

        case Subjects.BannerTypes.gallery:
        {
            imgPageBanner.Visible = false;
            rptGallery.Visible    = true;

            Subjects subjectGallery = new Subjects(Subject.pIDGallery);
            if (subjectGallery.RowCount > 0)
            {
                MediaSubjects mediaSubjects = new MediaSubjects();
                mediaSubjects.LoadByIDSubjectAndIDMediaSubjectType(subjectGallery.pIDSubject, (byte)MediaSubjectTypes.Enum.gallery);
                mediaSubjects.Sort = MediaSubjects.ColumnNames.Priority;
                if (mediaSubjects.RowCount > 0)
                {
                    System.Data.DataColumn dc = mediaSubjects.AddColumn("FilePath", Type.GetType("System.String"));
                    do
                    {
                        string[] files = System.IO.Directory.GetFiles(MapPath(Global.Constants.FOLDER_MEDIAS), mediaSubjects.pIDMedia.ToString() + ".*");
                        if (files.Length > 0)
                        {
                            mediaSubjects.SetColumn("FilePath", Global.Constants.FOLDER_MEDIAS.Substring(1) + System.IO.Path.GetFileName(files[0]));
                        }
                    }while (mediaSubjects.MoveNext());
                    mSetGalleryScript();

                    rptGallery.DataSource = mediaSubjects.DefaultView;
                    rptGallery.DataBind();
                }
            }
            break;
        }
        }
        uplBanner.Update();
    }