/// <summary> /// This method only should be used in MajorLease(Create) or Rebuild(Package) /// </summary> public void Append() { using (TransactionScope tranScope = new TransactionScope()) { if (this.Id == Guid.Empty) { this.Id = Guid.NewGuid(); } if (!ProjectContractInfo.Any(e => e.ProjectId == this.ProjectId)) { var contract = StoreContractInfo.GetCurrentContract(this.ProjectId); Mapper.CreateMap <StoreContractInfo, ProjectContractInfo>(); var projContract = Mapper.Map <ProjectContractInfo>(contract); projContract.ContractInfoId = contract.Id; if (!string.IsNullOrEmpty(contract.BGCommencementDate)) { projContract.BGCommencementDate = DateTime.Parse(contract.BGCommencementDate); } if (!string.IsNullOrEmpty(contract.BGEndDate)) { projContract.BGEndDate = DateTime.Parse(contract.BGEndDate); } projContract.Id = Guid.NewGuid(); projContract.ProjectId = this.ProjectId; projContract.Add(); } var revisions = ProjectContractRevision.Get(this.ProjectId, this.ProjectContractId); var oldRev = revisions.FirstOrDefault(e => e.ProjectId == this.ProjectId); if (oldRev == null) { revisions.Add(this); } else { oldRev.ChangeDate = this.ChangeDate; oldRev.Description = this.Description; oldRev.Entity = this.Entity; oldRev.LandlordNew = this.LandlordNew; oldRev.LandlordOld = this.LandlordOld; oldRev.LeaseTerm = this.LeaseTerm; oldRev.LeaseChangeExpiryNew = this.LeaseChangeExpiryNew; oldRev.LeaseChangeExpiryOld = this.LeaseChangeExpiryOld; oldRev.Others = this.Others; oldRev.OthersDescription = this.OthersDescription; oldRev.Rent = this.Rent; oldRev.RentStructureNew = this.RentStructureNew; oldRev.RentStructureOld = this.RentStructureOld; oldRev.Size = this.Size; oldRev.RedlineAreaNew = this.RedlineAreaNew; oldRev.RedlineAreaOld = this.RedlineAreaOld; } revisions.ForEach(r => r.Save()); tranScope.Complete(); } }
public StoreContractInfo ToStoreContractInfo() { StoreContractInfo contract = new StoreContractInfo(); contract.Id = this.ContractInfoId; contract.StoreID = this.StoreId; contract.StoreCode = this.StoreCode; contract.LeaseRecapID = this.LeaseRecapID; contract.PartyAFullName = this.PartyAFullName; contract.McDLegalEntity = this.McDLegalEntity; contract.McDOwnership = this.McDOwnership; contract.ContactPerson = this.ContactPerson; contract.ContactMode = this.ContactMode; contract.RentType = this.RentType; contract.TotalLeasedArea = this.TotalLeasedArea; contract.LeasePurchaseTerm = this.LeasePurchaseTerm; contract.LeasePurchase = this.LeasePurchase; contract.StartDate = this.StartDate; contract.StartYear = this.StartYear; contract.RentCommencementDate = this.RentCommencementDate; contract.EndDate = this.EndDate; contract.EndYear = this.EndYear; contract.DeadlineToNotice = this.DeadlineToNotice; contract.Changedafter2010 = this.Changedafter2010; contract.RentStructure = this.RentStructure; contract.WithEarlyTerminationClause = this.WithEarlyTerminationClause; contract.EarlyTerminationClauseDetail = this.EarlyTerminationClauseDetail; contract.RentalPaidto = this.RentalPaidto; contract.RentPaymentArrangement = this.RentPaymentArrangement; contract.HasDeposit = this.HasDeposit; contract.DepositAmount = this.DepositAmount; contract.Refundable = this.Refundable; contract.RefundableDate = this.RefundableDate; contract.WithPenaltyClause = this.WithPenaltyClause; contract.HasBankGuarantee = this.HasBankGuarantee; contract.BGNumber = this.BGNumber; contract.BGAmount = this.BGAmount; contract.BGCommencementDate = this.BGCommencementDate.HasValue ? this.BGCommencementDate.Value.ToString("yyyy-MM-dd") : ""; contract.BGEndDate = this.BGEndDate.HasValue ? this.BGEndDate.Value.ToString("yyyy-MM-dd") : ""; contract.FilePath = this.FilePath; contract.OverallAccessibility = this.OverallAccessibility; contract.RentSupervalueDay = this.RentSupervalueDay; contract.Keyword3 = this.Keyword3; contract.Remarks = this.Remarks; contract.CreatedTime = this.CreatedTime; contract.LastEditTime = this.LastEditTime; contract.FreeRentalPeriod = this.FreeRentalPeriod; contract.ExclusivityClause = this.ExclusivityClause; return(contract); }
public void GenerateCover() { if (!Attachment.Any(att => att.RefTableID == this.Id.ToString() && att.RequirementId == new Guid("9D1E247C-AAE0-44F6-869E-F50B3E633C1C"))) { var info = RenewalInfo.Get(this.ProjectId); var store = StoreBasicInfo.GetStorInfo(info.USCode); var contract = StoreContractInfo.Get(info.USCode); var context = HttpContext.Current; var templateFileName = context.Server.MapPath("~/Template/RenewalCover_Template_v20130922.xlsx"); var fileName = context.Server.MapPath(string.Format("~/UploadFiles/{0}.xlsx", Guid.NewGuid())); File.Copy(templateFileName, fileName); var fileInfo = new FileInfo(fileName); ExcelDataInputDirector excelDirector = new ExcelDataInputDirector(fileInfo, ExcelDataInputType.RenewalCover); ExcelInputDTO excelInput = new ExcelInputDTO(); excelInput.Region = store.RegionENUS; excelInput.Province = store.ProvinceZHCN; excelInput.City = store.CityENUS; excelInput.Market = store.MarketENUS; excelInput.StoreName = store.NameZHCN; excelInput.USCode = store.StoreCode; excelInput.OpenDate = store.OpenDate; excelInput.LeaseExpirationDate = contract.EndDate.Value; excelInput.Priority = info.Priority; excelDirector.Input(excelInput); var att = new Attachment(); att.ID = Guid.NewGuid(); att.RefTableID = this.Id.ToString(); att.RefTableName = this.TableName; att.RelativePath = "/"; att.TypeCode = "Cover"; att.RequirementId = Guid.Parse("9D1E247C-AAE0-44F6-869E-F50B3E633C1C"); att.Name = "Cover"; att.Extension = fileInfo.Extension; att.InternalName = fileInfo.Name; att.ContentType = "application/vnd.ms-excel"; att.Length = (int)fileInfo.Length; att.CreatorID = ClientCookie.UserCode; att.CreatorNameENUS = ClientCookie.UserNameENUS; att.CreatorNameZHCN = ClientCookie.UserNameZHCN; att.CreateTime = DateTime.Now; att.Add(); } }
public static ProjectContractInfo Get(string projectId) { var contract = FirstOrDefault(c => c.ProjectId == projectId); if (contract == null) { var storeContract = StoreContractInfo.GetCurrentContract(projectId); Mapper.CreateMap <StoreContractInfo, ProjectContractInfo>(); contract = Mapper.Map <ProjectContractInfo>(storeContract); contract.ContractInfoId = storeContract.Id; if (!string.IsNullOrEmpty(storeContract.BGCommencementDate)) { contract.BGCommencementDate = DateTime.Parse(storeContract.BGCommencementDate); } if (!string.IsNullOrEmpty(storeContract.BGEndDate)) { contract.BGEndDate = DateTime.Parse(storeContract.BGEndDate); } contract.Id = Guid.NewGuid(); contract.ProjectId = projectId; } return(contract); }
public static ProjectContractDto GetContractWithHistory(string projectId) { var contract = Search(c => c.ProjectId == projectId).OrderByDescending(c => c.CreatedTime).FirstOrDefault(c => c.ProjectId == projectId); if (contract == null) { var storeContract = StoreContractInfo.GetCurrentContract(projectId); Mapper.CreateMap <StoreContractInfo, ProjectContractInfo>(); contract = Mapper.Map <ProjectContractInfo>(storeContract); contract.ContractInfoId = storeContract.Id; contract.Id = Guid.NewGuid(); //if (contract.McDLegalEntity != null && contract.McDLegalEntity.StartsWith("suoya")) // contract.McDLegalEntity = Dictionary.Search(d => d.Value == contract.McDLegalEntity).FirstOrDefault().NameZHCN; //if (contract.McDOwnership != null && contract.McDOwnership.StartsWith("suoya")) // contract.McDOwnership = Dictionary.Search(d => d.Value == contract.McDOwnership).FirstOrDefault().NameZHCN; //if (contract.LeasePurchase != null && contract.LeasePurchase.StartsWith("suoya")) // contract.LeasePurchase = Dictionary.Search(d => d.Value == contract.LeasePurchase).FirstOrDefault().NameZHCN; //if (contract.RentPaymentArrangement != null && contract.RentPaymentArrangement.StartsWith("suoya")) // contract.RentPaymentArrangement = Dictionary.Search(d => d.Value == contract.RentPaymentArrangement).FirstOrDefault().NameZHCN; contract.ProjectId = projectId; } var histories = StoreContractInfo.SearchByProject(projectId).Skip(1).ToList().Select(c => { Mapper.CreateMap <StoreContractInfo, ProjectContractInfo>(); var history = Mapper.Map <ProjectContractInfo>(c); history.ContractInfoId = c.Id; history.ProjectId = projectId; return(history); }).ToList(); return(new ProjectContractDto { Current = contract, Histories = histories }); }
public string DownloadToolTemplate() { var templateFileName = string.Concat(SiteFilePath.Template_DIRECTORY, "/", SiteFilePath.RenewalTool_Template); string fileName = string.Format("{0}/{1}.xlsx", SiteFilePath.TEMP_DIRECTORY, Guid.NewGuid()); File.Copy(templateFileName, fileName); FileInfo fileInfo = new FileInfo(fileName); ExcelDataInputDirector excelDirector = new ExcelDataInputDirector(fileInfo, ExcelDataInputType.RenewalTool); ExcelInputDTO excelDto = new ExcelInputDTO(); var info = RenewalInfo.Get(this.ProjectId); var storeBasic = StoreBasicInfo.GetStorInfo(info.USCode); var storeContract = StoreContractInfo.Get(info.USCode); var finInput = RenewalToolFinMeasureInput.Get(this.ProjectId, this.Id); var wfAndReinCost = RenewalToolWriteOffAndReinCost.Get(this.ProjectId, this.Id); excelDto.USCode = info.USCode; excelDto.Market = storeBasic.Market; excelDto.StoreName = storeBasic.NameZHCN + "/" + storeBasic.NameENUS; excelDto.OpenDate = storeBasic.OpenDate; if (storeContract.EndDate.HasValue) { excelDto.LeaseExpirationDate = storeContract.EndDate.Value; } excelDto.RenewalYears = info.RenewalYears; excelDto.ProductSales = finInput.ProductSalesAdjustment; excelDto.Pac = finInput.PacAdjustment; excelDto.Rent = finInput.RentAdjustment; excelDto.DepreciationLhi = finInput.DepreciationLhiAdjustment; excelDto.InterestLhi = finInput.InterestLhiAdjustment; excelDto.ServiceFee = finInput.ServiceFeeAdjustment; excelDto.Accounting = finInput.AccountingAdjustment; excelDto.Insurance = finInput.InsuranceAdjustment; excelDto.TaxesAndLicenses = finInput.TaxesAndLicensesAdjustment; excelDto.DepreciationEssd = finInput.DepreciationEssdAdjustment; excelDto.InterestEssd = finInput.InterestEssdAdjustment; excelDto.OtherIncExp = finInput.OtherIncExpAdjustment; excelDto.NonProductSales = finInput.NonProductSalesAdjustment; excelDto.NonProductCosts = finInput.NonProductCostsAdjustment; excelDto.REII = wfAndReinCost.REII; excelDto.LHIII = wfAndReinCost.LHIII; excelDto.ESSDII = wfAndReinCost.ESSDII; excelDto.RENBV = wfAndReinCost.RENBV; if (wfAndReinCost.LHINBV.HasValue) { excelDto.LHINBV = wfAndReinCost.LHINBV.Value; } if (wfAndReinCost.ESSDNBV.HasValue) { excelDto.ESSDNBV = wfAndReinCost.ESSDNBV.Value; } excelDto.RECost = wfAndReinCost.RECost; excelDto.LHICost = wfAndReinCost.LHICost; excelDto.ESSDCost = wfAndReinCost.ESSDCost; excelDto.TotalWriteOff = wfAndReinCost.REWriteOff + wfAndReinCost.LHIWriteOff + wfAndReinCost.ESSDWriteOff; excelDto.RentalStructure = !string.IsNullOrEmpty(finInput.RentalStructure) ? (Nullable <decimal>)decimal.Parse(finInput.RentalStructure) : null; excelDto.ContributionMargin = finInput.ContributionMargin; excelDto.SalesCompYr1 = finInput.SalesCompYr1; excelDto.SalesCompYr2 = finInput.SalesCompYr2; excelDto.SalesCompYr3 = finInput.SalesCompYr3; excelDto.SalesCompYr4 = finInput.SalesCompYr4; excelDto.SalesCompYr5 = finInput.SalesCompYr5; excelDto.SalesCompYr6 = finInput.SalesCompYr6; excelDto.SalesCompYr7 = finInput.SalesCompYr7; excelDto.SalesCompYr8 = finInput.SalesCompYr8; excelDto.SalesCompYr9 = finInput.SalesCompYr9; excelDto.SalesCompYr10 = finInput.SalesCompYr10; excelDto.SalesCompYr11 = finInput.SalesCompYr11; excelDto.SalesCompYr12 = finInput.SalesCompYr12; excelDto.SalesCompYr13 = finInput.SalesCompYr13; excelDto.SalesCompYr14 = finInput.SalesCompYr14; excelDto.SalesCompYr15 = finInput.SalesCompYr15; excelDto.SalesCompYr16 = finInput.SalesCompYr16; excelDto.SalesCompYr17 = finInput.SalesCompYr17; excelDto.SalesCompYr18 = finInput.SalesCompYr18; excelDto.SalesCompYr19 = finInput.SalesCompYr19; excelDto.SalesCompYr20 = finInput.SalesCompYr20; excelDto.ComSalesDesc = this.ComSalesDesc; excelDto.CompSales = finInput.CompSalesAdjustment; excelDto.FinanceYear = finInput.FinanceYear; excelDto.FinanceMonth = finInput.FinanceMonth; excelDirector.Input(excelDto); return(fileName); }
public static StoreInfo GetStore(string usCode) { string _USCode = usCode; List <StoreBasicInfo> lsStoreBasicInfo = new List <StoreBasicInfo>(); StoreBasicInfo mStoreBasicInfo = new StoreBasicInfo(); lsStoreBasicInfo = StoreBasicInfo.Search(o => o.StoreCode.Contains(_USCode)).AsNoTracking().ToList <StoreBasicInfo>(); if (lsStoreBasicInfo.Count > 0) { mStoreBasicInfo = lsStoreBasicInfo[0]; } List <StoreDevelop> lsStoreDevelop = new List <StoreDevelop>(); StoreDevelop mStoreDevelop = new StoreDevelop(); lsStoreDevelop = StoreDevelop.Search(o => o.StoreCode.Contains(_USCode)).AsNoTracking().ToList <StoreDevelop>(); if (lsStoreDevelop.Count > 0) { mStoreDevelop = lsStoreDevelop[0]; } List <StoreOps> lsStoreOp = new List <StoreOps>(); StoreOps mStoreOp = new StoreOps(); lsStoreOp = StoreOps.Search(o => o.StoreCode.Contains(_USCode)).AsNoTracking().ToList <StoreOps>(); if (lsStoreOp.Count > 0) { mStoreOp = lsStoreOp[0]; } List <StoreContractInfo> lsStoreContractInfo = new List <StoreContractInfo>(); StoreContractInfo mStoreContractInfo = new StoreContractInfo(); lsStoreContractInfo = StoreContractInfo.Search(o => o.StoreCode.Contains(_USCode)).AsNoTracking() .OrderByDescending(o => o.CreatedTime).ToList <StoreContractInfo>(); if (lsStoreContractInfo.Count > 0) { mStoreContractInfo = lsStoreContractInfo[0]; } List <StoreSTLocation> lsStoreSTLocation = new List <StoreSTLocation>(); StoreSTLocation mStoreSTLocation = new StoreSTLocation(); lsStoreSTLocation = StoreSTLocation.Search(o => o.StoreCode.Contains(_USCode)).AsNoTracking().ToList <StoreSTLocation>(); if (lsStoreSTLocation.Count > 0) { mStoreSTLocation = lsStoreSTLocation[0]; } List <StoreSTLLRecord> lsStoreSTLLRecord = new List <StoreSTLLRecord>(); StoreSTLLRecord mStoreSTLLRecord = new StoreSTLLRecord(); lsStoreSTLLRecord = StoreSTLLRecord.Search(o => o.StoreCode.Contains(_USCode)).AsNoTracking().ToList <StoreSTLLRecord>(); if (lsStoreSTLLRecord.Count > 0) { mStoreSTLLRecord = lsStoreSTLLRecord[0]; } int?beId = StoreBEInfo.Search(o => o.StoreCode.Contains(_USCode)).AsNoTracking().Select(be => be.BEID).FirstOrDefault(); StoreBEContractInfo storeBeContractInfo = StoreBEContractInfo.FirstOrDefault(c => c.BEID == beId); //StoreContractRevision = new StoreContractRevision(), // StoreContractInfoAttached = new StoreContractInfoAttached() var lsStoreBEInfo = StoreBEInfo.Search(o => o.StoreCode == _USCode).AsNoTracking().ToList <StoreBEInfo>(); List <StoreBEInfo> remoteBeList = new List <StoreBEInfo>(); List <StoreBEInfo> attachedBeList = new List <StoreBEInfo>(); List <StoreBEInfo> mdsList = new List <StoreBEInfo>(); List <StoreBEInfo> mcCafeList = new List <StoreBEInfo>(); List <StoreBEInfo> hour24List = new List <StoreBEInfo>(); if (lsStoreBEInfo.Count > 0) { foreach (var beInfo in lsStoreBEInfo) { switch (beInfo.BETypeName) { case "Remote Kiosk": remoteBeList.Add(beInfo); break; case "Attached Kiosk": attachedBeList.Add(beInfo); break; case "MDS": mdsList.Add(beInfo); break; case "McCafe": mcCafeList.Add(beInfo); break; case "24 Hour": hour24List.Add(beInfo); break; } } } var resultStoreAllInfo = new StoreInfo { StoreBasicInfo = mStoreBasicInfo, StoreDevelop = mStoreDevelop, StoreOp = mStoreOp, StoreContractInfo = mStoreContractInfo, StoreSTLocation = mStoreSTLocation, StoreSTLLRecord = mStoreSTLLRecord, StoreBeContractInfo = storeBeContractInfo, StoreBEInfoList = lsStoreBEInfo, CurrentYear = DateTime.Now.Year, RemoteBeCount = remoteBeList.Count, AttachedBeCount = attachedBeList.Count, MDSBeCount = mdsList.Count, MCCafeCount = mcCafeList.Count, Hour24Count = hour24List.Count }; return(resultStoreAllInfo); }
private static RenewalAnalysisStoreInfo PrepareStoreInfo(string projectId, string usCode) { var store = StoreBasicInfo.GetStorInfo(usCode); var storeMMInfo = StoreMMInfo.Get(usCode); var storeContract = StoreContractInfo.Get(usCode); var ta = StoreSTLocation.GetStoreSTLocation(usCode); var tool = RenewalTool.Get(projectId); var finOutput = RenewalToolFinMeasureOutput.GetByToolId(tool.Id) ?? new RenewalToolFinMeasureOutput(); var consInfo = RenewalConsInfo.Get(projectId); var toolWriteOff = RenewalToolWriteOffAndReinCost.Get(projectId, tool.Id); var floors = string.Join("/", new[] { string.Join(",", new[] { ta.Floor1, ta.Floor2, ta.Floor3, ta.Floor4, ta.Floor5 }.Where(e => !string.IsNullOrEmpty(e)).ToArray()), string.Join(",", new[] { ta.FrontCounterFloor1, ta.FrontCounterFloor2 }.Where(e => !string.IsNullOrEmpty(e)).ToArray()) }.Where(e => !string.IsNullOrEmpty(e)).ToArray()); var seats = string.Join("/", new[] { new[] { ta.Seats1, ta.Seats2, ta.Seats3, ta.Seats4, ta.Seats5, ta.FrontCounterSeats }.Select(e => { var val = 0; int.TryParse(e, out val); return(val); }).Sum(), string.IsNullOrEmpty(ta.OutsideSeats)?0:int.Parse(ta.OutsideSeats) }); var beTypes = string.Join(",", StoreBEInfo.Search(e => e.StoreCode == usCode && e.BETypeName != "FC" && e.BETypeName != "DT").Select(e => e.BETypeName).ToArray()); var leaseTenureAndTerm = string.Concat(storeContract.LeasePurchaseTerm, " years,from ", storeContract.StartDate.HasValue ? storeContract.StartDate.Value.ToString("yyyy-MM-dd") : " / ", "to", storeContract.EndDate.HasValue ? storeContract.EndDate.Value.ToString("yyyy-MM-dd") : " / " ); return(new RenewalAnalysisStoreInfo { UsCode = store.StoreCode, NameZHCN = store.NameZHCN, NameENUS = store.NameENUS, MinimarketPriority = storeMMInfo.Priority, TADesrability = storeMMInfo.Desirability, SitePortfolioType = storeMMInfo.PortfolioTypeName, SiteRerating = storeMMInfo.LocationRatingPP, LeasedArea = storeContract.TotalLeasedArea, OperationSize = ta.TotalArea, Floors = floors, Seats = seats, BEType = beTypes, LeaseTenureAndTerm = leaseTenureAndTerm, FreeRentalPeriod = storeContract.FreeRentalPeriod, RentStructure = storeContract.RentStructure, DRMFLastTY = finOutput.AnnualRentExpenseLY, DRMFLastTYSales = finOutput.RentAsProdSalesLY, SRMFLastTY = finOutput.AnnualRentExpenseYr1, SRMFLastTYSales = finOutput.RentAsProdSalesYr1, SRMF1stTY = finOutput.AnnualRentExpenseAvg, SRMF1stTYSales = finOutput.RentAsProdSalesAvg, AnnualSOILastTY = finOutput.SOIProdSalesLY, AnnualSOIAvg = finOutput.SOIProdSalesAvg, CashROIAvg = finOutput.CashROIAvg, CashROILastTY = finOutput.CashROILY, OriginalInvestment = (toolWriteOff.REII + toolWriteOff.LHIII + toolWriteOff.ESSDII).ToString(), NBV = (toolWriteOff.RENBV + toolWriteOff.LHINBV + toolWriteOff.ESSDNBV).ToString(), AdditionalInvestmentCost = (toolWriteOff.RECost + toolWriteOff.LHICost + toolWriteOff.ESSDCost).ToString(), ExclusivityClause = storeContract.ExclusivityClause, McDsEarlyTerminationRight = storeContract.WithEarlyTerminationClause == null || storeContract.WithEarlyTerminationClause == 0 ? "N" : "Y", LandlordEntity = storeContract.PartyAFullName, LastRemodeling = store.ReImageDate.HasValue ? store.ReImageDate.Value.ToString("yyyy-MM-dd") : "" }); }
public Dictionary <string, string> GetPrintTemplateFields() { var project = ProjectInfo.Get(this.ProjectId, FlowCode.Renewal_Package); var storeBasic = StoreBasicInfo.GetStorInfo(project.USCode); var storeContract = StoreContractInfo.Search(c => c.StoreCode == project.USCode).OrderByDescending(c => c.CreatedTime).FirstOrDefault(); var info = RenewalInfo.Get(ProjectId); var flowInfo = FlowInfo.Get(FlowCode.Renewal); var analysis = RenewalAnalysis.Get(this.AnalysisId.Value) ?? new RenewalAnalysis(); var finOutput = RenewalToolFinMeasureOutput.GetByToolId(this.ToolId.Value); Dictionary <string, string> templateFileds = new Dictionary <string, string>(); templateFileds.Add("WorkflowName", flowInfo.NameENUS); templateFileds.Add("ProjectID", ProjectId); templateFileds.Add("USCode", storeBasic.StoreCode); templateFileds.Add("Region", storeBasic.Region); templateFileds.Add("StoreNameEN", storeBasic.NameENUS); templateFileds.Add("Market", storeBasic.Market); templateFileds.Add("City", storeBasic.CityZHCN); templateFileds.Add("StoreNameCN", storeBasic.NameZHCN); templateFileds.Add("StoreAge", Math.Floor((DateTime.Now - storeBasic.OpenDate).TotalDays / 365D).ToString()); templateFileds.Add("OpenDate", storeBasic.OpenDate.ToString("yyyy-MM-dd")); templateFileds.Add("CloseDate", storeBasic.CloseDate.HasValue ? (storeBasic.CloseDate.Value.Year != 1900 ? storeBasic.CloseDate.Value.ToString("yyyy-MM-dd") : "") : ""); if (storeContract != null) { templateFileds.Add("CurrentLeaseENDYear", storeContract.EndYear); } else { templateFileds.Add("CurrentLeaseENDYear", ""); } templateFileds.Add("AssetsManager", info.AssetManagerNameENUS); templateFileds.Add("AssetsActor", info.AssetActorNameENUS); templateFileds.Add("AssetsRep", info.AssetRepNameENUS); templateFileds.Add("NewLeaseENDYear", info.NewLeaseEndDate.HasValue ? info.NewLeaseEndDate.Value.ToString("yyyy") : ""); templateFileds.Add("ClosureDate", storeBasic.CloseDate.HasValue ? (storeBasic.CloseDate.Value.Year != 1900 ? storeBasic.CloseDate.Value.ToString("yyyy-MM-dd") : "") : ""); templateFileds.Add("FairMarketRentPerAppraisal", analysis.FairMarketRentAmount.HasValue ? DataConverter.ToMoney(analysis.FairMarketRentAmount.Value) : ""); templateFileds.Add("LeaseTenureAndTerm", analysis.LeaseTenureAndTerm); templateFileds.Add("DR1stTYAmount", analysis.DR1stTYAmount.HasValue ? DataConverter.ToMoney(analysis.DR1stTYAmount.Value) : ""); templateFileds.Add("FreeRentalPeriod", analysis.FreeRentalPeriod); templateFileds.Add("RentDeviation", analysis.RentDeviation.HasValue ? DataConverter.ToPercentage(analysis.RentDeviation.Value.ToString()) : ""); templateFileds.Add("RentStructureUR", analysis.RentStructure); templateFileds.Add("MFStructureUR", analysis.MFStructureNew); if (finOutput != null) { templateFileds.Add("AnnualRentExpenseLY", DataConverter.ToMoney(finOutput.AnnualRentExpenseLY)); templateFileds.Add("AnnualRentExpenseYr1", DataConverter.ToMoney(finOutput.AnnualRentExpenseLY)); templateFileds.Add("AnnualRentExpenseAvg", DataConverter.ToMoney(finOutput.AnnualRentExpenseLY)); templateFileds.Add("RentAsProdSalesLY", DataConverter.ToPercentage(finOutput.RentAsProdSalesLY)); templateFileds.Add("RentAsProdSalesYr1", DataConverter.ToPercentage(finOutput.RentAsProdSalesYr1)); templateFileds.Add("RentAsProdSalesAvg", DataConverter.ToPercentage(finOutput.RentAsProdSalesAvg)); templateFileds.Add("OccupancyProdSalesLY", DataConverter.ToPercentage(finOutput.OccupancyProdSalesLY)); templateFileds.Add("OccupancyProdSalesYr1", DataConverter.ToPercentage(finOutput.OccupancyProdSalesYr1)); templateFileds.Add("OccupancyProdSalesAvg", DataConverter.ToPercentage(finOutput.OccupancyProdSalesAvg)); templateFileds.Add("SOIProdSalesLY", DataConverter.ToPercentage(finOutput.SOIProdSalesLY)); templateFileds.Add("SOIProdSalesYr1", DataConverter.ToPercentage(finOutput.SOIProdSalesYr1)); templateFileds.Add("SOIProdSalesAvg", DataConverter.ToPercentage(finOutput.SOIProdSalesAvg)); templateFileds.Add("CashROILY", DataConverter.ToPercentage(finOutput.CashROILY)); templateFileds.Add("CashROIYr1", DataConverter.ToPercentage(finOutput.CashROIYr1)); templateFileds.Add("CashROIAvg", DataConverter.ToPercentage(finOutput.CashROIAvg)); } else { templateFileds.Add("AnnualRentExpenseLY", ""); templateFileds.Add("AnnualRentExpenseYr1", ""); templateFileds.Add("AnnualRentExpenseAvg", ""); templateFileds.Add("RentAsProdSalesLY", ""); templateFileds.Add("RentAsProdSalesYr1", ""); templateFileds.Add("RentAsProdSalesAvg", ""); templateFileds.Add("OccupancyProdSalesLY", ""); templateFileds.Add("OccupancyProdSalesYr1", ""); templateFileds.Add("OccupancyProdSalesAvg", ""); templateFileds.Add("SOIProdSalesLY", ""); templateFileds.Add("SOIProdSalesYr1", ""); templateFileds.Add("SOIProdSalesAvg", ""); templateFileds.Add("CashROILY", ""); templateFileds.Add("CashROIYr1", ""); templateFileds.Add("CashROIAvg", ""); } return(templateFileds); }
public static TempClosureReopenMemo Get(string projectId) { var db = PrepareDb(); var usCode = db.ProjectInfo.FirstOrDefault(pi => pi.ProjectId == projectId).USCode; var reopenMemo = FirstOrDefault(cm => cm.ProjectId == projectId); if (reopenMemo == null) { reopenMemo = SqlQuery <TempClosureReopenMemo>(@" SELECT CAST('00000000-0000-0000-0000-000000000000' AS uniqueidentifier) [Id] ,@ProjectId [ProjectId] ,@USCode [USCode] ,s.RegionCode [RegionCode] ,s.RegionENUS [RegionENUS] ,s.RegionZHCN [RegionZHCN] ,s.MarketCode [MarketCode] ,s.MarketENUS [MarketENUS] ,s.MarketZHCN [MarketZHCN] ,s.ProvinceENUS [ProvinceENUS] ,s.ProvinceZHCN [ProvinceZHCN] ,s.CityCode [CityCode] ,s.CityENUS [CityENUS] ,s.CityZHCN [CityZHCN] ,s.NameENUS [StoreENUS] ,s.NameZHCN [StoreZHCN] ,'' [PipelineId] ,NULL MarketDesirability ,NULL RERating ,NULL [ActualConsFinishDate] ,ci.ActualReopenDate [OpeningDate] ,s.PortfolioType [PortfolioType] ,s.PortfolioTypeName [ProtfolioTypeName] ,s.TACode [TAClassification] ,s.TAName [TAClassificationName] ,cast(cast(isnull(sloc.Seats1,0) as decimal)+cast(isnull(sloc.Seats2,0) as decimal) +cast(isnull(sloc.Seats3,0) as decimal)+cast(isnull(sloc.Seats4,0) as decimal) +cast(isnull(sloc.Seats5,0) as decimal) as nvarchar(10)) SeatingNum ,sloc.TotalArea [BusinessArea] ,sloc.KitchenFloor [KitchenFloor] ,sloc.Floor [SeatingFloor] ,'' [EarlyTerminationClause] ,NULL CarParkTotal ,sloc.KitchenFloor [ParkingNum] ,'' [ContractType] ,'' [Kiosk] ,sd.AssetRepEid [RERep] ,sd.PlannerEid [Planner] ,sd.RERepName RERepName ,sd.PlannerName PlannerName ,@Creator Creator ,getdate() CreateTime FROM StoreBasicInfo s INNER JOIN StoreSTLocation sloc ON sloc.StoreCode = s.StoreCode INNER JOIN StoreDevelop sd ON sd.StoreCode = s.StoreCode INNER JOIN TempClosureInfo ci ON ci.USCode = s.StoreCode WHERE s.StoreCode = @USCode AND ci.ProjectId = @ProjectId ", new { ProjectId = projectId, USCode = usCode, Creator = ClientCookie.UserCode }).FirstOrDefault(); var contractType = StoreContractInfo.SearchByProject(projectId).OrderByDescending(c => c.CreatedTime).Select(c => c.LeasePurchase).FirstOrDefault(); var taInfo = StoreMMInfo.Search(ta => ta.StoreCode == usCode).Select(ta => new { Desirability = ta.Desirability, LocationRatingPP = ta.LocationRatingPP }).FirstOrDefault(); var dic_contractType = Dictionary.GetDictionary(contractType); reopenMemo.ContractType = dic_contractType == null ? "" : dic_contractType.NameZHCN; var dic_desirability = Dictionary.GetDictionary(taInfo.Desirability); reopenMemo.MarketDesirability = dic_desirability == null ? "" : dic_desirability.NameZHCN; var dic_locationRatingPP = Dictionary.GetDictionary(taInfo.LocationRatingPP); reopenMemo.RERating = dic_locationRatingPP == null ? "" : dic_locationRatingPP.NameZHCN; var tempMemo = TempClosureMemo.GetTempClosureMemo(projectId); if (tempMemo != null) { reopenMemo.TempCloseDate = tempMemo.ClosureDate; } } return(reopenMemo); }
public Dictionary <string, string> GetPrintTemplateFields() { var project = ProjectInfo.Get(this.ProjectId, FlowCode.TempClosure_ClosurePackage); var storeBasic = StoreBasicInfo.FirstOrDefault(s => s.StoreCode == project.USCode); var storeContract = StoreContractInfo.Get(storeBasic.StoreCode); var assetMgr = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetManager); var assetActor = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor); var assetRep = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetRep); var tempClosurePackage = TempClosurePackage.Get(ProjectId); var tempClosure = TempClosureInfo.Get(ProjectId); Dictionary <string, string> templateFileds = new Dictionary <string, string>(); templateFileds.Add("WorkflowName", SystemCode.Instance.GetCodeName(FlowCode.TempClosure, ClientCookie.Language)); templateFileds.Add("ProjectID", ProjectId); templateFileds.Add("USCode", storeBasic.StoreCode); templateFileds.Add("Region", storeBasic.Region); templateFileds.Add("StoreNameEN", storeBasic.NameENUS); templateFileds.Add("Market", storeBasic.Market); templateFileds.Add("City", storeBasic.CityZHCN); templateFileds.Add("StoreNameCN", storeBasic.NameZHCN); templateFileds.Add("StoreAge", Math.Floor((DateTime.Now - storeBasic.OpenDate).TotalDays / 365D).ToString()); templateFileds.Add("OpenDate", storeBasic.OpenDate.ToString("yyyy-MM-dd")); var storeInfo = StoreBasicInfo.GetStore(project.USCode); if (storeInfo.StoreContractInfo != null) { templateFileds.Add("CurrentLeaseENDYear", storeContract.EndYear); } else { templateFileds.Add("CurrentLeaseENDYear", ""); } if (assetMgr != null) { templateFileds.Add("AssetsManager", assetMgr.UserNameENUS); } else { templateFileds.Add("AssetsManager", ""); } templateFileds.Add("AssetsActor", assetActor.UserNameENUS); templateFileds.Add("AssetsRep", assetRep.UserNameENUS); templateFileds.Add("Address", storeBasic.AddressZHCN); templateFileds.Add("CloseDate", storeBasic.CloseDate.HasValue ? (storeBasic.CloseDate.Value.Year != 1900 ? storeBasic.CloseDate.Value.ToString("yyyy-MM-dd") : "") : ""); templateFileds.Add("ClosureDate", tempClosure.ActualTempClosureDate.ToString("yyyy-MM-dd")); templateFileds.Add("LeaseExpireDate", tempClosure.LeaseExpireDate.HasValue ? tempClosure.LeaseExpireDate.Value.ToString("yyyy-MM-dd") : ""); templateFileds.Add("ReOpenDate", tempClosure.ActualReopenDate.ToString("yyyy-MM-dd")); templateFileds.Add("RentFreeTerm", string.IsNullOrEmpty(tempClosurePackage.RentReliefClause) ? "否" : "是"); templateFileds.Add("RentFreeStartDate", tempClosurePackage.RentReliefStartDate.HasValue ? tempClosurePackage.RentReliefStartDate.Value.ToString("yyyy-MM-dd") : ""); templateFileds.Add("RentFreeEndDate", tempClosurePackage.RentReliefEndDate.HasValue ? tempClosurePackage.RentReliefEndDate.Value.ToString("yyyy-MM-dd") : ""); templateFileds.Add("FreeRentTerm", tempClosurePackage.RentReliefClause); templateFileds.Add("LandlordName", tempClosure.LandlordName); if (tempClosurePackage.RentRelief.HasValue) { templateFileds.Add("ReliefRent", tempClosurePackage.RentRelief.Value ? "是" : "否"); } else { templateFileds.Add("ReliefRent", ""); } return(templateFileds); }
public Dictionary <string, string> GetPrintTemplateFields() { var project = ProjectInfo.Get(ProjectId, FlowCode.Renewal_LegalApproval); var storeBasic = StoreBasicInfo.GetStorInfo(project.USCode); var storeContract = StoreContractInfo.Search(c => c.StoreCode == project.USCode).OrderByDescending(c => c.CreatedTime).FirstOrDefault(); var info = RenewalInfo.Get(ProjectId); var flowInfo = FlowInfo.Get(FlowCode.Renewal); var legal = RenewalLegalApproval.Get(project.ProjectId) ?? new RenewalLegalApproval(); Dictionary <string, string> templateFileds = new Dictionary <string, string>(); templateFileds.Add("WorkflowName", flowInfo.NameENUS); templateFileds.Add("ProjectID", ProjectId); templateFileds.Add("USCode", storeBasic.StoreCode); templateFileds.Add("Region", storeBasic.Region); templateFileds.Add("StoreNameEN", storeBasic.NameENUS); templateFileds.Add("Market", storeBasic.Market); templateFileds.Add("City", storeBasic.CityZHCN); templateFileds.Add("StoreNameCN", storeBasic.NameZHCN); templateFileds.Add("StoreAge", Math.Floor((DateTime.Now - storeBasic.OpenDate).TotalDays / 365D).ToString()); templateFileds.Add("OpenDate", storeBasic.OpenDate.ToString("yyyy-MM-dd")); templateFileds.Add("CloseDate", storeBasic.CloseDate.HasValue ? (storeBasic.CloseDate.Value.Year != 1900 ? storeBasic.CloseDate.Value.ToString("yyyy-MM-dd") : "") : ""); if (storeContract != null) { templateFileds.Add("CurrentLeaseENDYear", storeContract.EndYear); } else { templateFileds.Add("CurrentLeaseENDYear", ""); } templateFileds.Add("AssetsManager", info.AssetManagerNameENUS); templateFileds.Add("AssetsActor", info.AssetActorNameENUS); templateFileds.Add("AssetsRep", info.AssetRepNameENUS); templateFileds.Add("NewLeaseENDYear", info.NewLeaseEndDate.HasValue ? info.NewLeaseEndDate.Value.ToString("yyyy") : ""); templateFileds.Add("ClosureDate", storeBasic.CloseDate.HasValue ? (storeBasic.CloseDate.Value.Year != 1900 ? storeBasic.CloseDate.Value.ToString("yyyy-MM-dd") : "") : ""); var contractData = Employee.GetEmployeeContact(ProjectId); StringBuilder sbd = new StringBuilder(); if (contractData != null && contractData.Count > 0) { foreach (var item in contractData) { sbd.Append("<tr><td> </td>"); sbd.Append("<td>"); sbd.Append(item.NameENUS); sbd.Append("</td>"); sbd.Append("<td>"); sbd.Append(item.PositionENUS); sbd.Append("</td>"); sbd.Append("<td>"); sbd.Append(item.Mail); sbd.Append("</td>"); sbd.Append("<td>"); sbd.Append(item.Phone); sbd.Append("</td>"); sbd.Append("<td>"); sbd.Append(item.Mobile); sbd.Append("</td>"); sbd.Append("</tr>"); } } else { sbd.Append("<tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>"); } templateFileds.Add("ContactInfoData", sbd.ToString()); //Special Application templateFileds.Add("isurgencyyes", legal.IsUrgency ? "checked" : ""); templateFileds.Add("isurgencyno", !legal.IsUrgency ? "checked" : ""); templateFileds.Add("urgencyreason", legal.UrgencyReason); //transaction involves templateFileds.Add("isrecenttransfer", legal.IsRecentTransfer ? "checked" : ""); templateFileds.Add("isintermediaries", legal.IsIntermediaries ? "checked" : ""); templateFileds.Add("isrelatedparties", legal.IsRelatedParties ? "checked" : ""); templateFileds.Add("isbroker", legal.IsBroker ? "checked" : ""); templateFileds.Add("ispttp", legal.IsPTTP ? "checked" : ""); templateFileds.Add("isasiiwgo", legal.IsASIIWGO ? "checked" : ""); templateFileds.Add("isnoblclause", legal.IsNoBLClause ? "checked" : ""); templateFileds.Add("isofac", legal.IsOFAC ? "checked" : ""); templateFileds.Add("isantic", legal.IsAntiC ? "checked" : ""); templateFileds.Add("isbenefitconflict", legal.IsBenefitConflict ? "checked" : ""); templateFileds.Add("noneofabove", legal.NoneOfAbove ? "checked" : ""); //Any Legal Concerns templateFileds.Add("anylegalconcernno", !legal.AnyLegalConcern ? "checked" : ""); templateFileds.Add("anylegalconcernyes", legal.AnyLegalConcern ? "checked" : ""); templateFileds.Add("illegalstructure", legal.IllegalStructure ? "checked" : ""); templateFileds.Add("occupying", legal.Occupying ? "checked" : ""); templateFileds.Add("noauthoritytorelease", legal.NoAuthorityToRelease ? "checked" : ""); templateFileds.Add("entrustlease", legal.EntrustLease ? "checked" : ""); templateFileds.Add("sublease", legal.SubLease ? "checked" : ""); templateFileds.Add("beingsealedup", legal.BeingSealedUp ? "checked" : ""); templateFileds.Add("beingsealedupdesc", legal.BeingSealedUpDesc); templateFileds.Add("licensecantbeobtained", legal.LicenseCantBeObtained ? "checked" : ""); templateFileds.Add("pendingordispute", legal.PendingOrDispute ? "checked" : ""); templateFileds.Add("pendingordisputedesc", legal.PendingOrDisputeDesc); templateFileds.Add("otherissure", legal.OtherIssure ? "checked" : ""); templateFileds.Add("OtherIssureDesc", legal.OtherIssureDesc); //SOX Audit templateFileds.Add("optionsforrenewalyes", legal.OptionsForRenewal ? "checked" : ""); templateFileds.Add("optionsforrenewalno", !legal.OptionsForRenewal ? "checked" : ""); templateFileds.Add("reinstatementrequirementyes", legal.ReinstatementRequirement ? "checked" : ""); templateFileds.Add("reinstatementrequirementno", !legal.ReinstatementRequirement ? "checked" : ""); //Legal Department Review templateFileds.Add("endorsed", legal.ReviewStatus == "Endorsed" ? "checked" : ""); templateFileds.Add("legalcomments", (legal.ReviewStatus == "LegalComments") ? "checked" : ""); templateFileds.Add("notendorsed", legal.ReviewStatus == "" ? "NotEndorsed" : ""); templateFileds.Add("submitbeforesign", legal.SubmitBeforeSign ? "checked" : ""); templateFileds.Add("SubmitBeforeSignDesc", legal.SubmitBeforeSignDesc); templateFileds.Add("landlordformleaseuserd", legal.LandlordFormLeaseUserd ? "checked" : ""); templateFileds.Add("ownerrefusetohonorlease", legal.OwnerRefuseToHonorLease ? "checked" : ""); templateFileds.Add("mortgageerefusetoguarantee", legal.MortgageeRefuseToGuarantee ? "checked" : ""); templateFileds.Add("otherlegalcomment", legal.OtherLegalComment ? "checked" : ""); templateFileds.Add("LegalComments", legal.LegalComments); templateFileds.Add("OtherLegalCommentDesc", legal.OtherLegalCommentDesc); templateFileds.Add("NotEndorsedIssureNo", legal.NotEndorsedIssureNo.HasValue?legal.NotEndorsedIssureNo.Value.ToString():""); //Endorsement by General Counsel templateFileds.Add("GCComment", legal.GCComment); return(templateFileds); }
public void Submit(List <ProjectContractRevision> revisions, string flowCode) { revisions = revisions ?? new List <ProjectContractRevision>(); using (TransactionScope tranScope = new TransactionScope()) { StoreContractInfo contractInfo = this.ToStoreContractInfo(); ProjectContractRevision reInfo = new ProjectContractRevision(); #region 初始化项目的Revision信息 reInfo.Id = Guid.NewGuid(); reInfo.ProjectId = this.ProjectId; Guid srId = Guid.NewGuid(); reInfo.ProjectContractId = this.Id; reInfo.RevisionId = srId; reInfo.StoreContractInfoId = contractInfo.Id; reInfo.StoreID = this.StoreId; reInfo.StoreCode = this.StoreCode; reInfo.LeaseRecapID = this.LeaseRecapID; reInfo.ChangeDate = DateTime.Now; if (flowCode == FlowCode.MajorLease_ContractInfo) { MajorLeaseInfo info = MajorLeaseInfo.Search(e => e.ProjectId == ProjectId).FirstOrDefault(); reInfo.Rent = info.ChangeRentalType.HasValue && info.ChangeRentalType.Value ? "Y" : null; reInfo.Size = info.ChangeRedLineType.HasValue && info.ChangeRedLineType.Value ? "Y" : null; reInfo.LeaseTerm = info.ChangeLeaseTermType.HasValue && info.ChangeLeaseTermType.Value ? "Y" : null; reInfo.Entity = info.ChangeLandlordType.HasValue && info.ChangeLandlordType.Value ? "Y" : null; reInfo.Others = info.ChangeOtherType.HasValue && info.ChangeOtherType.Value ? "Y" : null; reInfo.RentStructureOld = info.OldRentalStructure; reInfo.RentStructureNew = info.NewRentalStructure; reInfo.RedlineAreaOld = info.OldChangeRedLineRedLineArea.HasValue ? info.OldChangeRedLineRedLineArea.ToString() : null; reInfo.RedlineAreaNew = info.NewChangeRedLineRedLineArea.HasValue ? info.NewChangeRedLineRedLineArea.ToString() : null; reInfo.LeaseChangeExpiryOld = info.OldChangeLeaseTermExpiraryDate; reInfo.LeaseChangeExpiryNew = info.NewChangeLeaseTermExpiraryDate; reInfo.LandlordOld = info.OldLandlord; reInfo.LandlordNew = info.NewLandlord; reInfo.OthersDescription = info.Others; reInfo.Description = info.LeaseChangeDescription; } else if (flowCode == FlowCode.Rebuild_ContractInfo) { RebuildPackage info = RebuildPackage.GetRebuildPackageInfo(ProjectId); reInfo.Rent = info.ChangeRentalType.HasValue && info.ChangeRentalType.Value ? "Y" : null; reInfo.Size = info.ChangeRedLineType.HasValue && info.ChangeRedLineType.Value ? "Y" : null; reInfo.LeaseTerm = info.ChangeLeaseTermType.HasValue && info.ChangeLeaseTermType.Value ? "Y" : null; reInfo.Entity = info.ChangeLandlordType.HasValue && info.ChangeLandlordType.Value ? "Y" : null; reInfo.Others = info.ChangeOtherType.HasValue && info.ChangeOtherType.Value ? "Y" : null; reInfo.RentStructureOld = info.OldRentalStructure; reInfo.RentStructureNew = info.NewRentalStructure; reInfo.RedlineAreaOld = info.OldChangeRedLineRedLineArea.HasValue ? info.OldChangeRedLineRedLineArea.ToString() : null; reInfo.RedlineAreaNew = info.NewChangeRedLineRedLineArea.HasValue ? info.NewChangeRedLineRedLineArea.ToString() : null; reInfo.LeaseChangeExpiryOld = info.OldChangeLeaseTermExpiraryDate; reInfo.LeaseChangeExpiryNew = info.NewChangeLeaseTermExpiraryDate; reInfo.LandlordOld = info.OldLandlord; reInfo.LandlordNew = info.NewLandlord; reInfo.OthersDescription = info.Others; reInfo.Description = info.LeaseChangeDescription; } #endregion if (this.EditMode == "EDIT") { if (flowCode == FlowCode.Closure_ContractInfo) { revisions = revisions.OrderBy(r => r.ChangeDate).ToList(); revisions.ForEach(r => { var sr = r.ToStoreContractRevision(); sr.Save(); r.RevisionId = sr.Id; //回写到ContractInfo中 if (sr.Rent == "Y") { this.RentStructure = sr.RentStructureNew; } if (sr.Size == "Y") { this.TotalLeasedArea = sr.RedlineAreaNew; } if (sr.LeaseTerm == "Y") { this.EndDate = sr.LeaseChangeExpiryNew; } if (sr.Entity == "Y") { this.PartyAFullName = sr.LandlordNew; } }); contractInfo = this.ToStoreContractInfo(); var sRIds = revisions.Select(e => e.RevisionId).ToList(); StoreContractRevision.Delete(e => e.StoreContractInfoId == contractInfo.Id && !sRIds.Contains(e.Id)); this.Save(revisions); } else { this.Save(); reInfo.Save(); var sr = reInfo.ToStoreContractRevision(); sr.Id = srId; sr.Save(); } contractInfo.Update(); } else { contractInfo.Id = Guid.NewGuid(); contractInfo.CreatedTime = DateTime.Now; contractInfo.Add(); this.ContractInfoId = contractInfo.Id; if (Any(e => e.Id == this.Id)) { this.Update(); } else { this.Add(); } //新增时不需要带入修订信息 ProjectContractRevision.Delete(r => r.ProjectContractId == this.Id); //if (flowCode != FlowCode.Renewal_ContractInfo) //{ // reInfo.StoreContractInfoId = contractInfo.Id; // reInfo.Save(); // var sr = reInfo.ToStoreContractRevision(); // sr.Id = srId; // sr.Save(); //} } //关闭任务 var task = TaskWork.FirstOrDefault(e => e.ReceiverAccount == ClientCookie.UserCode && e.TypeCode.Contains("ContractInfo") && e.RefID == this.ProjectId); if (task != null) { task.Finish(); } var projectInfo = ProjectInfo.FirstOrDefault(e => e.ProjectId == this.ProjectId && e.FlowCode.Contains("ContractInfo")); ProjectInfo.FinishNode(this.ProjectId, projectInfo.FlowCode, NodeCode.Finish, ProjectStatus.Finished); ProjectInfo.CompleteMainIfEnable(this.ProjectId); if (projectInfo.FlowCode == FlowCode.Renewal_ContractInfo) { if (ProjectInfo.IsFlowFinished(ProjectId, FlowCode.Renewal_SiteInfo)) { ProjectProgress.SetProgress(ProjectId, "100%"); } } tranScope.Complete(); } }