//上传文件
        public static void UploadFile(string ID, string fileType, string docType, HttpPostedFileBase file)
        {
            if (file != null)
            {
                var fileName = file.FileName;
                var fileID   = System.Guid.NewGuid().ToString();
                var fileEx   = new FileInfo(fileName).Extension;
                var paths    = GetUploadFilePath(fileType, ID, fileID, fileName);

                // 保存文件
                file.SaveAs(paths.FullPath);

                if (IsPicture(fileName))//如果是图片,就保存缩略图
                {
                    // 保存缩略图片
                    Image image = Image.FromStream(file.InputStream);
                    image = PictureUtils.GetHvtThumbnail(image, 200);
                    image.Save(paths.TFullPath);
                }

                // 保存到数据库中
                // 文件ID,门牌记录的ID,图片相对路径,缩略图相对路径,文件名称等
                using (var dbContext = SystemUtils.NewEFDbContext)
                {
                    if (fileType == Enums.UploadFileCategory.HouseBZ)
                    {
                        HOUSEBZOFUPLOADFILES data = new HOUSEBZOFUPLOADFILES();
                        data.ID        = fileID;
                        data.FILENAME  = fileName;
                        data.TYPE      = docType;
                        data.HOUSEBZID = ID;
                        data.FILEEX    = fileEx;
                        data.STATE     = Enums.State.Enable;
                        dbContext.HOUSEBZOFUPLOADFILES.Add(data);
                    }
                    if (fileType == Enums.UploadFileCategory.MPPic)
                    {
                        MPOFUPLOADFILES data = new MPOFUPLOADFILES();
                        data.ID       = fileID;
                        data.FILENAME = fileName;
                        data.TYPE     = Enums.UploadFileCategory.MPPic;
                        data.MPID     = ID;
                        data.FILEEX   = fileEx;
                        data.STATE    = Enums.State.Enable;
                        dbContext.MPOFUPLOADFILES.Add(data);
                    }
                    if (fileType == Enums.UploadFileCategory.RoadPic)
                    {
                        DMOFUPLOADFILES data = new DMOFUPLOADFILES();
                        data.ID       = fileID;
                        data.FILENAME = fileName;
                        data.TYPE     = Enums.UploadFileCategory.RoadPic;
                        data.DMID     = ID;
                        data.FILEEX   = fileEx;
                        data.STATE    = Enums.State.Enable;
                        dbContext.DMOFUPLOADFILES.Add(data);
                    }
                    if (fileType == Enums.UploadFileCategory.HousePic)
                    {
                        DMOFUPLOADFILES data = new DMOFUPLOADFILES();
                        data.ID       = fileID;
                        data.FILENAME = fileName;
                        data.TYPE     = Enums.UploadFileCategory.HousePic;
                        data.DMID     = ID;
                        data.FILEEX   = fileEx;
                        data.STATE    = Enums.State.Enable;
                        dbContext.DMOFUPLOADFILES.Add(data);
                    }
                    dbContext.SaveChanges();
                }
            }
        }