public IHttpActionResult Save(StoreSTLocation store) { using (var scope = new TransactionScope()) { //store.Save(); Mapper.CreateMap <StoreSTLocation, StoreSTLocationHistory>(); var history = Mapper.Map <StoreSTLocationHistory>(store); var his = StoreSTLocationHistory.FirstOrDefault(e => e.RefId == store.ProjectIdentifier); if (his == null) { history.Id = Guid.NewGuid(); history.RefId = store.ProjectIdentifier; } else { history.Id = his.Id; history.RefId = store.ProjectIdentifier; } history.Save(); if (store.EstimatedVsActualConstruction != null) { store.EstimatedVsActualConstruction.Save(); } scope.Complete(); } return(Ok()); }
public IHttpActionResult GetSiteInfo(string usCode, Guid identifier, string projectId = "", string flowCode = "") { var storeSTLocation = StoreSTLocation.GetStoreSTLocation(usCode); var history = StoreSTLocationHistory.FirstOrDefault(e => e.RefId == identifier); if (history != null) { Mapper.CreateMap <StoreSTLocationHistory, StoreSTLocation>(); storeSTLocation = Mapper.Map <StoreSTLocation>(history); } if (!string.IsNullOrEmpty(projectId) && !string.IsNullOrEmpty(flowCode)) { var wfEntity = BaseWFEntity.GetWorkflowEntity(projectId, BaseWFEntity.GetMainProjectFlowCode(flowCode)); var designStyle = wfEntity.GetDesignStypleForSiteInfo(); if (!string.IsNullOrEmpty(designStyle)) { storeSTLocation.DesignStyle = designStyle; } } storeSTLocation.ProjectIdentifier = identifier; return(Ok(storeSTLocation)); }
public ActionResult StoreSTLocationQuery(string _USCode) { var mStoreSTLocation = StoreSTLocation.GetStoreSTLocationStoreList(_USCode); string result = JsonConvert.SerializeObject(mStoreSTLocation); return(Content(result)); }
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)); }
public IHttpActionResult GetStoreSTLocationInfo(string storeCode) { var entity = StoreSTLocation.GetStoreSTLocation(storeCode); if (entity != null) { var storeBasicInfo = StoreBasicInfo.FirstOrDefault(e => e.StoreCode == entity.StoreCode); if (storeBasicInfo != null) { entity.StoreTypeName = storeBasicInfo.StoreTypeName; } } return(Ok(entity)); }
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)); }
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)); }
public IHttpActionResult Submit(StoreSTLocation store) { using (var scope = new TransactionScope()) { //store.Save(); Mapper.CreateMap <StoreSTLocation, StoreSTLocationHistory>(); var history = Mapper.Map <StoreSTLocationHistory>(store); var his = StoreSTLocationHistory.FirstOrDefault(e => e.RefId == store.ProjectIdentifier); var project = ProjectInfo.Get(store.ProjectIdentifier); if (his == null) { history.Id = Guid.NewGuid(); history.RefId = store.ProjectIdentifier; } else { history.Id = his.Id; history.RefId = store.ProjectIdentifier; } history.Save(); if (store.EstimatedVsActualConstruction != null) { store.EstimatedVsActualConstruction.Save(); } TaskWork.Finish(t => t.ReceiverAccount == ClientCookie.UserCode && t.TypeCode == FlowCode.Renewal_SiteInfo && t.RefID == project.ProjectId); ProjectInfo.FinishNode(project.ProjectId, FlowCode.Renewal_SiteInfo, NodeCode.Finish, ProjectStatus.Finished); ProjectInfo.CompleteMainIfEnable(project.ProjectId); if (ProjectInfo.IsFlowFinished(project.ProjectId, FlowCode.Renewal_ContractInfo)) { ProjectProgress.SetProgress(project.ProjectId, "100%"); } scope.Complete(); } return(Ok()); }
public IHttpActionResult StoreSave(StoreSTLocation store) { store.Save(); return(Ok("SUCCESS")); }
public IHttpActionResult GetStoreSiteInfo(string usCode) { var storeSTLocation = StoreSTLocation.GetStoreSTLocation(usCode); return(Ok(storeSTLocation)); }
public IHttpActionResult Submit(StoreSTLocation store) { store.Submit(true); return(Ok("SUCCESS")); }
public IHttpActionResult UpdateStoreLocation(StoreSTLocation stl) { stl.Update(); return(Ok()); }
public override void Input(ExcelWorksheet worksheet, ExcelInputDTO inputInfo) { var projectInfo = ProjectInfo.FirstOrDefault(e => e.ProjectId == inputInfo.ProjectId); if (projectInfo == null) { throw new Exception("Cannot find the project info!"); } var store = StoreBasicInfo.Search(e => e.StoreCode == projectInfo.USCode).FirstOrDefault(); if (store == null) { throw new Exception("Cannot find Store info!"); } var reimageSummary = BaseWFEntity.GetWorkflowEntity(inputInfo.ProjectId, FlowCode.Reimage_Summary) as ReimageSummary; if (reimageSummary == null) { throw new Exception("Cannot find Reimage Summary Info!"); } var storeSTLocation = StoreSTLocation.GetStoreSTLocation(projectInfo.USCode); var storeLeaseInfo = new StoreProfitabilityAndLeaseInfo(); var reimageConsInfo = ReimageConsInfo.GetConsInfo(inputInfo.ProjectId); var reinvestment = ReinvestmentBasicInfo.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id); if (reimageSummary != null) { storeLeaseInfo = StoreProfitabilityAndLeaseInfo.FirstOrDefault(e => e.RefId == reimageSummary.Id); if (storeLeaseInfo != null) { if (storeLeaseInfo.LastRemodelDate.HasValue && storeLeaseInfo.LastRemodelDate.Value.ToString("yyyy-MM-dd") != "1900-01-01") { worksheet.Cells["B43"].Value = storeLeaseInfo.LastRemodelDate; } worksheet.Cells["B44"].Value = storeLeaseInfo.RemainingLeaseYears; worksheet.Cells["B46"].Value = storeLeaseInfo.TTMSOIPercent / 100; worksheet.Cells["B47"].Value = storeLeaseInfo.AsOf; worksheet.Cells["B48"].Value = reimageSummary.OperationRequirements; var financial = FinancialPreanalysis.FirstOrDefault(e => e.RefId == reimageSummary.Id); worksheet.Cells["B49"].Value = TryParseDecimal(financial.TotalSalesInc); worksheet.Cells["B45"].Value = financial.TTMSales; worksheet.Cells["B50"].Value = TryParseDecimal(financial.StoreCM) * 100 + "%"; worksheet.Cells["B51"].Value = financial.CurrentPriceTier; worksheet.Cells["B52"].Value = string.IsNullOrEmpty(financial.SPTAR) ? 0 : financial.SPTAR.As <decimal>(); worksheet.Cells["B53"].Value = financial.PriceTierafterReimage; } //worksheet.Cells["E4"].Value = financial.MarginInc; } else { var reimageInfo = ReimageInfo.FirstOrDefault(e => e.ProjectId == inputInfo.ProjectId); var storeBasicInfo = StoreBasicInfo.FirstOrDefault(e => e.StoreCode == reimageInfo.USCode); var storeContractInfo = StoreContractInfo.FirstOrDefault(e => e.StoreCode == reimageInfo.USCode); int Year = 0; if (storeContractInfo != null) { if (storeContractInfo.EndDate != null) { DateTime dtNow = DateTime.Now; Year = int.Parse(storeContractInfo.EndDate.ToString().Split('/')[2].Substring(0, 4)) - dtNow.Year; } } DateTime?dt = storeBasicInfo.ReImageDate; if (dt != null) { if (dt.ToString().Substring(0, 8) == "1/1/1900") { dt = null; } } worksheet.Cells["B43"].Value = dt; worksheet.Cells["B44"].Value = Year; //storeLeaseInfo.LastRemodelDate = dt; //storeLeaseInfo.RemainingLeaseYears = Year; } ReinvestmentCost cost = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id); worksheet.Cells["B2"].Value = store.Region; worksheet.Cells["B3"].Value = store.StoreCode; if (reinvestment != null) { worksheet.Cells["B8"].Value = TryParseDecimal(reinvestment.RightSizingSeatNo); worksheet.Cells["B11"].Value = TryParseDecimal(reinvestment.EstimatedSeatNo); worksheet.Cells["B41"].Value = reinvestment.GBDate; worksheet.Cells["B42"].Value = reinvestment.ConsCompletionDate; } if (cost != null) { worksheet.Cells["B13"].Value = TryParseDecimal(cost.DesignFee); worksheet.Cells["B14"].Value = TryParseDecimal(cost.PublicBudget); worksheet.Cells["B15"].Value = TryParseDecimal(cost.BuildingFacade); worksheet.Cells["B16"].Value = TryParseDecimal(cost.SiteBudget); worksheet.Cells["B17"].Value = TryParseDecimal(cost.BuildingWork); worksheet.Cells["B18"].Value = TryParseDecimal(cost.PlumbingSystem); worksheet.Cells["B19"].Value = TryParseDecimal(cost.ElectricalSystem); worksheet.Cells["B20"].Value = TryParseDecimal(cost.HVACDuctSystem); worksheet.Cells["B21"].Value = TryParseDecimal(cost.Signage); worksheet.Cells["B22"].Value = TryParseDecimal(cost.Seating); worksheet.Cells["B23"].Value = TryParseDecimal(cost.Decor); worksheet.Cells["B24"].Value = TryParseDecimal(cost.Kiosk); worksheet.Cells["B25"].Value = TryParseDecimal(cost.McCafe); worksheet.Cells["B26"].Value = TryParseDecimal(cost.MDS); worksheet.Cells["B27"].Value = TryParseDecimal(cost.Playland); worksheet.Cells["B28"].Value = TryParseDecimal(cost.KitchenCapacityUpgrade); worksheet.Cells["B29"].Value = TryParseDecimal(cost.BuildingWorks); worksheet.Cells["B30"].Value = TryParseDecimal(cost.KitchenEquipment); worksheet.Cells["B31"].Value = TryParseDecimal(cost.HVAC); worksheet.Cells["B32"].Value = TryParseDecimal(cost.Plumbing); worksheet.Cells["B33"].Value = TryParseDecimal(cost.ElectricDistribution); worksheet.Cells["B34"].Value = TryParseDecimal(cost.Structure); worksheet.Cells["B35"].Value = TryParseDecimal(cost.Others); worksheet.Cells["B36"].Value = TryParseDecimal(cost.LHIPMAct); worksheet.Cells["B37"].Value = TryParseDecimal(cost.SignagePMAct); worksheet.Cells["B38"].Value = TryParseDecimal(cost.EquipmentPMAct); worksheet.Cells["B39"].Value = TryParseDecimal(cost.SeatingPackagePMAct); worksheet.Cells["B40"].Value = TryParseDecimal(cost.DecorPMAct); } worksheet.Cells["B5"].Value = storeSTLocation.TotalArea.As <decimal>(); worksheet.Cells["B6"].Value = store.ProvinceZHCN; worksheet.Cells["B7"].Value = store.NameZHCN; worksheet.Cells["B4"].Value = TryParseDecimal(storeSTLocation.TotalSeatsNo); worksheet.Cells["B9"].Value = TryParseDecimal(storeSTLocation.KitchenArea); worksheet.Cells["B10"].Value = store.CityZHCN; if (!string.IsNullOrEmpty(storeSTLocation.DesignStyle)) { var dict = Dictionary.FirstOrDefault(i => i.Code == storeSTLocation.DesignStyle); if (dict != null) { worksheet.Cells["B12"].Value = dict.NameZHCN; } else { worksheet.Cells["B12"].Value = storeSTLocation.DesignStyle; } } //worksheet.Cells["B24"].Value = reimageSummary.ReinvestmentBasicInfo.NewKiosk; //worksheet.Cells["B25"].Value = reimageSummary.ReinvestmentBasicInfo.NewMcCafe; //worksheet.Cells["B26"].Value = reimageSummary.ReinvestmentBasicInfo.NewMDS; //worksheet.Cells["B41"].Value = reimageSummary.ReinvestmentBasicInfo.GBDate; //worksheet.Cells["B42"].Value = reimageSummary.ReinvestmentBasicInfo.ConsCompletionDate; worksheet.Cells["B10"].Value = store.CityZHCN; //worksheet.Cells["B11"].Value = inputInfo.StoreType; //worksheet.Cells["B12"].Value = inputInfo.StoreType; //worksheet.Cells["B13"].Value = inputInfo.StoreType; //worksheet.Cells["B14"].Value = inputInfo.StoreType; //worksheet.Cells["B15"].Value = inputInfo.StoreType; //worksheet.Cells["B16"].Value = inputInfo.StoreType; //worksheet.Cells["B17"].Value = inputInfo.StoreType; //worksheet.Cells["B18"].Value = inputInfo.StoreType; //worksheet.Cells["B19"].Value = inputInfo.StoreType; //worksheet.Cells["B20"].Value = inputInfo.StoreType; //worksheet.Cells["B21"].Value = inputInfo.StoreType; //worksheet.Cells["B22"].Value = inputInfo.StoreType; //worksheet.Cells["B23"].Value = inputInfo.StoreType; //worksheet.Cells["B27"].Value = inputInfo.StoreType; //worksheet.Cells["B28"].Value = inputInfo.StoreType; //worksheet.Cells["B29"].Value = inputInfo.StoreType; //worksheet.Cells["B30"].Value = inputInfo.StoreType; //worksheet.Cells["B31"].Value = inputInfo.StoreType; //worksheet.Cells["B32"].Value = inputInfo.StoreType; //worksheet.Cells["B33"].Value = inputInfo.StoreType; //worksheet.Cells["B34"].Value = inputInfo.StoreType; //worksheet.Cells["B35"].Value = inputInfo.StoreType; //worksheet.Cells["B36"].Value = inputInfo.StoreType; //worksheet.Cells["B37"].Value = inputInfo.StoreType; //worksheet.Cells["B38"].Value = inputInfo.StoreType; //worksheet.Cells["B39"].Value = inputInfo.StoreType; //worksheet.Cells["B40"].Value = inputInfo.StoreType; //if (reimageSummary.StoreProfitabilityAndLeaseInfo != null) //{ // worksheet.Cells["B43"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.LastRemodelDate; // worksheet.Cells["B44"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.RemainingLeaseYears; // worksheet.Cells["B45"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.TTMSales; // worksheet.Cells["B46"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.TTMSOIPercent; // worksheet.Cells["B47"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.AsOf; //} ////worksheet.Cells["B48"].Value = reimageSummary.OperationRequirements; //if (reimageSummary.FinancialPreanalysis != null) //{ // worksheet.Cells["B49"].Value = reimageSummary.FinancialPreanalysis.TotalSalesInc; // worksheet.Cells["B50"].Value = reimageSummary.FinancialPreanalysis.StoreCM; // worksheet.Cells["B51"].Value = reimageSummary.FinancialPreanalysis.CurrentPriceTier; // worksheet.Cells["B52"].Value = reimageSummary.FinancialPreanalysis.ISDWIP; // worksheet.Cells["B53"].Value = reimageSummary.FinancialPreanalysis.SPTAR; //} }