Exemple #1
0
        /// <summary>
        /// 绑定相册集
        /// </summary>
        private void BindPictures(TabInfo Article)
        {
            List <String> SelectList = new List <String>();

            if (Article != null && Article.TabID > 0)
            {
                //填充相册集的关系
                List <DNNGo_ThemePlugin_Relationships> Relationships = DNNGo_ThemePlugin_Relationships.FindAllByID(EditTabID, PortalId, FileType);

                RepeaterFields.DataSource = Relationships;
                RepeaterFields.DataBind();

                foreach (DNNGo_ThemePlugin_Relationships Albums in Relationships)
                {
                    SelectList.Add(Albums.FileID.ToString());
                }
            }

            if (Article != null && Article.TabID > 0 && SelectList.Count > 0)
            {
                //绑定所有分类到页面
                QueryParam qp          = new QueryParam();
                int        RecordCount = 0;
                qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.PortalId, PortalId, SearchType.Equal));
                qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.ID, Common.GetStringByList(SelectList), SearchType.In));
                List <DNNGo_ThemePlugin_Multimedia> lst = DNNGo_ThemePlugin_Multimedia.FindAll(qp, out RecordCount);

                //拼接顶级分类的方法
                StringBuilder sb    = new StringBuilder();
                StringBuilder sbIDs = new StringBuilder();
                foreach (String FileID in SelectList)
                {
                    if (lst.Exists(r => r.ID.ToString() == FileID))
                    {
                        DNNGo_ThemePlugin_Multimedia PictureItem = lst.Find(r => r.ID.ToString() == FileID);
                        sb.AppendFormat("<tr data-value='{0}'>", PictureItem.ID).AppendLine();
                        sb.AppendFormat("<td>{0}<br/><img src=\"{1}\" style=\"max-width:120px; margin-right:15px;\"/></td>", PictureItem.FileName, GetPhotoExtension(PictureItem.FileExtension, PictureItem.FilePath)).AppendLine();
                        sb.AppendFormat("<td class=\"center\"><a  data-value='{0}' class=\"btn btn-xs btn-bricky tooltips\" href=\"javascript:;\" data-placement=\"top\" data-original-title=\"Delete\"><i class=\"fa fa-times fa fa-white\"></i></a></td>", PictureItem.ID).AppendLine();
                        sb.Append("</tr>").AppendLine();

                        sbIDs.AppendFormat("{0},", PictureItem.ID);
                    }
                }
                hfPictures.Value = sbIDs.ToString();
                liPictures.Text  = sb.ToString();
            }
        }
        /// <summary>
        /// 根据文章编号查找对象的分类关系
        /// </summary>
        /// <param name="ArticleID">文章编号</param>
        /// <returns></returns>
        public static List <DNNGo_ThemePlugin_Relationships> FindAllByID(Int32 TabID, Int32 PortalId, Int32 FileType)
        {
            Int32      RecordCount = 0;
            QueryParam qp          = new QueryParam();

            qp.OrderType = 0;
            qp.Orderfld  = _.Sort;
            qp.Where.Add(new SearchParam(_.TabID, TabID, SearchType.Equal));
            qp.Where.Add(new SearchParam(_.PortalId, PortalId, SearchType.Equal));

            if (FileType >= 0)
            {
                qp.Where.Add(new SearchParam(_.Type, FileType, SearchType.Equal));
            }

            return(FindAll(qp, out RecordCount));
        }
Exemple #3
0
        /// <summary>
        /// 页面加载需要绑定的方法
        /// </summary>
        public void BindPageLoad()
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.AppendFormat("<ul id=\"{0}\" class=\"{1}\">", SkinClientID, CssClass).AppendLine();

            DNNGo_ThemePlugin_Menu Item = GetGlobalSettings();

            EnumRelationshipsFileType FileType = Token.IndexOf("Breadcrumb", StringComparison.CurrentCultureIgnoreCase) >= 0 ? EnumRelationshipsFileType.Breadcrumb : EnumRelationshipsFileType.Background;
            Boolean isGlobal = (Token.IndexOf("Breadcrumb", StringComparison.CurrentCultureIgnoreCase) >= 0 ? Item.Globals_Breadcrumb : Item.Globals_Background) == 1;

            List <String> FileIDs = new List <String>();
            List <DNNGo_ThemePlugin_Relationships> Relationships = DNNGo_ThemePlugin_Relationships.FindAllViewByID(PortalSettings.ActiveTab.TabID, PortalSettings.PortalId, (Int32)FileType, isGlobal);

            foreach (DNNGo_ThemePlugin_Relationships Relationship in Relationships)
            {
                FileIDs.Add(Relationship.FileID.ToString());
            }


            if (FileIDs != null && FileIDs.Count > 0)
            {
                //绑定所有分类到页面
                QueryParam qp          = new QueryParam();
                int        RecordCount = 0;
                qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.PortalId, PortalSettings.PortalId, SearchType.Equal));
                qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.ID, Common.GetStringByList(FileIDs), SearchType.In));
                List <DNNGo_ThemePlugin_Multimedia> lst = DNNGo_ThemePlugin_Multimedia.FindAll(qp, out RecordCount);

                foreach (String FileID in FileIDs)
                {
                    if (lst.Exists(r => r.ID.ToString() == FileID))
                    {
                        DNNGo_ThemePlugin_Multimedia PictureItem = lst.Find(r => r.ID.ToString() == FileID);
                        if (PictureItem != null && PictureItem.ID > 0)
                        {
                            sb.AppendFormat("<li style=\"background-image:url('{0}')\"></li>", GetPhotoPath(PictureItem.FilePath)).AppendLine();
                        }
                    }
                }
            }


            sb.Append("</ul>").AppendLine();
            liHTML.Text = sb.ToString();
        }
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindDataList()
        {
            QueryParam qp = new QueryParam();

            qp.OrderType = OrderType;
            //if (!String.IsNullOrEmpty(Orderfld))
            //{
            //    qp.Orderfld = Orderfld;
            //}
            //else
            //{
            //    qp.Orderfld = String.Format("{0} desc,{1}", DNNGo_xBlog_Articles._.TopStatus, DNNGo_xBlog_Articles._.ID);
            //}

            #region "分页的一系列代码"


            int RecordCount = 0;
            int pagesize    = qp.PageSize = 9999;
            qp.PageIndex = PageIndex;


            #endregion

            //查询的方法
            qp.Where = BindSearch();

            List <TabInfo> Articles = TabController.GetPortalTabs(PortalId, Null.NullInteger, true, true, false, true);
            Articles.RemoveAt(0);
            qp.RecordCount      = Articles.Count;
            RecordPages         = qp.Pages;
            lblRecordCount.Text = String.Format("{0} {2} / {1} {3}", qp.RecordCount, RecordPages, ViewResourceText("Title_Items", "Items"), ViewResourceText("Title_Pages", "Pages"));


            //增加一个名为Globals的菜单



            Articles.Insert(0, InitGlobalTab());
            gvArticleList.DataSource = Articles;
            gvArticleList.DataBind();
            BindGridViewEmpty <TabInfo>(gvArticleList, new TabInfo());
        }
        public static Int32 Update(Int32 TabID, Int32 PortalId, String PictureIDs, Int32 FileTye)
        {
            Int32 Result = 0;

            //查出当前文章关联的所有分类数据
            List <DNNGo_ThemePlugin_Relationships> CategoryList = FindAllByID(TabID, PortalId, FileTye);

            if (!String.IsNullOrEmpty(PictureIDs))
            {
                //分类编号
                List <String> PictureIDList = WebHelper.GetList(PictureIDs);

                //制造临时变量
                String[] tempPictureIDList = PictureIDList.ToArray();
                PictureIDList.CopyTo(tempPictureIDList);
                DNNGo_ThemePlugin_Relationships[] tempCategoryList = CategoryList.ToArray(); CategoryList.CopyTo(tempCategoryList);

                foreach (String PictureID in tempPictureIDList)
                {
                    //对比当前分类
                    foreach (DNNGo_ThemePlugin_Relationships Picture in tempCategoryList)
                    {
                        if (Picture.FileID.ToString() == PictureID)
                        {
                            //移除两者
                            CategoryList.Remove(Picture);
                            PictureIDList.Remove(PictureID);
                        }
                    }
                }

                //剩下的列表删除
                foreach (String PictureID in PictureIDList)
                {
                    DNNGo_ThemePlugin_Relationships Category = new DNNGo_ThemePlugin_Relationships();
                    Category.FileID   = Convert.ToInt32(PictureID);
                    Category.TabID    = TabID;
                    Category.PortalId = PortalId;
                    Category.Type     = FileTye;

                    QueryParam Sqp = new QueryParam();
                    Sqp.ReturnFields = Sqp.Orderfld = DNNGo_ThemePlugin_Relationships._.Sort;
                    Sqp.OrderType    = 1;
                    Sqp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Relationships._.TabID, TabID, SearchType.Equal));
                    Sqp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Relationships._.PortalId, PortalId, SearchType.Equal));
                    Sqp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Relationships._.Type, FileTye, SearchType.Equal));
                    Category.Sort = Convert.ToInt32(DNNGo_ThemePlugin_Relationships.FindScalar(Sqp)) + 2;
                    Category.Insert();
                    Result += 1;
                }

                //剩下的ID添加
                foreach (DNNGo_ThemePlugin_Relationships Category in CategoryList)
                {
                    Category.Delete();
                    Result += 1;
                }
            }
            else
            {
                //全部删除
                foreach (DNNGo_ThemePlugin_Relationships Category in CategoryList)
                {
                    Category.Delete();
                }
            }

            return(Result);
        }
        public void Execute(BasePage Context)
        {
            QueryParam qp = new QueryParam();

            qp.Orderfld = DNNGo_ThemePlugin_Multimedia._.ID;

            qp.PageIndex = WebHelper.GetIntParam(Context.Request, "PageIndex", 1);
            qp.PageSize  = WebHelper.GetIntParam(Context.Request, "PageSize", Int32.MaxValue);
            qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.Status, (Int32)EnumFileStatus.Approved, SearchType.Equal));
            qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.PortalId, Context.PortalId, SearchType.Equal));

            int RecordCount = 0;
            List <DNNGo_ThemePlugin_Multimedia> fileList = DNNGo_ThemePlugin_Multimedia.FindAll(qp, out RecordCount);

            Dictionary <String, Object> jsonPictures = new Dictionary <string, Object>();

            TemplateFormat       xf           = new TemplateFormat();
            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();


            foreach (var fileItem in fileList)
            {
                int index = fileList.IndexOf(fileItem); //index 为索引值

                Dictionary <String, Object> jsonPicture = new Dictionary <String, Object>();

                jsonPicture.Add("Pages", qp.Pages);


                jsonPicture.Add("ID", fileItem.ID);

                jsonPicture.Add("CreateTime", fileItem.LastTime);

                jsonPicture.Add("Name", WebHelper.leftx(fileItem.Name, 20, "..."));
                jsonPicture.Add("Extension", fileItem.FileExtension);


                String ThumbnailUrl = Context.ViewLinkUrl(String.Format("MediaID={0}", fileItem.ID));
                jsonPicture.Add("ThumbnailUrl", ThumbnailUrl);
                jsonPicture.Add("FileUrl", Context.GetPhotoPath(fileItem.FilePath));

                jsonPicture.Add("Thumbnail", String.Format("<img style=\"border-width:0px; max-height:60px;max-width:80px;\"  src=\"{0}\"  /> ", ThumbnailUrl));
                //判断当前文件是否为图片
                if (!String.IsNullOrEmpty(fileItem.FileExtension) && ("gif,jpg,jpeg,bmp,png").IndexOf(fileItem.FileExtension, StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    jsonPicture.Add("IsVideo", false);
                    jsonPicture.Add("IsPicture", true);
                }
                else if (!String.IsNullOrEmpty(fileItem.FileExtension) && ("mp4,mkv,avi,ogv,webm,m4v").IndexOf(fileItem.FileExtension, StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    jsonPicture.Add("IsVideo", true);
                    jsonPicture.Add("IsPicture", false);


                    switch (fileItem.FileExtension)
                    {
                    case "mp4": jsonPicture.Add("IsMp4", true); break;

                    case "m4v": jsonPicture.Add("IsM4v", true); break;

                    case "ogv": jsonPicture.Add("IsOgv", true); break;

                    case "webm": jsonPicture.Add("IsWebm", true); break;

                    default: break;
                    }
                }
                else if (!String.IsNullOrEmpty(fileItem.FileExtension) && ("flv,swf").IndexOf(fileItem.FileExtension, StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    jsonPicture.Add("IsFlash", true);
                    jsonPicture.Add("IsPicture", false);
                    jsonPicture.Add("Guid", Guid.NewGuid().ToString());
                }
                else
                {
                    jsonPicture.Add("IsVideo", false);
                    jsonPicture.Add("IsPicture", false);
                }

                jsonPicture.Add("Json", jsSerializer.Serialize(jsonPicture));

                jsonPictures.Add(index.ToString(), jsonPicture);
            }

            //转换数据为json

            ResponseString = jsSerializer.Serialize(jsonPictures);
        }
        public Int32 SynchronizeAllFiles(FileInfo SynchronizeFile)
        {
            Int32 SynchronizeFileCount = 0;


            DNNGo_ThemePlugin_Multimedia PhotoItem = new DNNGo_ThemePlugin_Multimedia();

            PhotoItem.ModuleId = ModuleId;
            PhotoItem.PortalId = PortalId;


            PhotoItem.FileName = SynchronizeFile.Name;
            PhotoItem.FileSize = Convert.ToInt32(SynchronizeFile.Length / 1024);
            PhotoItem.FileMate = FileSystemUtils.GetContentType(Path.GetExtension(PhotoItem.FileName).Replace(".", ""));

            PhotoItem.FileExtension = System.IO.Path.GetExtension(PhotoItem.FileName).Replace(".", "");
            PhotoItem.Name          = System.IO.Path.GetFileName(PhotoItem.FileName).Replace(Path.GetExtension(PhotoItem.FileName), "");

            PhotoItem.Status = (Int32)EnumFileStatus.Approved;

            try
            {
                if (("png,gif,jpg,jpeg,bmp").IndexOf(PhotoItem.FileExtension) >= 0)
                {
                    //图片的流
                    System.Drawing.Image image = System.Drawing.Image.FromFile(SynchronizeFile.FullName);
                    PhotoItem.ImageWidth  = image.Width;
                    PhotoItem.ImageHeight = image.Height;

                    PhotoItem.Exif = Common.Serialize <EXIFMetaData.Metadata>(new EXIFMetaData().GetEXIFMetaData(image));
                }
            }
            catch
            {
            }

            PhotoItem.LastTime = xUserTime.UtcTime();
            PhotoItem.LastIP   = WebHelper.UserHost;
            PhotoItem.LastUser = UserInfo.UserID;

            //将文件存储的路径整理好
            String fileName = PhotoItem.Name; //文件名称
            String WebPath  = String.Format("ThemePlugin/uploads/{0}/{1}/{2}/", PhotoItem.LastTime.Year, PhotoItem.LastTime.Month, PhotoItem.LastTime.Day);
            //检测文件存储路径是否有相关的文件
            FileInfo fInfo = new FileInfo(HttpContext.Current.Server.MapPath(String.Format("{0}{1}{2}.{3}", PortalSettings.HomeDirectory, WebPath, fileName, PhotoItem.FileExtension)));

            //检测文件夹是否存在
            if (!System.IO.Directory.Exists(fInfo.Directory.FullName))
            {
                System.IO.Directory.CreateDirectory(fInfo.Directory.FullName);
            }
            else
            {
                Int32 j = 1;
                while (fInfo.Exists)
                {
                    //文件已经存在了
                    fileName = String.Format("{0}_{1}", PhotoItem.Name, j);
                    fInfo    = new FileInfo(HttpContext.Current.Server.MapPath(String.Format("{0}{1}{2}.{3}", PortalSettings.HomeDirectory, WebPath, fileName, PhotoItem.FileExtension)));
                    j++;
                }
            }

            PhotoItem.FilePath = String.Format("{0}{1}.{2}", WebPath, fileName, PhotoItem.FileExtension);
            PhotoItem.FileName = String.Format("{0}.{1}", fileName, PhotoItem.FileExtension);

            try
            {
                if (!fInfo.Directory.Exists)
                {
                    fInfo.Directory.Create();
                }
                //异步移动文件到文件夹中
                List <String> SynchronizeFileQueue = new List <string>();
                SynchronizeFileQueue.Add(SynchronizeFile.FullName);
                SynchronizeFileQueue.Add(fInfo.FullName);
                ManagedThreadPool.QueueUserWorkItem(new WaitCallback(ThreadMoveTo), SynchronizeFileQueue);
            }
            catch (Exception ex)
            {
            }

            //给上传的相片设置初始的顺序
            QueryParam qp = new QueryParam();

            qp.ReturnFields = qp.Orderfld = DNNGo_ThemePlugin_Multimedia._.Sort;
            qp.OrderType    = 1;
            qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.PortalId, PhotoItem.PortalId, SearchType.Equal));
            PhotoItem.Sort = Convert.ToInt32(DNNGo_ThemePlugin_Multimedia.FindScalar(qp)) + 2;
            Int32 PhotoId = PhotoItem.Insert();

            if (PhotoId > 0)
            {
                SynchronizeFileCount++;
            }


            return(SynchronizeFileCount);
        }
Exemple #8
0
        public void Execute(BasePage Context)
        {
            JavaScriptSerializer        jsSerializer = new JavaScriptSerializer();
            Dictionary <String, Object> jsonPanes    = new Dictionary <string, Object>();

            Int32 EditTabID = WebHelper.GetIntParam(Context.Request, "EditTabID", 0);


            Int32      Record = 0;
            QueryParam qp     = new QueryParam();

            qp.Orderfld  = DNNGo_ThemePlugin_MenuPane._.Sort;
            qp.OrderType = 0;

            qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_MenuPane._.PortalId, Context.PortalId, SearchType.Equal));
            qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_MenuPane._.TabID, EditTabID, SearchType.Equal));

            List <DNNGo_ThemePlugin_MenuPane> MenuPanes = DNNGo_ThemePlugin_MenuPane.FindAll(qp, out Record);

            foreach (var MenuPane in MenuPanes)
            {
                if (MenuPane != null && MenuPane.ID > 0)
                {
                    //Dictionary<String, Object> jsonPane = new Dictionary<string, Object>();

                    //foreach (var Field in DNNGo_ThemePlugin_MenuPane.Meta.Fields)
                    //{
                    //    jsonPane.Add(Field.ColumnName, MenuPane[Field.ColumnName]);
                    //}
                    //筛选出列记录的选项集合
                    if (!String.IsNullOrEmpty(MenuPane.Options))
                    {
                        //List<KeyValueEntity> Options = MenuPane.SettingItems;
                    }


                    //查找当前容器下所有的行数据
                    QueryParam qpRows = new QueryParam();
                    qpRows.Where.Add(new SearchParam(DNNGo_ThemePlugin_MenuRowItem._.PortalId, Context.PortalId, SearchType.Equal));
                    qpRows.Where.Add(new SearchParam(DNNGo_ThemePlugin_MenuRowItem._.PaneID, MenuPane.ID, SearchType.Equal));
                    qpRows.Orderfld  = DNNGo_ThemePlugin_MenuRowItem._.Sort;
                    qpRows.OrderType = 0;

                    List <DNNGo_ThemePlugin_MenuRowItem> MenuRows = DNNGo_ThemePlugin_MenuRowItem.FindAll(qpRows, out Record);

                    MenuPane.Rows = MenuRows;


                    //Dictionary<String, Object> jsonRows = new Dictionary<string, Object>();
                    //foreach (var MenuRow in MenuRows)
                    //{
                    //    if (MenuRow != null && MenuRow.ID > 0)
                    //    {
                    //        Dictionary<String, Object> jsonRow = new Dictionary<string, Object>();

                    //        foreach (var RowField in DNNGo_ThemePlugin_MenuRowItem.Meta.Fields)
                    //        {
                    //            jsonRow.Add(RowField.ColumnName, MenuRow[RowField.ColumnName]);
                    //        }
                    //        //筛选出行记录的选项集合
                    //        if (!String.IsNullOrEmpty(MenuRow.Options))
                    //        {

                    //        }


                    //        jsonRows.Add( MenuRow.ID.ToString(), jsonRow);
                    //    }
                    //}

                    //jsonPane.Add("Rows", jsonRows);


                    //jsonPanes.Add( MenuPane.ID.ToString(), jsonPane);
                }
            }
            //转换数据为json
            ResponseString = MenuPanes.ToJson();
        }
Exemple #9
0
        // Upload entire file
        private void UploadWholeFile(HttpContext context, List <Resource_FilesStatus> statuses)
        {
            for (int i = 0; i < context.Request.Files.Count; i++)
            {
                var file = context.Request.Files[i];

                if (file != null && !String.IsNullOrEmpty(file.FileName) && file.ContentLength > 0)
                {
                    //To verify that if the suffix name of the uploaded files meets the DNN HOST requirements
                    bool Valid = FileSystemUtils.CheckValidFileName(file.FileName);
                    if (Valid)
                    {
                        DNNGo_ThemePlugin_Multimedia PhotoItem = new DNNGo_ThemePlugin_Multimedia();

                        PhotoItem.ModuleId = WebHelper.GetIntParam(context.Request, "ModuleId", 0);
                        PhotoItem.PortalId = WebHelper.GetIntParam(context.Request, "PortalId", 0);


                        PhotoItem.FileName = file.FileName;
                        PhotoItem.FileSize = file.ContentLength / 1024;
                        PhotoItem.FileMate = FileSystemUtils.GetContentType(Path.GetExtension(PhotoItem.FileName).Replace(".", ""));

                        PhotoItem.FileExtension = System.IO.Path.GetExtension(PhotoItem.FileName).Replace(".", "");
                        PhotoItem.Name          = System.IO.Path.GetFileName(file.FileName).Replace(Path.GetExtension(PhotoItem.FileName), "");
                        PhotoItem.Status        = (Int32)EnumFileStatus.Approved;

                        try
                        {
                            if (("png,gif,jpg,jpeg,bmp").IndexOf(PhotoItem.FileExtension) >= 0)
                            {
                                //图片的流
                                Image image = Image.FromStream(file.InputStream);
                                PhotoItem.ImageWidth  = image.Width;
                                PhotoItem.ImageHeight = image.Height;

                                PhotoItem.Exif = Common.Serialize <EXIFMetaData.Metadata>(new EXIFMetaData().GetEXIFMetaData(image));
                            }
                        }
                        catch
                        {
                        }

                        PhotoItem.LastTime = xUserTime.UtcTime();
                        PhotoItem.LastIP   = WebHelper.UserHost;
                        PhotoItem.LastUser = UserInfo.UserID;


                        //将文件存储的路径整理好
                        String fileName = System.IO.Path.GetFileName(file.FileName).Replace("." + PhotoItem.FileExtension, ""); //文件名称
                        String WebPath  = String.Format("ThemePlugin/uploads/{0}/{1}/{2}/", PhotoItem.LastTime.Year, PhotoItem.LastTime.Month, PhotoItem.LastTime.Day);
                        //检测文件存储路径是否有相关的文件
                        FileInfo fInfo = new FileInfo(HttpContext.Current.Server.MapPath(String.Format("{0}{1}{2}.{3}", PortalSettings.HomeDirectory, WebPath, fileName, PhotoItem.FileExtension)));

                        //检测文件夹是否存在
                        if (!System.IO.Directory.Exists(fInfo.Directory.FullName))
                        {
                            System.IO.Directory.CreateDirectory(fInfo.Directory.FullName);
                        }
                        else
                        {
                            Int32 j = 1;
                            while (fInfo.Exists)
                            {
                                //文件已经存在了
                                fileName = String.Format("{0}_{1}", PhotoItem.Name, j);
                                fInfo    = new FileInfo(HttpContext.Current.Server.MapPath(String.Format("{0}{1}{2}.{3}", PortalSettings.HomeDirectory, WebPath, fileName, PhotoItem.FileExtension)));
                                j++;
                            }
                        }

                        PhotoItem.FilePath = String.Format("{0}{1}.{2}", WebPath, fileName, PhotoItem.FileExtension);
                        PhotoItem.FileName = String.Format("{0}.{1}", fileName, PhotoItem.FileExtension);
                        try
                        {
                            if (!fInfo.Directory.Exists)
                            {
                                fInfo.Directory.Create();

                                // FileSystemUtils.AddFolder(PortalSettings, String.Format("{0}DNNGo_PhotoAlbums/{0}/{1}/"), String.Format("{0}DNNGo_PhotoAlbums/{0}/{1}/"), (int)DotNetNuke.Services.FileSystem.FolderController.StorageLocationTypes.InsecureFileSystem);
                            }

                            //构造指定存储路径
                            file.SaveAs(fInfo.FullName);
                            //FileSystemUtils.AddFile(PhotoItem.FileName, PhotoItem.PortalId, String.Format("DNNGo_PhotoAlbums\\{0}\\{1}\\", PhotoItem.ModuleId, PhotoItem.AlbumID), PortalSettings.HomeDirectoryMapPath, PhotoItem.FileMeta);
                        }
                        catch (Exception ex)
                        {
                        }

                        //给上传的相片设置初始的顺序
                        QueryParam qp = new QueryParam();
                        qp.ReturnFields = qp.Orderfld = DNNGo_ThemePlugin_Multimedia._.Sort;
                        qp.OrderType    = 1;
                        qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.PortalId, PhotoItem.PortalId, SearchType.Equal));
                        PhotoItem.Sort = Convert.ToInt32(DNNGo_ThemePlugin_Multimedia.FindScalar(qp)) + 2;
                        Int32 PhotoId = PhotoItem.Insert();



                        statuses.Add(new Resource_FilesStatus(PhotoItem, PortalSettings, ModulePath));
                    }
                }
            }
        }