public static RenewalPackageDTO InitPage(string projectId, string id = null) { RenewalPackageDTO dto = new RenewalPackageDTO(); var entity = RenewalPackage.Get(projectId, id); var project = ProjectInfo.Get(projectId, FlowCode.Renewal_Package); var info = RenewalInfo.Get(projectId); entity.IsProjectFreezed = entity.CheckIfFreezeProject(projectId); entity.GenerateCover(); var haveTask = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_Package && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode); var projectComment = ProjectComment.GetSavedComment(entity.Id, "RenewalPackage", ClientCookie.UserCode); var projectNode = NodeInfo.GetNodeInfo(project.NodeCode); dto.Info = info; dto.Entity = entity; dto.Analysis = RenewalAnalysis.Get(entity.AnalysisId.Value); dto.FinMeasureOutput = RenewalToolFinMeasureOutput.GetByToolId(entity.ToolId.Value); dto.Uploadable = projectNode.Sequence >= 4 && ClientCookie.UserCode == dto.Info.AssetActorAccount; var editStatuses = new[] { ProjectStatus.Finished, ProjectStatus.Rejected }; dto.ProjectComment = projectComment != null ? projectComment.Content : ""; dto.Editable = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_Package); dto.Recallable = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_Package); dto.Savable = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_Package) && string.IsNullOrEmpty(id); if (entity.ProcInstId.HasValue) { var currentActivityName = K2FxContext.Current.GetCurrentActivityName(entity.ProcInstId.Value); dto.Rejectable = !entity.WorkflowNormalActors.Contains(currentActivityName); } dto.IsLindaLu = string.Compare(ClientCookie.UserCode, ConfigurationManager.AppSettings["AssetMgrCode"], true) == 0; return(dto); }
public void UploadTool() { var context = HttpContext.Current; var files = context.Request.Files; if (files.Count > 0) { using (TransactionScope tranScope = new TransactionScope()) { var file = files[0]; var templateFileName = string.Concat(SiteFilePath.Template_DIRECTORY, "/", SiteFilePath.RenewalTool_Template); if (!ExcelHelper.MatchVersionNumber(templateFileName, file.InputStream)) { throw new Exception("Version not matched!"); } var extetion = Path.GetExtension(file.FileName); var internalName = string.Concat(Guid.NewGuid(), extetion); var fileName = context.Server.MapPath(string.Format("~/UploadFiles/{0}", internalName)); file.SaveAs(fileName); FileInfo fileInfo = new FileInfo(fileName); ExcelDataImportDirector excelDirector = new ExcelDataImportDirector(fileInfo, ExcelDataImportType.RenewalTool); var finOutput = RenewalToolFinMeasureOutput.GetByToolId(this.Id); if (finOutput == null) { finOutput = new RenewalToolFinMeasureOutput(); finOutput.ToolId = this.Id; finOutput.Id = Guid.NewGuid(); } excelDirector.ExcelData.Entity = finOutput; excelDirector.ParseAndImport(); var att = Attachment.FirstOrDefault(e => e.RefTableID == this.Id.ToString() && e.TypeCode == "RenewalTool"); bool hasTool = true; if (att == null) { hasTool = false; att = new Attachment(); att.ID = Guid.NewGuid(); } att.TypeCode = "RenewalTool"; att.RefTableID = this.Id.ToString(); att.RefTableName = this.TableName; att.Name = "Renewal Tool"; att.Extension = extetion; att.RelativePath = "/"; att.InternalName = internalName; att.ContentType = "microsoft/excel"; att.Length = file.ContentLength; att.CreatorID = ClientCookie.UserCode; att.CreatorNameENUS = ClientCookie.UserNameENUS; att.CreatorNameZHCN = ClientCookie.UserNameZHCN; att.CreateTime = DateTime.Now; att.RequirementId = new Guid("CE111514-65E3-45C7-AD22-DF4937B1686E"); if (hasTool) { att.Update(); } else { att.Add(); } tranScope.Complete(); } } else { throw new Exception("Please select Renewal Tool to upload"); } }
public override string Edit() { string url; using (var tranScope = new TransactionScope()) { var info = RenewalInfo.Get(this.ProjectId); var tool = Duplicator.AutoCopy(this); tool.Id = Guid.NewGuid(); tool.IsHistory = false; tool.CreateTime = DateTime.Now; tool.CreateUserAccount = ClientCookie.UserCode; tool.Add(); NewEntityId = tool.Id; IsHistory = true; this.Update(); ProjectInfo.Reset(ProjectId, this.WorkflowCode); var attachments = Attachment.GetList(this.TableName, Id.ToString(), string.Empty); attachments.ForEach(att => { att.RefTableID = tool.Id.ToString(); att.ID = Guid.NewGuid(); }); Attachment.Add(attachments.ToArray()); var FinMI = RenewalToolFinMeasureInput.Get(this.ProjectId, this.Id); var newFinMI = Duplicator.AutoCopy(FinMI); newFinMI.Id = Guid.NewGuid(); newFinMI.ToolId = tool.Id; newFinMI.Add(); var WfRc = RenewalToolWriteOffAndReinCost.Get(this.ProjectId, this.Id); var newWfRc = Duplicator.AutoCopy(WfRc); newWfRc.Id = Guid.NewGuid(); newWfRc.ToolId = tool.Id; newWfRc.Add(); var FinMO = RenewalToolFinMeasureOutput.GetByToolId(this.Id); var newFinMO = Duplicator.AutoCopy(FinMO); newFinMO.Id = Guid.NewGuid(); newFinMO.ToolId = tool.Id; newFinMO.Add(); var package = RenewalPackage.Get(this.ProjectId); package.ToolId = tool.Id; package.Update(); var oldTasks = TaskWork.Search(t => t.RefID == ProjectId && t.Status == TaskWorkStatus.UnFinish && new string[] { this.WorkflowCode, FlowCode.Renewal_Analysis }.Contains(t.TypeCode)).ToList(); oldTasks.ForEach(t => { t.Status = TaskWorkStatus.Cancel; }); TaskWork.Update(oldTasks.ToArray()); var anlysisProj = ProjectInfo.FirstOrDefault(e => e.FlowCode == FlowCode.Renewal_Analysis && e.Status == ProjectStatus.UnFinish && e.ProjectId == ProjectId); if (anlysisProj != null) { var taskAnlysis = TaskWork.FirstOrDefault(e => e.TypeCode == FlowCode.Renewal_Analysis && e.RefID == ProjectId && e.Status == TaskWorkStatus.UnFinish); if (taskAnlysis != null) { taskAnlysis.Status = TaskWorkStatus.Finished; taskAnlysis.FinishTime = DateTime.Now; taskAnlysis.Update(); } } var task = info.GenerateSubmitTask(this.WorkflowCode); url = task.Url; tranScope.Complete(); } return(url); }
public void Save(bool pushOrNot) { using (TransactionScope tranScope = new TransactionScope()) { var projectInfo = ProjectInfo.Get(Id); if (projectInfo == null) { ProjectId = ProjectInfo.CreateDLProject(Id, FlowCode.Renewal, USCode, NodeCode.Start, ClientCookie.UserCode, pushOrNot); var renewalInfo = new RenewalInfo(); renewalInfo.Id = Guid.NewGuid(); renewalInfo.ProjectId = ProjectId; renewalInfo.USCode = USCode; renewalInfo.RenewalYears = 0; renewalInfo.NeedProjectCostEst = false; renewalInfo.CreateTime = DateTime.Now; renewalInfo.CreateUserAccount = ClientCookie.UserCode; renewalInfo.Add(); var renewalConsInfo = new RenewalConsInfo(); renewalConsInfo.Id = Guid.NewGuid(); renewalConsInfo.ProjectId = ProjectId; renewalConsInfo.HasReinvenstment = false; renewalConsInfo.IsHistory = false; renewalConsInfo.CreateTime = DateTime.Now; renewalConsInfo.CreateUserAccount = ClientCookie.UserCode; renewalConsInfo.ProcInstId = 0; renewalConsInfo.Add(); var writeOffAmount = new WriteOffAmount(); writeOffAmount.Id = Guid.NewGuid(); writeOffAmount.ConsInfoID = renewalConsInfo.Id; writeOffAmount.TotalWriteOff = Renewal_Total_WO_Proj; writeOffAmount.TotalNBV = Renewal_Total_WO_Act; writeOffAmount.Add(); var reinvestmentCost = new ReinvestmentCost(); reinvestmentCost.Id = Guid.NewGuid(); reinvestmentCost.ConsInfoID = renewalConsInfo.Id; reinvestmentCost.TotalReinvestmentNorm = Renewal_Total_Reinvestment_Proj; reinvestmentCost.LHINorm = Renewal_Total_Reinvestment_Act; reinvestmentCost.Add(); var renewalAnalysis = new RenewalAnalysis(); renewalAnalysis.Id = Guid.NewGuid(); renewalAnalysis.ProjectId = ProjectId; renewalAnalysis.CreateUserAccount = ClientCookie.UserCode; renewalAnalysis.CreateTime = DateTime.Now; renewalAnalysis.IsHistory = false; renewalAnalysis.FairMarketRentAgent = Fair_Market_Rent; renewalAnalysis.DR1stTYAmount = DR1stTYAmount; renewalAnalysis.RentDeviation = RentDeviation; renewalAnalysis.DRMFLastTYSales = DRMFLastTYSales; renewalAnalysis.DRMF1stTY = DRMF1stTY; renewalAnalysis.Add(); var renewalTool = new RenewalTool(); renewalTool.Id = Guid.NewGuid(); renewalTool.ProjectId = ProjectId; renewalTool.IsHistory = false; renewalTool.CreateTime = DateTime.Now; renewalTool.CreateUserAccount = ClientCookie.UserCode; renewalTool.Add(); var renewalToolFinMeasureOutput = new RenewalToolFinMeasureOutput(); renewalToolFinMeasureOutput.Id = Guid.NewGuid(); renewalToolFinMeasureOutput.ToolId = renewalTool.Id; renewalToolFinMeasureOutput.RentAsProdSalesYr1 = SRMFLastTYSales; renewalToolFinMeasureOutput.RentAsProdSalesAvg = SRMF1stTYSales; renewalToolFinMeasureOutput.Add(); var projectContractInfo = new ProjectContractInfo(); projectContractInfo.Id = Guid.NewGuid(); projectContractInfo.ProjectId = ProjectId; projectContractInfo.ContractInfoId = Guid.Empty; projectContractInfo.CreatedTime = DateTime.Now; projectContractInfo.WriteBack = false; projectContractInfo.EditMode = EditMode; projectContractInfo.PartyAFullName = PartyAFullName; projectContractInfo.McDLegalEntity = ContractEntityName; projectContractInfo.McDOwnership = McdOwnership; projectContractInfo.ContactPerson = ContactPerson; projectContractInfo.ContactMode = ContactMode; projectContractInfo.RentType = RentType; projectContractInfo.TotalLeasedArea = RentSize; projectContractInfo.LeasePurchaseTerm = ContractTerm; projectContractInfo.LeasePurchase = ContractType; projectContractInfo.StartDate = ContractStartDate; projectContractInfo.EndDate = ContraceEndDate; projectContractInfo.StartYear = ContractStartYear; projectContractInfo.EndYear = ContraceEndYear; projectContractInfo.RentCommencementDate = RentPaymentStartDate; projectContractInfo.DeadlineToNotice = DeadlineToNoticeLL; projectContractInfo.Changedafter2010 = ChangedAfter2010; projectContractInfo.RentStructure = RentStructure; projectContractInfo.WithEarlyTerminationClause = EarlyTerminationClause; projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription; projectContractInfo.RentPaymentArrangement = RentPaymentArrangement; projectContractInfo.HasDeposit = Deposit; projectContractInfo.DepositAmount = DepositAmount; projectContractInfo.RefundableDate = WhenRefund; projectContractInfo.WithPenaltyClause = withPenaltyClause; projectContractInfo.HasBankGuarantee = BankGuarantee; projectContractInfo.BGNumber = BankGuaranteeNumber; projectContractInfo.BGAmount = BankGuaranteeAmount; projectContractInfo.BGCommencementDate = BGCommencementDate; projectContractInfo.BGEndDate = BGEndDate; projectContractInfo.Add(); } else { ProjectId = projectInfo.ProjectId; projectInfo.IsPushed = pushOrNot; projectInfo.Update(); var renewalInfo = RenewalInfo.FirstOrDefault(i => i.ProjectId == ProjectId); if (renewalInfo == null) { renewalInfo = new RenewalInfo(); renewalInfo.Id = Guid.NewGuid(); renewalInfo.ProjectId = ProjectId; renewalInfo.USCode = USCode; renewalInfo.RenewalYears = 0; renewalInfo.NeedProjectCostEst = false; renewalInfo.CreateTime = DateTime.Now; renewalInfo.CreateUserAccount = ClientCookie.UserCode; renewalInfo.Add(); } var renewalConsInfo = RenewalConsInfo.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory); if (renewalConsInfo == null) { renewalConsInfo = new RenewalConsInfo(); renewalConsInfo.Id = Guid.NewGuid(); renewalConsInfo.ProjectId = ProjectId; renewalConsInfo.HasReinvenstment = false; renewalConsInfo.IsHistory = false; renewalConsInfo.CreateTime = DateTime.Now; renewalConsInfo.CreateUserAccount = ClientCookie.UserCode; renewalConsInfo.ProcInstId = 0; renewalConsInfo.Add(); } var writeOffAmount = WriteOffAmount.FirstOrDefault(i => i.ConsInfoID == renewalConsInfo.Id); if (writeOffAmount == null) { writeOffAmount = new WriteOffAmount(); writeOffAmount.Id = Guid.NewGuid(); writeOffAmount.ConsInfoID = renewalConsInfo.Id; writeOffAmount.TotalWriteOff = Renewal_Total_WO_Proj; writeOffAmount.TotalNBV = Renewal_Total_WO_Act; writeOffAmount.Add(); } else { writeOffAmount.TotalWriteOff = Renewal_Total_WO_Proj; writeOffAmount.TotalNBV = Renewal_Total_WO_Act; writeOffAmount.Update(); } var reinvestmentCost = ReinvestmentCost.FirstOrDefault(i => i.ConsInfoID == renewalConsInfo.Id); if (reinvestmentCost == null) { reinvestmentCost = new ReinvestmentCost(); reinvestmentCost.Id = Guid.NewGuid(); reinvestmentCost.ConsInfoID = renewalConsInfo.Id; reinvestmentCost.TotalReinvestmentNorm = Renewal_Total_Reinvestment_Proj; reinvestmentCost.LHINorm = Renewal_Total_Reinvestment_Act; reinvestmentCost.Add(); } else { reinvestmentCost.TotalReinvestmentNorm = Renewal_Total_Reinvestment_Proj; reinvestmentCost.LHINorm = Renewal_Total_Reinvestment_Act; reinvestmentCost.Update(); } var renewalAnalysis = RenewalAnalysis.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory); if (renewalAnalysis == null) { renewalAnalysis = new RenewalAnalysis(); renewalAnalysis.Id = Guid.NewGuid(); renewalAnalysis.ProjectId = ProjectId; renewalAnalysis.CreateUserAccount = ClientCookie.UserCode; renewalAnalysis.CreateTime = DateTime.Now; renewalAnalysis.IsHistory = false; renewalAnalysis.FairMarketRentAgent = Fair_Market_Rent; renewalAnalysis.DR1stTYAmount = DR1stTYAmount; renewalAnalysis.RentDeviation = RentDeviation; renewalAnalysis.DRMFLastTYSales = DRMFLastTYSales; renewalAnalysis.DRMF1stTY = DRMF1stTY; renewalAnalysis.Add(); } else { renewalAnalysis.FairMarketRentAgent = Fair_Market_Rent; renewalAnalysis.DR1stTYAmount = DR1stTYAmount; renewalAnalysis.RentDeviation = RentDeviation; renewalAnalysis.DRMFLastTYSales = DRMFLastTYSales; renewalAnalysis.DRMF1stTY = DRMF1stTY; renewalAnalysis.Update(); } var renewalTool = RenewalTool.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory); if (renewalTool == null) { renewalTool = new RenewalTool(); renewalTool.Id = Guid.NewGuid(); renewalTool.ProjectId = ProjectId; renewalTool.IsHistory = false; renewalTool.CreateTime = DateTime.Now; renewalTool.CreateUserAccount = ClientCookie.UserCode; renewalTool.Add(); } var renewalToolFinMeasureOutput = RenewalToolFinMeasureOutput.FirstOrDefault(i => i.ToolId == renewalTool.Id); if (renewalToolFinMeasureOutput == null) { renewalToolFinMeasureOutput = new RenewalToolFinMeasureOutput(); renewalToolFinMeasureOutput.Id = Guid.NewGuid(); renewalToolFinMeasureOutput.ToolId = renewalTool.Id; renewalToolFinMeasureOutput.RentAsProdSalesYr1 = SRMFLastTYSales; renewalToolFinMeasureOutput.RentAsProdSalesAvg = SRMF1stTYSales; renewalToolFinMeasureOutput.Add(); } else { renewalToolFinMeasureOutput.RentAsProdSalesYr1 = SRMFLastTYSales; renewalToolFinMeasureOutput.RentAsProdSalesAvg = SRMF1stTYSales; renewalToolFinMeasureOutput.Update(); } var projectContractInfo = ProjectContractInfo.FirstOrDefault(i => i.ProjectId == ProjectId); if (projectContractInfo != null) { projectContractInfo.EditMode = EditMode; projectContractInfo.PartyAFullName = PartyAFullName; projectContractInfo.McDLegalEntity = ContractEntityName; projectContractInfo.McDOwnership = McdOwnership; projectContractInfo.ContactPerson = ContactPerson; projectContractInfo.ContactMode = ContactMode; projectContractInfo.RentType = RentType; projectContractInfo.TotalLeasedArea = RentSize; projectContractInfo.LeasePurchaseTerm = ContractTerm; projectContractInfo.LeasePurchase = ContractType; projectContractInfo.StartDate = ContractStartDate; projectContractInfo.EndDate = ContraceEndDate; projectContractInfo.StartYear = ContractStartYear; projectContractInfo.EndYear = ContraceEndYear; projectContractInfo.RentCommencementDate = RentPaymentStartDate; projectContractInfo.DeadlineToNotice = DeadlineToNoticeLL; projectContractInfo.Changedafter2010 = ChangedAfter2010; projectContractInfo.RentStructure = RentStructure; projectContractInfo.WithEarlyTerminationClause = EarlyTerminationClause; projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription; projectContractInfo.RentPaymentArrangement = RentPaymentArrangement; projectContractInfo.HasDeposit = Deposit; projectContractInfo.DepositAmount = DepositAmount; projectContractInfo.RefundableDate = WhenRefund; projectContractInfo.WithPenaltyClause = withPenaltyClause; projectContractInfo.HasBankGuarantee = BankGuarantee; projectContractInfo.BGNumber = BankGuaranteeNumber; projectContractInfo.BGAmount = BankGuaranteeAmount; projectContractInfo.BGCommencementDate = BGCommencementDate; projectContractInfo.BGEndDate = BGEndDate; projectContractInfo.Update(); } else { projectContractInfo = new ProjectContractInfo(); projectContractInfo.Id = Guid.NewGuid(); projectContractInfo.ProjectId = ProjectId; projectContractInfo.ContractInfoId = Guid.Empty; projectContractInfo.CreatedTime = DateTime.Now; projectContractInfo.WriteBack = false; projectContractInfo.EditMode = EditMode; projectContractInfo.PartyAFullName = PartyAFullName; projectContractInfo.McDLegalEntity = ContractEntityName; projectContractInfo.McDOwnership = McdOwnership; projectContractInfo.ContactPerson = ContactPerson; projectContractInfo.ContactMode = ContactMode; projectContractInfo.RentType = RentType; projectContractInfo.TotalLeasedArea = RentSize; projectContractInfo.LeasePurchaseTerm = ContractTerm; projectContractInfo.LeasePurchase = ContractType; projectContractInfo.StartDate = ContractStartDate; projectContractInfo.EndDate = ContraceEndDate; projectContractInfo.StartYear = ContractStartYear; projectContractInfo.EndYear = ContraceEndYear; projectContractInfo.RentCommencementDate = RentPaymentStartDate; projectContractInfo.DeadlineToNotice = DeadlineToNoticeLL; projectContractInfo.Changedafter2010 = ChangedAfter2010; projectContractInfo.RentStructure = RentStructure; projectContractInfo.WithEarlyTerminationClause = EarlyTerminationClause; projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription; projectContractInfo.RentPaymentArrangement = RentPaymentArrangement; projectContractInfo.HasDeposit = Deposit; projectContractInfo.DepositAmount = DepositAmount; projectContractInfo.RefundableDate = WhenRefund; projectContractInfo.WithPenaltyClause = withPenaltyClause; projectContractInfo.HasBankGuarantee = BankGuarantee; projectContractInfo.BGNumber = BankGuaranteeNumber; projectContractInfo.BGAmount = BankGuaranteeAmount; projectContractInfo.BGCommencementDate = BGCommencementDate; projectContractInfo.BGEndDate = BGEndDate; projectContractInfo.Add(); } } tranScope.Complete(); } }
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); }