public IHttpActionResult GetTTMAndRoI(string projectId, string usCode, string dateTime, string pageType = "") { string year = string.Empty; string month = string.Empty; if (!string.IsNullOrEmpty(dateTime)) { //string time=dateTime.Split(',')[0]; //time = time.Split(':')[1]; //year = time.Split('-')[0].Substring(1, 4); //month = time.Split('-')[1].Substring(0, 2); year = dateTime.Split('-')[0]; month = dateTime.Split('-')[1]; } var data = DataSync_LDW_AM_STFinanceData.FirstOrDefault(e => e.FinanceYear == year && e.FinanceMonth == month && e.UsCode == usCode); var data2 = DataSync_LDW_AM_STFinanceData2.FirstOrDefault(e => e.FinanceYear == year && e.FinanceMonth == month && e.UsCode == usCode); if (data != null) { data.SOI_TTM = Math.Round(CovertToDecimalPercent(data.SOIPct_TTM), 1).ToString(); } var financialPreanalysisDto = new FinancialPreanalysisDto(); financialPreanalysisDto.STFinanceData = data; var reimageSum = ReimageSummary.GetReimageSummaryInfo(projectId); if (reimageSum != null && reimageSum.FinancialPreanalysis != null) { financialPreanalysisDto.Id = reimageSum.FinancialPreanalysis.Id; if (!reimageSum.FinancialPreanalysis.TTMSales.HasValue) { financialPreanalysisDto.TTMSales = data == null ? 0 : Convert.ToDecimal(data.Total_Sales_TTM); } else { financialPreanalysisDto.TTMSales = reimageSum.FinancialPreanalysis.TTMSales; } financialPreanalysisDto.ROI = reimageSum.FinancialPreanalysis.ROI; financialPreanalysisDto.PaybackYears = reimageSum.FinancialPreanalysis.PaybackYears; if (string.IsNullOrEmpty(reimageSum.FinancialPreanalysis.PaybackYears)) { financialPreanalysisDto.CurrentPriceTier = data2 == null ? "" : data2.Price_Tier; } else { financialPreanalysisDto.CurrentPriceTier = reimageSum.FinancialPreanalysis.CurrentPriceTier; } } return(Ok(financialPreanalysisDto)); //} }
public IHttpActionResult GenerateReimageSummary(string projectId) { string filePath; var summary = ReimageSummary.Get(projectId); var att = summary.GenerateExcel(out filePath); return(Ok(att)); }
public IHttpActionResult GetReimageSummary(string projectId) { var reimageSummary = new ReimageSummary(); if (!string.IsNullOrEmpty(projectId)) { reimageSummary = ReimageSummary.Get(projectId); } return(Ok(reimageSummary)); }
public IHttpActionResult InitReimageSummary(string projectId, string entityId = "") { var entity = ReimageSummary.GetReimageSummaryInfo(projectId, entityId); return(Ok(new { entity = entity, isActor = ProjectUsers.IsRole(projectId, ClientCookie.UserCode, ProjectUserRoleCode.AssetActor) })); }
public IHttpActionResult RecallReimageSummary(ReimageSummary summary) { try { summary.Recall(summary.Comments); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult IsExistReimageSummaryAttachment(ReimageSummary entity) { try { var isExist = entity.IsExistReimageSummaryAttachment(); return(Ok(new { isExist })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
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 EditReimageSummary(ReimageSummary summary) { try { var taskUrl = summary.Edit(); return(Ok(new ProjectEditResult { TaskUrl = taskUrl })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
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 IHttpActionResult GetKeyMeasuresInfo(string projectId) { var reimage = ReimageConsInfo.GetConsInfo(projectId, ""); ReinvestmentCost reinCost = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == reimage.Id); var entity = ReimageSummary.FirstOrDefault(e => e.ProjectId.Equals(projectId) && e.IsHistory == false); var financialPreanalysis = new FinancialPreanalysis(); if (entity != null) { financialPreanalysis = FinancialPreanalysis.FirstOrDefault(e => e.RefId.Equals(entity.Id)); } if (reinCost != null) { financialPreanalysis.TotalReinvestmentNorm = reinCost.TotalReinvestmentNorm; } return(Ok(financialPreanalysis)); }
public IHttpActionResult GetSelectYearMonth(string projectId) { using (var amdb = new McdAMEntities()) { var selectItemList = new List <SelectItem>(); var uscode = ReimageInfo.FirstOrDefault(e => e.ProjectId == projectId).USCode; var reimageSummary = ReimageSummary.GetReimageSummaryInfo(projectId); if (reimageSummary != null) { var refId = reimageSummary.Id; var storeProfitabilityAndLeaseInfo = StoreProfitabilityAndLeaseInfo.FirstOrDefault(e => e.RefId == refId); var asOf = storeProfitabilityAndLeaseInfo != null ? storeProfitabilityAndLeaseInfo.AsOf : string.Empty; var yearMonthList = amdb.DataSync_LDW_AM_STFinanceData2.Where(f => f.UsCode == uscode).Select(i => new { financeYearMonth = i.FinanceYear + "-" + i.FinanceMonth }).Distinct().OrderByDescending(i => i.financeYearMonth).Take(12).ToList(); var ldw_financeData = LDW_FinanceData.Get(projectId); foreach (var _yearMonth in yearMonthList) { var selectItem = new SelectItem(); selectItem.name = _yearMonth.financeYearMonth; selectItem.value = _yearMonth.financeYearMonth; if (ldw_financeData != null) { selectItem.selected = _yearMonth.financeYearMonth == ldw_financeData.FinanceYear + "-" + ldw_financeData.FinanceMonth; } else { // selectItem.selected = false; selectItem.selected = _yearMonth.financeYearMonth == asOf; } selectItemList.Add(selectItem); } if (string.IsNullOrEmpty(asOf) && selectItemList.Count > 0) { selectItemList[0].selected = true; } } return(Ok(new { data = selectItemList })); } }
public IHttpActionResult SaveReimageSummary(ReimageSummary entity) { try { using (var scope = new TransactionScope()) { entity.Save(); string filePath; entity.GenerateExcel(out filePath); scope.Complete(); } return(Ok(entity)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult SubmitReimageSummary(ReimageSummary entity) { try { using (var scope = new TransactionScope()) { entity.Save(); string filePath; entity.GenerateExcel(out filePath); scope.Complete(); } entity.Submit(); return(Ok(entity)); } catch (Exception ex) { Log4netHelper.WriteErrorLog(JsonConvert.SerializeObject(ex)); return(BadRequest(ex.Message)); } }
public void LoadFinancialPreanalysisInfoTest() { var summary = new ReimageSummary(); //var financeInfo=summary.LoadFinancialPreanalysisInfo(); }
protected static BaseWFEntity GetEmptyWorkflowEntity(string flowCode) { BaseWFEntity wfEntity = null; switch (flowCode) { case FlowCode.MajorLease: wfEntity = new MajorLeaseInfo(); wfEntity.IsMainProject = true; break; case FlowCode.MajorLease_LegalReview: wfEntity = new MajorLeaseLegalReview(); break; case FlowCode.MajorLease_FinanceAnalysis: wfEntity = new MajorLeaseFinancAnalysis(); break; case FlowCode.MajorLease_ConsInfo: wfEntity = new MajorLeaseConsInfo(); break; case FlowCode.MajorLease_Package: wfEntity = new MajorLeaseChangePackage(); break; case FlowCode.MajorLease_ConsInvtChecking: wfEntity = new MajorLeaseConsInvtChecking(); break; case FlowCode.MajorLease_GBMemo: wfEntity = new MajorLeaseGBMemo(); break; case FlowCode.Closure: wfEntity = new ClosureInfo(); wfEntity.IsMainProject = true; break; case FlowCode.Closure_ClosurePackage: wfEntity = new ClosurePackage(); break; case FlowCode.Closure_ClosureTool: wfEntity = new ClosureTool(); break; case FlowCode.Closure_ConsInvtChecking: wfEntity = new ClosureConsInvtChecking(); break; case FlowCode.Closure_LegalReview: wfEntity = new ClosureLegalReview(); break; case FlowCode.Closure_WOCheckList: wfEntity = new ClosureWOCheckList(); break; case FlowCode.Closure_ExecutiveSummary: wfEntity = new ClosureExecutiveSummary(); break; case FlowCode.TempClosure: wfEntity = new TempClosureInfo(); wfEntity.IsMainProject = true; break; case FlowCode.TempClosure_LegalReview: wfEntity = new TempClosureLegalReview(); break; case FlowCode.TempClosure_ClosurePackage: wfEntity = new TempClosurePackage(); break; case FlowCode.Rebuild: wfEntity = new RebuildInfo(); wfEntity.IsMainProject = true; break; case FlowCode.Rebuild_LegalReview: wfEntity = new RebuildLegalReview(); break; case FlowCode.Rebuild_FinanceAnalysis: wfEntity = new RebuildFinancAnalysis(); break; case FlowCode.Rebuild_ConsInfo: wfEntity = new RebuildConsInfo(); break; case FlowCode.Rebuild_Package: wfEntity = new RebuildPackage(); break; case FlowCode.Rebuild_ConsInvtChecking: wfEntity = new RebuildConsInvtChecking(); break; case FlowCode.Rebuild_GBMemo: wfEntity = new GBMemo(); break; case FlowCode.Renewal: wfEntity = new RenewalInfo(); wfEntity.IsMainProject = true; break; case FlowCode.Renewal_Letter: wfEntity = new RenewalLetter(); break; case FlowCode.Renewal_LLNegotiation: wfEntity = new RenewalLLNegotiation(); break; case FlowCode.Renewal_ConsInfo: wfEntity = new RenewalConsInfo(); break; case FlowCode.Renewal_Tool: wfEntity = new RenewalTool(); break; case FlowCode.Renewal_Analysis: wfEntity = new RenewalAnalysis(); break; case FlowCode.Renewal_ClearanceReport: wfEntity = new RenewalClearanceReport(); break; case FlowCode.Renewal_ConfirmLetter: wfEntity = new RenewalConfirmLetter(); break; case FlowCode.Renewal_LegalApproval: wfEntity = new RenewalLegalApproval(); break; case FlowCode.Renewal_Package: wfEntity = new RenewalPackage(); break; case FlowCode.Renewal_GBMemo: wfEntity = new RenewalGBMemo(); break; case FlowCode.Reimage: wfEntity = new ReimageInfo(); wfEntity.IsMainProject = true; break; case FlowCode.Reimage_ConsInfo: wfEntity = new ReimageConsInfo(); break; case FlowCode.Reimage_Summary: wfEntity = new ReimageSummary(); break; case FlowCode.Reimage_Package: wfEntity = new ReimagePackage(); break; case FlowCode.Reimage_ConsInvtChecking: wfEntity = new ReimageConsInvtChecking(); break; case FlowCode.Reimage_GBMemo: wfEntity = new ReimageGBMemo(); break; } return(wfEntity); }
private string GenPrintReimageAttachment(ReimageInfo reimageInfo, ReimagePackage entity, PrintFileType fileType) { var storeInfo = StoreBasicInfo.GetStore(reimageInfo.USCode); StoreBasicInfo store = storeInfo.StoreBasicInfo; //生成Print文件 var printDic = new Dictionary <string, string>(); printDic.Add("WorkflowName", FlowCode.Reimage); printDic.Add("ProjectID", entity.ProjectId); printDic.Add("USCode", reimageInfo.USCode); printDic.Add("Region", store.RegionENUS); printDic.Add("Market", store.MarketENUS); printDic.Add("City", store.CityENUS); printDic.Add("AddressZHCN", store.AddressZHCN); printDic.Add("OpenDate", store.OpenDate.ToString("yyyy-MM-dd")); if (store.CloseDate.HasValue && store.CloseDate.Value.Year == 1900) { printDic.Add("ClosureDate", string.Empty); } else { printDic.Add("ClosureDate", store.CloseDate.HasValue ? (store.CloseDate.Value.ToString("yyyy-MM-dd")) : ""); } printDic.Add("AssetsManager", storeInfo.StoreDevelop.AssetMgrName); printDic.Add("AssetsRep", storeInfo.StoreDevelop.AssetRepName); printDic.Add("StoreAge", (DateTime.Now.Year - store.OpenDate.Year).ToString()); var currentLeaseENDYear = storeInfo.CurrentYear - int.Parse(storeInfo.StoreContractInfo.EndYear); printDic.Add("CurrentLeaseENDYear", currentLeaseENDYear.ToString()); printDic.Add("StoreNameEN", store.NameENUS); printDic.Add("StoreNameCN", store.NameENUS); var RmgSummaryentity = ReimageSummary.FirstOrDefault(e => e.ProjectId.Equals(entity.ProjectId) && e.IsHistory == false); var financialPreanalysis = FinancialPreanalysis.FirstOrDefault(e => e.RefId.Equals(RmgSummaryentity.Id)); printDic.Add("SalesBuildingInvestment", financialPreanalysis.SalesBuildingInvestment); printDic.Add("NoneSalesBuildingInvst", financialPreanalysis.NoneSalesBuildingInvst); printDic.Add("TTMSales", financialPreanalysis.TTMSales.HasValue ? Math.Round(financialPreanalysis.TTMSales.Value, 2).ToString() : string.Empty); var reimage = ReimageConsInfo.GetConsInfo(entity.ProjectId, ""); ReinvestmentCost reinCost = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == reimage.Id); printDic.Add("TotalReinvestmentNorm", reinCost.TotalReinvestmentNorm); printDic.Add("TotalSalesInc", financialPreanalysis.TotalSalesInc); printDic.Add("ROI", financialPreanalysis.ROI); ////printDic.Add("SalesInc", financialPreanalysis.ROI); printDic.Add("PaybackYears", financialPreanalysis.PaybackYears); printDic.Add("StoreCM", financialPreanalysis.StoreCM); printDic.Add("EstimatedWriteOffCost", financialPreanalysis.EstimatedWriteOffCost); printDic.Add("MarginInc", financialPreanalysis.MarginInc); printDic.Add("ISDWIP", financialPreanalysis.ISDWIP); printDic.Add("CurrStorePricingTier", financialPreanalysis.CurrentPriceTier); printDic.Add("SPTAR", financialPreanalysis.SPTAR); //Submission and Approval Records - 只显示通过意见 List <SubmissionApprovalRecord> recordList = new List <SubmissionApprovalRecord>(); //Submission and Approval Records Details — 所有意见 List <SubmissionApprovalRecord> recordDetailList = new List <SubmissionApprovalRecord>(); ProjectComment projectCommentBll = new ProjectComment(); ProjectCommentCondition condition = new ProjectCommentCondition(); var package = ReimagePackage.Get(entity.ProjectId); condition.RefTableName = ReimagePackage.TableName; condition.RefTableId = entity.Id; condition.SourceCode = FlowCode.Reimage; var commentList = VProjectComment.SearchVListForPDF(condition); var commentDetailList = VProjectComment.SearchVList(condition); SubmissionApprovalRecord record = null; foreach (var item in commentList) { record = new SubmissionApprovalRecord(); record.ActionName = item.ActionDesc; if (item.CreateTime != null) { record.OperationDate = item.CreateTime.Value; } record.OperatorID = item.UserAccount; record.OperatorName = item.UserNameENUS; record.OperatorTitle = item.PositionName; record.Comments = item.Content; recordList.Add(record); } foreach (var item in commentDetailList) { record = new SubmissionApprovalRecord(); record.ActionName = item.ActionDesc; if (item.CreateTime != null) { record.OperationDate = item.CreateTime.Value; } record.OperatorID = item.UserAccount; record.OperatorName = item.UserNameENUS; record.OperatorTitle = item.PositionName; record.Comments = item.Content; recordDetailList.Add(record); } string result = string.Empty; if (fileType == PrintFileType.Pdf) { result = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.Reimage, printDic, recordList, recordDetailList); } else { result = HtmlConversionUtility.ConvertToImage(HtmlTempalteType.Reimage, printDic, recordList, recordDetailList); } return(result); }
public IHttpActionResult Upload(string projectId, string refTableName, Guid?requirementId = null) { using (TransactionScope tranScope = new TransactionScope()) { var refTableId = Attachment.GetRefTableId(refTableName, projectId); if (refTableId == Guid.Empty.ToString()) { var newId = Guid.NewGuid(); refTableId = newId.ToString(); switch (refTableName) { case "MajorLeaseChangePackage": { var entity = new MajorLeaseChangePackage(); entity.ProjectId = projectId; entity.Id = newId; entity.CreateTime = DateTime.Now; entity.CreateUserAccount = ClientCookie.UserCode; entity.IsHistory = false; entity.Add(); } break; case "ReimageSummary": { var entity = new ReimageSummary(); entity.ProjectId = projectId; entity.Id = newId; entity.CreateTime = DateTime.Now; entity.CreateUserAccount = ClientCookie.UserCode; entity.IsHistory = false; entity.Add(); } break; case "ReimageConsInfo": { var entity = new ReimageConsInfo(); entity.ProjectId = projectId; entity.Id = newId; entity.CreateTime = DateTime.Now; entity.CreateUserAccount = ClientCookie.UserCode; entity.IsHistory = false; entity.Add(); } break; case "ReimagePackage": { var entity = new ReimagePackage(); entity.ProjectId = projectId; entity.Id = newId; entity.CreateTime = DateTime.Now; entity.CreateUserAccount = ClientCookie.UserCode; entity.IsHistory = false; entity.Add(); } break; case "RebuildLegalReview": { var entity = new RebuildLegalReview(); entity.ProjectId = projectId; entity.Id = newId; entity.CreateTime = DateTime.Now; entity.CreateUserAccount = ClientCookie.UserCode; entity.IsHistory = false; entity.Add(); } break; case "ClosureLegalReview": { var entity = new ClosureLegalReview(); entity.ProjectId = projectId; entity.Id = newId; entity.CreateTime = DateTime.Now; entity.CreateUserAccount = ClientCookie.UserCode; entity.IsHistory = false; entity.Add(); } break; case "ClosureExecutiveSummary": { var entity = new ClosureExecutiveSummary(); entity.ProjectId = projectId; entity.Id = newId; entity.CreateTime = DateTime.Now; entity.CreatorAccount = ClientCookie.UserCode; entity.IsHistory = false; entity.Add(); } break; case "ClosurePackage": { var entity = new ClosurePackage(); entity.ProjectId = projectId; entity.Id = newId; entity.CreateTime = DateTime.Now; entity.CreateUserAccount = ClientCookie.UserCode; entity.IsHistory = false; entity.Add(); } break; } } var userRole = ProjectUsers.Get(ClientCookie.UserCode, projectId); var files = HttpContext.Current.Request.Files; if (requirementId.HasValue) { var attReq = AttachmentRequirement.Get(requirementId.Value); var projectInfo = ProjectInfo.Get(projectId, attReq.FlowCode); var store = StoreBasicInfo.GetStorInfo(projectInfo.USCode); var attachNode = NodeInfo.FirstOrDefault(n => n.FlowCode == attReq.FlowCode && n.Code == attReq.NodeCode); if (attachNode != null) { ProjectInfo.FinishNode(projectId, attReq.FlowCode, attReq.NodeCode); } var file = files[0]; string fileName = Path.GetFileName(file.FileName); string fileExtension = Path.GetExtension(file.FileName); var current = System.Web.HttpContext.Current; string internalName = Guid.NewGuid() + fileExtension; string absolutePath = current.Server.MapPath("~/") + "UploadFiles/" + internalName; file.SaveAs(absolutePath); Attachment att = Attachment.Get(refTableId, requirementId.Value); if (att == null) { att = new Attachment(); att.InternalName = internalName; att.RefTableName = refTableName; att.RefTableID = refTableId; att.RelativePath = "//"; att.Name = fileName; att.Extension = fileExtension; att.Length = file.ContentLength; att.CreateTime = DateTime.Now; att.CreatorNameZHCN = ClientCookie.UserNameZHCN; att.CreatorNameENUS = ClientCookie.UserNameENUS; att.CreatorID = ClientCookie.UserCode; att.ID = Guid.NewGuid(); att.RequirementId = requirementId; att.TypeCode = ""; Attachment.Add(att); } else { att.InternalName = internalName; att.RefTableName = refTableName; att.RefTableID = refTableId; att.RelativePath = "//"; att.Name = fileName; att.Extension = fileExtension; att.Length = file.ContentLength; att.CreateTime = DateTime.Now; att.CreatorNameZHCN = ClientCookie.UserNameZHCN; att.CreatorNameENUS = ClientCookie.UserNameENUS; att.CreatorID = ClientCookie.UserCode; Attachment.Update(att); } //TempClosure上传SignAgreement //if (requirementId.Value.Equals(new Guid("1E9B17AF-357A-4DC9-8A60-17766663FB75"))) //{ // var url = "/TempClosure/Main#/ClosureMemo?projectId=" + projectId; // var actor = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == projectId && pu.RoleCode == ProjectUserRoleCode.AssetActor); // var title = string.Concat(projectId, " ", store.NameZHCN, " ", store.NameENUS); // TaskWork.Finish(t => t.ReceiverAccount == ClientCookie.UserCode && t.RefID == projectId && t.Status == TaskWorkStatus.UnFinish && t.TypeCode == FlowCode.TempClosure_ClosurePackage); // //TaskWork.SendTask(projectId, title, projectInfo.USCode, url, actor, FlowCode.TempClosure, FlowCode.TempClosure_ClosureMemo, "Start"); //} } else { List <Attachment> attachments = new List <Attachment>(); string typeCode = ""; if (refTableName == "RebuildLegalReview") { typeCode = "Contract"; } for (int i = 0; i < files.Count; i++) { var file = files[i]; string fileName = Path.GetFileName(file.FileName); string fileExtension = Path.GetExtension(file.FileName); var current = System.Web.HttpContext.Current; string internalName = Guid.NewGuid() + fileExtension; string absolutePath = current.Server.MapPath("~/") + "UploadFiles/" + internalName; file.SaveAs(absolutePath); Attachment att = new Attachment(); att.InternalName = internalName; att.RefTableName = refTableName; att.RefTableID = refTableId; att.RelativePath = "//"; att.Name = fileName; att.Extension = fileExtension; att.Length = file.ContentLength; att.CreateTime = DateTime.Now; att.CreatorNameZHCN = ClientCookie.UserNameZHCN; att.CreatorNameENUS = ClientCookie.UserNameENUS; att.CreatorID = ClientCookie.UserCode; att.ID = Guid.NewGuid(); att.RequirementId = requirementId; att.TypeCode = typeCode; attachments.Add(att); } Attachment.Add(attachments.ToArray()); } tranScope.Complete(); return(Ok()); } }
public IHttpActionResult GetStoreProfitabilityAndLeaseInfo(string projectId, string pageType = "") { StoreProfitabilityAndLeaseInfo store = new StoreProfitabilityAndLeaseInfo(); var reimageSummary = ReimageSummary.FirstOrDefault(e => e.ProjectId == projectId && e.IsHistory == false); if (reimageSummary != null) { store = StoreProfitabilityAndLeaseInfo.FirstOrDefault(e => e.RefId == reimageSummary.Id); } if (store != null) { if (store.Id != 0) { pageType = "save"; } } if (pageType == "") { //var resultStoreAllInfo = storeBll.GetStoreDetailsByEID(eid, usCode); var reimageInfo = ReimageInfo.FirstOrDefault(e => e.ProjectId == 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; } } //var stFinanceData = // Mcdonalds.AM.DataAccess.DataSync_LDW_AM_STFinanceData.OrderByDescending(e => e.FinanceYear == DateTime.Now.Year.ToString(), // e => e.FinanceMonth).FirstOrDefault(); //if (stFinanceData == null) //{ // throw new Exception("Could not get the latest finance month data!"); //} //var latestMonth = stFinanceData.FinanceMonth; //var data = Mcdonalds.AM.DataAccess.DataSync_LDW_AM_STFinanceData.FirstOrDefault(e => e.FinanceYear == DateTime.Now.Year.ToString() && e.FinanceMonth == latestMonth && e.UsCode == stFinanceData.UsCode); //store.AsOf =DateTime.Parse(DateTime.Now.Year + "/" + latestMonth + "/01"); //store.TTMSales = data.Total_Sales_TTM.As<decimal>(); //store.TTMSOIPercent = data.SOIPct_TTM.As<decimal>(); if (store == null) { store = new StoreProfitabilityAndLeaseInfo(); } DateTime?dt = storeBasicInfo.ReImageDate; if (dt != null) { if (dt.ToString().Substring(0, 8) == "1/1/1900") { dt = null; } } store.LastRemodelDate = dt; store.RemainingLeaseYears = Year; } return(Ok(store)); }