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(); }