예제 #1
0
        private void FillFinancialPreAnalysisEntity(BaseAbstractEntity entity)
        {
            var financialPreanalysis = entity as FinancialPreanalysis;

            if (financialPreanalysis != null)
            {
                var existFinancialPreanalysis =
                    FinancialPreanalysis.FirstOrDefault(e => e.RefId.ToString().Equals(_refId.ToString()));
                if (existFinancialPreanalysis != null)
                {
                    financialPreanalysis.Id = existFinancialPreanalysis.Id;
                }
                else
                {
                    int id = FinancialPreanalysis.Search(e => true).Max(e => e.Id);
                    financialPreanalysis.Id = id + 1;
                }

                if (_refId == null)
                {
                    throw new Exception("ConsInfo Id is null, please check it!");
                }

                financialPreanalysis.RefId = _refId.Value;
            }
        }
예제 #2
0
        public FinancialPreanalysis getFinan(string projectId, string usCode)
        {
            var financialPreanalysis = FinancialPreanalysis.FirstOrDefault(e => e.RefId == Id);

            if (financialPreanalysis == null)
            {
                financialPreanalysis = new FinancialPreanalysis();
                //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);
                }
                var writeOff = WriteOffAmount.FirstOrDefault(e => e.ConsInfoID == enti.Id);

                if (writeOff != null)
                {
                    financialPreanalysis.EstimatedWriteOffCost = writeOff.TotalII;
                }
                var contributionMargin    = StoreCM.Get(usCode).ContributionMargin.ToString();
                var reimageConsInfo       = ReimageConsInfo.GetConsInfo(projectId);
                var reinvestmentBasicInfo = ReinvestmentBasicInfo.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id);
                if (reinvestmentBasicInfo != null)
                {
                    //ReinvestmentCost reinCost = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == enti.Id);
                    financialPreanalysis.IsMcCafe = reinvestmentBasicInfo.NewMcCafe;

                    if ((reinvestmentBasicInfo.NewAttachedKiosk.HasValue && reinvestmentBasicInfo.NewAttachedKiosk.Value) ||
                        (reinvestmentBasicInfo.NewRemoteKiosk.HasValue && reinvestmentBasicInfo.NewRemoteKiosk.Value))
                    {
                        financialPreanalysis.IsKiosk = true;
                    }
                    else
                    {
                        financialPreanalysis.IsKiosk = false;
                    }
                    financialPreanalysis.IsMDS             = reinvestmentBasicInfo.NewMDS;
                    financialPreanalysis.IsTwientyFourHour = reinvestmentBasicInfo.NewTwientyFourHour;
                    financialPreanalysis.StoreCM           = contributionMargin;

                    financialPreanalysis.GetNewAddBE();
                }
            }


            return(financialPreanalysis);
        }
예제 #3
0
        public Attachment GenerateExcel(out string filePath)
        {
            var att = GenerateAttachment(out filePath);

            var financialPreanalysis =
                FinancialPreanalysis.FirstOrDefault(e => e.RefId.ToString().Equals(att.RefTableID));

            if (financialPreanalysis != null)
            {
                var excelHandler = new ExcelToolHandler(filePath, "PMT");

                financialPreanalysis.ROI          = excelHandler.GetCellValue("E2").ToString();
                financialPreanalysis.PaybackYears = excelHandler.GetCellValue("E3").ToString();
                financialPreanalysis.MarginInc    = excelHandler.GetCellValue("E4").ToString();

                financialPreanalysis.Update();

                FinancialPreanalysis = financialPreanalysis;

                excelHandler.Dispose();
            }

            return(att);
        }