private ActionResult PublishHouse(TransferViewHouse house, List<HttpPostedFileBase> facefile, List<HttpPostedFileBase> otherfile, List<HttpPostedFileBase> badfile)
 {
     if (BuildHouse(house, facefile, otherfile, badfile))
     {
         HouseTransferInfo transferhouse = MapperHouse(house);
         transferService.SaveTransferHouse(transferhouse);
         RunJob();
         FxCacheService.FxSite.GlobalCache cache = System.Web.Mvc.DependencyResolver.Current.GetService<FxCacheService.FxSite.GlobalCache>();
         cache.InfoPublishAllCountAdd();
         return View("Success");
     }
     return View("FaildTransfer");
 }
 public ActionResult Properties(TransferViewHouse house,
     List<HttpPostedFileBase> facefile, List<HttpPostedFileBase> otherfile, List<HttpPostedFileBase> badfile)
 {
     return PublishHouse(house, facefile, otherfile, badfile);
 }
        private bool BuildHouse(TransferViewHouse house, List<HttpPostedFileBase> facefile, List<HttpPostedFileBase> otherfile, List<HttpPostedFileBase> badfile)
        {
            InitParas();
            string pictureName;
            string pictureMinName;
            //图片保存到
            #region FaceFile
            foreach (var face in facefile)
            {

                if (face.HasFile())
                {
                    pictureName = GetPictureName();
                    pictureMinName = GetPictureMinName();
                    house.FaceFiles.Add(new TransferPicture()
                    {
                        ImageUrl = GetVirtualPath() + pictureName,
                        CdnUrl = "",
                        TransferPictureCatagroy = (int)PictureCatagroy.Head,
                        PhysicalPath = GetPhysicalPath() + pictureName,
                        MinImageUrl = GetVirtualPath() + pictureMinName,
                    });
                    SaveFile(face, GetPhysicalPath(), GetPhysicalPath() + pictureName);
                }
            }
            #endregion

            #region OtherFile
            foreach (var other in otherfile)
            {
                if (other.HasFile())
                {
                    pictureName = GetPictureName();
                    pictureMinName = GetPictureMinName();
                    house.OtherFiles.Add(new TransferPicture()
                    {
                        ImageUrl = GetVirtualPath() + pictureName,
                        PhysicalPath = GetPhysicalPath() + pictureName,
                        MinImageUrl = GetVirtualPath() + pictureMinName,
                        CdnUrl = "",
                        TransferPictureCatagroy = (int)PictureCatagroy.Other
                    });
                    SaveFile(other, GetPhysicalPath(), GetPhysicalPath() + pictureName);
                }
            }
            #endregion

            #region badFile
            foreach (var bad in badfile)
            {
                if (bad.HasFile())
                {
                    pictureName = GetPictureName();
                    pictureMinName = GetPictureMinName();
                    house.BadFiles.Add(new TransferPicture()
                    {
                        ImageUrl = GetVirtualPath() + pictureName,
                        MinImageUrl = GetVirtualPath() + pictureMinName,
                        CdnUrl = "",
                        TransferPictureCatagroy = (int)PictureCatagroy.Bad,
                        PhysicalPath = GetPhysicalPath() + pictureName
                    });
                    SaveFile(bad, GetPhysicalPath(), GetPhysicalPath() + pictureName);
                }
            }
            #endregion

            return true;
        }
 private HouseTransferInfo MapperHouse(TransferViewHouse house)
 {
     var info = new HouseTransferInfo();
     info.Bill = house.Bill;
     info.HasFurniture = house.HasFurniture;
     info.PostCode = house.PostCode;
     info.RoadName = house.RoadName;
     info.CatagroyId = house.CatagroyId;
     info.AreaId = house.AreaId;
     info.Controller = this.ControllerName;
     info.Action = this.ActionName;
     info.CityId = house.CityId;
     info.Mark = house.Mark;
     info.RoomNumber = house.RoomNumber;
     house.FaceFiles.ForEach(r => info.Pictures.Add(r));
     house.OtherFiles.ForEach(r => info.Pictures.Add(r));
     house.BadFiles.ForEach(r => info.Pictures.Add(r));
     info.Price = (int)house.Price;
     info.PublishTitle = house.Title;
     info.PublishUserEmail = house.Email;
     info.UserAccount = User.Identity.Name;
     return info;
 }