Exemple #1
0
        public void SaveCollaterals(ICollection <Collateral> collaterals, string auditId)
        {
            CollateralAuditDAL caDAL = new CollateralAuditDAL();

            foreach (var model in collaterals)
            {
                #region 抵押物信息

                CollateralAudit caModel = new CollateralAudit();
                caModel.ID             = Guid.NewGuid().ToString();
                caModel.AuditID        = auditId;
                caModel.CollateralType = model.CollateralType;
                caModel.HouseNumber    = model.HouseNumber;

                caModel.BuildingName = model.BuildingName;
                caModel.Address      = model.Address;
                caModel.RightOwner   = model.RightOwner;
                caModel.HouseSize    = model.HouseSize;
                caModel.Sequence     = model.Sequence;

                #endregion 抵押物信息

                #region   房屋文件保存

                caModel.HouseFile = SaveFiles(model.HouseFile, caModel.ID, auditId);

                #endregion   房屋文件保存

                caDAL.Add(caModel); //保存抵押物信息
            }
        }
        /// <summary>
        /// 保存抵押物信息
        /// </summary>
        /// <param name="Collaterals"></param>
        /// <param name="auditId"></param>
        public IEnumerable <CollateralAudit> SaveCollaterals(BaseAudit baseAudit, BaseAudit newAudit)
        {
            var collList = new List <CollateralAudit>();

            foreach (var model in baseAudit.CollateralAudits)
            {
                CollateralAudit entity = new CollateralAudit();
                // 抵押物信息
                entity.ID             = Guid.NewGuid().ToString();
                entity.AuditID        = newAudit.ID;
                entity.Address        = model.Address;
                entity.BuildingName   = model.BuildingName;
                entity.CollateralType = model.CollateralType;
                entity.HouseNumber    = model.HouseNumber;
                entity.HouseSize      = model.HouseSize;
                entity.RightOwner     = model.RightOwner;
                entity.Sequence       = model.Sequence;
                entity.CompletionDate = model.CompletionDate;
                entity.LandType       = model.LandType;
                entity.HouseType      = model.HouseType;
                // 上传房屋文件保存
                entity.HouseFile = SaveFiles(model.HouseFile, entity.ID, newAudit.ID);

                //保存房屋明细信息集合
                SaveHouseDetail(baseAudit, newAudit, model, entity);
                collList.Add(entity); //保存抵押物信息
            }
            collateralAuditDAL.AddRange(collList);
            return(collList);
        }
        public CollateralAuditViewModel CastModel(CollateralAudit model)
        {
            var coll   = new CollateralAuditViewModel();
            var dicdal = new DictionaryDAL();

            Com.HSJF.Infrastructure.ExtendTools.ObjectExtend.CopyTo(model, coll);
            coll.CollateralTypeText = dicdal.GetText(model.CollateralType);
            return(coll);
        }
Exemple #4
0
        /// <summary>
        /// 保存抵押物信息
        /// </summary>
        /// <param name="Collaterals"></param>
        /// <param name="auditId"></param>
        public void SaveCollaterals <T>(ICollection <Collateral> collaterals, string auditId)
            where T : class, new()
        {
            var type = typeof(T);

            if (type.Equals(typeof(CollateralAudit)))
            {
                CollateralAuditDAL caDAL = new CollateralAuditDAL();
                foreach (var model in collaterals)
                {
                    #region 抵押物信息

                    CollateralAudit caModel = new CollateralAudit()
                    {
                        ID             = Guid.NewGuid().ToString(),
                        AuditID        = auditId,
                        CollateralType = model.CollateralType,
                        HouseNumber    = model.HouseNumber,
                        BuildingName   = model.BuildingName,
                        Address        = model.Address,
                        RightOwner     = model.RightOwner,
                        HouseSize      = model.HouseSize,
                        Sequence       = model.Sequence,
                        CompletionDate = model.CompletionDate,
                        LandType       = model.LandType,
                        HouseType      = model.HouseType,
                        TotalHeight    = model.TotalHeight
                    };

                    #endregion 抵押物信息

                    #region   房屋文件保存

                    caModel.HouseFile = SaveFiles(model.HouseFile, caModel.ID, auditId);

                    #endregion   房屋文件保存

                    caDAL.Add(caModel); //保存抵押物信息
                }
            }
            else if (type.Equals(typeof(Collateral)))
            {
                CollateralDAL caDAL = new CollateralDAL();
                foreach (var model in collaterals)
                {
                    #region 抵押物信息

                    Collateral caModel = new Collateral()
                    {
                        ID             = Guid.NewGuid().ToString(),
                        CollateralType = model.CollateralType,
                        HouseNumber    = model.HouseNumber,
                        BuildingName   = model.BuildingName,
                        Address        = model.Address,
                        RightOwner     = model.RightOwner,
                        HouseSize      = model.HouseSize,
                        CaseID         = auditId,
                        Sequence       = model.Sequence,
                        CompletionDate = model.CompletionDate,
                        LandType       = model.LandType,
                        HouseType      = model.HouseType,
                        TotalHeight    = model.TotalHeight
                    };

                    #endregion 抵押物信息

                    #region   房屋文件保存

                    caModel.HouseFile = SaveFiles(model.HouseFile, caModel.ID, auditId);

                    #endregion   房屋文件保存

                    caDAL.Add(caModel); //保存抵押物信息
                }
            }
        }
        /// <summary>
        /// 保存房屋明细信息集合
        /// </summary>
        /// <param name="houseDetail"></param>
        /// <param name="auditId"></param>
        public void SaveHouseDetail(BaseAudit baseAudit, BaseAudit newAudit, CollateralAudit oldColl, CollateralAudit newColl)
        {
            var houseList = new List <HouseDetail>();
            var house     = baseAudit.HouseDetails.Where(t => t.CollateralID == oldColl.ID);

            if (!house.Any())
            {
                return;
            }
            foreach (var model in house)
            {
                var entity = new HouseDetail
                {
                    ID               = Guid.NewGuid().ToString(),
                    BaseAuditID      = newAudit.ID,
                    Accout           = model.Accout,
                    AssessedValue    = model.AssessedValue,
                    CompletionDate   = model.CompletionDate,
                    Description      = model.Description,
                    EstimateSources  = model.EstimateSources,
                    HouseType        = model.HouseType,
                    LimitInfo        = model.LimitInfo,
                    LandType         = model.LandType,
                    RepairSituation  = model.RepairSituation,
                    ServiceCondition = model.ServiceCondition,
                    TotalHeight      = model.TotalHeight,
                    Collateral       = model.Collateral,
                    CollateralID     = newColl.ID,
                    Sequence         = model.Sequence,

                    RealHigh          = model.RealHigh,
                    IsDamage          = model.IsDamage,
                    RealResident      = model.RealResident,
                    WaterPaymentCheck = model.WaterPaymentCheck,
                    TaxPaymentCheck   = model.TaxPaymentCheck,
                    Man2Wei1          = model.Man2Wei1,
                    SpecialResident   = model.SpecialResident,
                    OtherDescription  = model.OtherDescription,
                    SchoolInfo        = model.SchoolInfo,
                    HospitalInfo      = model.HospitalInfo,
                    TrafficInfo       = model.TrafficInfo,
                    Supermarket       = model.Supermarket,
                    Recreation        = model.Recreation,
                    NegativeSite      = model.NegativeSite
                };
                // Com.HSJF.Infrastructure.ExtendTools.ObjectExtend.CopyTo(model, entity);

                entity.VillagePhotoFile     = SaveFiles(model.VillagePhotoFile, entity.ID, newAudit.ID);
                entity.MainGatePhotoFile    = SaveFiles(model.MainGatePhotoFile, entity.ID, newAudit.ID);
                entity.ParlourPhotoFile     = SaveFiles(model.ParlourPhotoFile, entity.ID, newAudit.ID);
                entity.BedroomPhotoFile     = SaveFiles(model.BedroomPhotoFile, entity.ID, newAudit.ID);
                entity.KitchenRoomPhotoFile = SaveFiles(model.KitchenRoomPhotoFile, entity.ID, newAudit.ID);
                entity.ToiletPhotoFile      = SaveFiles(model.ToiletPhotoFile, entity.ID, newAudit.ID);

                entity.HousePhotoFile  = SaveFiles(model.HousePhotoFile, entity.ID, newAudit.ID);
                entity.HouseReportFile = SaveFiles(model.HouseReportFile, entity.ID, newAudit.ID);
                houseList.Add(entity);
                SaveEstimateSource(model, entity);
            }
            houseDetailDAL.AddRange(houseList);
        }