public IHttpActionResult GetSummaryReinvestmentCost(string projectId) { var reimageConsInfo = ReimageConsInfo.GetConsInfo(projectId, ""); ReinvestmentCost rein = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id); WriteOffAmount writeoff = WriteOffAmount.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id); return(Ok(new { Rein = rein, Writeoff = writeoff })); }
public IHttpActionResult GetFinancialPreAnalysis(string projectId, string usCode, string pageType = "") { var financial = new FinancialPreanalysis(); var reimageSum = ReimageSummary.FirstOrDefault(e => e.ProjectId == projectId && e.IsHistory == false); if (reimageSum != null) { financial = FinancialPreanalysis.FirstOrDefault(e => e.RefId == reimageSum.Id); } if (financial != null) { if (financial.Id != 0) { pageType = "save"; } } if (pageType == "") { //FinancialPreanalysis financial = reimageSummary.LoadFinancialPreanalysisInfo(); var enti = ReimageConsInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId) && e.IsHistory == true); if (enti == null) { enti = ReimageConsInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId) && e.IsHistory == false); } WriteOffAmount writeOff = WriteOffAmount.FirstOrDefault(e => e.ConsInfoID == enti.Id); if (financial == null) { financial = new FinancialPreanalysis(); } if (writeOff != null) { financial.EstimatedWriteOffCost = writeOff.TotalII; } var ContributionMargin = StoreCM.Get(usCode).ContributionMargin.ToString(); var reimageConsInfo = ReimageConsInfo.GetConsInfo(projectId, ""); var reinvestmentBasicInfo = ReinvestmentBasicInfo.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id); //ReinvestmentCost reinCost = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == enti.Id); financial.IsMcCafe = reinvestmentBasicInfo.NewMcCafe; financial.IsKiosk = reinvestmentBasicInfo.NewKiosk; financial.IsMDS = reinvestmentBasicInfo.NewMDS; financial.IsTwientyFourHour = reinvestmentBasicInfo.NewTwientyFourHour; financial.StoreCM = ContributionMargin; } return(Ok(financial)); }
public override void Import() { var writeoff = WriteOffAmount.FirstOrDefault(e => e.ConsInfoID.ToString().Equals(_writeOffAmount.ConsInfoID.ToString())); if (writeoff != null) { _writeOffAmount.Id = writeoff.Id; } if (WriteOffAmount.Any(a => a.Id == _writeOffAmount.Id)) { WriteOffAmount.Update(_writeOffAmount); } else { WriteOffAmount.Add(_writeOffAmount); } }