public BaseCaseListViewModel CastModel(BaseCase baseCase)
        {
            BaseCaseListViewModel baseCaseListViewModel = new BaseCaseListViewModel();
            CollateralDAL         collateralDal         = new CollateralDAL();
            SalesManDAL           salesManDal           = new SalesManDAL();

            Framework.DAL.Audit.BaseAuditDAL badit = new Framework.DAL.Audit.BaseAuditDAL();
            var saleGroups = new SalesGroupBll().GetAll().ToList();

            Infrastructure.ExtendTools.ObjectExtend.CopyTo(baseCase, baseCaseListViewModel);
            baseCaseListViewModel.CaseNum = baseCase.NewCaseNum;

            var sale = salesManDal.Get(baseCase.SalesID);

            baseCaseListViewModel.SalesDisplay = sale == null ? "" : sale.Name;

            var firstcoll = collateralDal.FindByCaseID(baseCase.ID).FirstOrDefault(t => t.CollateralType == DictionaryString.CollateralType);

            if (firstcoll != null)
            {
                baseCaseListViewModel.FirstCollateral = string.Format("{0}({1})", firstcoll.Address, firstcoll.BuildingName);
            }

            if (baseCase.NewCaseNum != null && baseCase.Version > 0)
            {
                var audit = badit.GetbyCaseNum(baseCase.NewCaseNum);

                var CaseStatus = audit == null ? "数据不完整" : audit.CaseStatus;
                baseCaseListViewModel.CaseStatus     = CaseStatus == null ? "" : CaseStatus;
                baseCaseListViewModel.CaseStatusText = CaseStatus == null ? "" : Helper.CaseStatusHelper.GetBigStatusText(CaseStatus);
            }
            else if (baseCase.NewCaseNum != null && baseCase.Version == 0)
            {
                baseCaseListViewModel.CaseStatus     = "";
                baseCaseListViewModel.CaseStatusText = "预提交";
            }
            else
            {
                baseCaseListViewModel.CaseStatus = null;
            }

            if (baseCaseListViewModel.SalesGroupID != null)
            {
                baseCaseListViewModel.SalesGroupText = saleGroups.Single(x => x.ID == baseCaseListViewModel.SalesGroupID).Name;
            }

            return(baseCaseListViewModel);
        }
        public BaseAuditViewModel CastModel(BaseAudit model)
        {
            BaseAuditViewModel bcvm = new BaseAuditViewModel();

            Framework.DAL.Audit.BaseAuditDAL baseAuditDal = new Framework.DAL.Audit.BaseAuditDAL();
            var saleGroups = new SalesGroupBll().GetAll().ToList();

            Infrastructure.ExtendTools.ObjectExtend.CopyTo(model, bcvm);
            if (bcvm == null || model == null)
            {
                return(null);
            }
            MortgageBll mortgageBll = new MortgageBll();
            var         mortgage    = mortgageBll.QueryById(model.ID);

            bcvm.OtherFileIsupload = "未上传";
            if (mortgage != null)
            {
                bcvm.OtherFileIsupload = mortgage.OtherFile != "" ? "已上传" : "未上传";
            }
            bcvm.CaseNum = model.NewCaseNum;
            if (model.NewCaseNum != null)
            {
                var caseStatus = baseAuditDal.GetbyCaseNum(model.NewCaseNum).CaseStatus;
                bcvm.CaseStatus     = caseStatus ?? "";
                bcvm.CaseStatusText = caseStatus == null ? "" : Helper.CaseStatusHelper.GetStatsText(caseStatus);
            }
            else
            {
                bcvm.CaseStatusText = "";
            }

            if (bcvm.SalesGroupID != null)
            {
                bcvm.SalesGroupText = saleGroups.Single(x => x.ID == bcvm.SalesGroupID).Name;
            }

            return(bcvm);
        }