public IHttpActionResult InitPage(string projectId)
        {
            var info            = RenewalInfo.Get(projectId);
            var siteInfoProject = ProjectInfo.Get(projectId, FlowCode.Renewal_SiteInfo);

            var estimatedVsActualConstruction = EstimatedVsActualConstruction.FirstOrDefault(e => e.RefId == siteInfoProject.Id);

            if (estimatedVsActualConstruction == null)
            {
                var consInfo      = RenewalConsInfo.Get(projectId);
                var reinBasicInfo = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id);
                var storeInfo     = StoreSTLocation.FirstOrDefault(e => e.StoreCode == info.USCode);
                estimatedVsActualConstruction = new EstimatedVsActualConstruction
                {
                    RefId                 = siteInfoProject.Id,
                    GBDate                = reinBasicInfo != null ? reinBasicInfo.GBDate : null,
                    CompletionDate        = reinBasicInfo != null ? reinBasicInfo.ConsCompletionDate : null,
                    ARDC                  = reinBasicInfo != null ? reinBasicInfo.NewDesignType : null,
                    OriginalOperationSize = storeInfo.TotalArea,
                    OriginalSeatNumber    = storeInfo.TotalSeatsNo,
                    ClosureDays           = reinBasicInfo != null ? (reinBasicInfo.ConsCompletionDate.Value - reinBasicInfo.GBDate.Value).TotalDays.ToString() : ""
                };
            }
            var result = new
            {
                Info    = info,
                Savable = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_SiteInfo),
                EstimatedVsActualConstruction = estimatedVsActualConstruction
            };

            return(Ok(result));
        }
Example #2
0
        public IHttpActionResult GetReimageInfo(string projectId)
        {
            var reimageInfo = ReimageInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId));

            if (reimageInfo != null)
            {
                reimageInfo.IsSiteInfoSaveable = ProjectInfo.IsFlowSavable(projectId, FlowCode.Reimage_SiteInfo);

                var siteInfo = ProjectInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId) &&
                                                          e.FlowCode == FlowCode.Reimage_SiteInfo);

                if (siteInfo != null)
                {
                    reimageInfo.SiteInfoId = siteInfo.Id;

                    var estimatedVsActualConstruction =
                        EstimatedVsActualConstruction.FirstOrDefault(e => e.RefId == siteInfo.Id);

                    if (estimatedVsActualConstruction == null)
                    {
                        var consInfo      = ReimageConsInfo.GetConsInfo(projectId);
                        var reinBasicInfo = consInfo.ReinBasicInfo;
                        var gbMemo        = ReimageGBMemo.GetGBMemo(projectId);
                        var storeInfo     = StoreSTLocation.FirstOrDefault(e => e.StoreCode == siteInfo.USCode);

                        var summary = ReimageSummary.GetReimageSummaryInfo(projectId);
                        var afterReimagePriceTier = summary.FinancialPreanalysis != null
                            ? summary.FinancialPreanalysis.PriceTierafterReimage
                            : null;


                        estimatedVsActualConstruction = new EstimatedVsActualConstruction
                        {
                            RefId                 = siteInfo.Id,
                            GBDate                = gbMemo.GBDate,
                            CompletionDate        = gbMemo.ConstCompletionDate,
                            ARDC                  = reinBasicInfo.NewDesignType,
                            OriginalOperationSize = storeInfo.TotalArea,
                            OriginalSeatNumber    = storeInfo.TotalSeatsNo,
                            ARPT                  = afterReimagePriceTier
                        };
                    }

                    reimageInfo.EstimatedVsActualConstruction = estimatedVsActualConstruction;
                }
            }

            return(Ok(reimageInfo));
        }
Example #3
0
        public IHttpActionResult GetEstimatedVsActualConstruction(string projectId, Guid identifier)
        {
            var reimageInfo = ReimageInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId));

            var estimatedVsActualConstruction = EstimatedVsActualConstruction.FirstOrDefault(e => e.RefId == identifier);

            if (estimatedVsActualConstruction == null)
            {
                var reimageConsInfo = ReimageConsInfo.GetConsInfo(projectId);
                var storeInfo       = StoreSTLocation.FirstOrDefault(e => e.StoreCode == reimageInfo.USCode);
                estimatedVsActualConstruction = new EstimatedVsActualConstruction
                {
                    GBDate                = reimageConsInfo.ReinBasicInfo != null ? reimageConsInfo.ReinBasicInfo.GBDate : null,
                    CompletionDate        = reimageConsInfo.ReinBasicInfo != null ? reimageConsInfo.ReinBasicInfo.ConsCompletionDate : null,
                    ARDC                  = reimageConsInfo.ReinBasicInfo != null ? reimageConsInfo.ReinBasicInfo.NewDesignType : null,
                    OriginalOperationSize = storeInfo.TotalArea,
                    OriginalSeatNumber    = storeInfo.TotalSeatsNo
                };
            }

            return(Ok(estimatedVsActualConstruction));
        }