Ejemplo n.º 1
0
        public string ExportDoc()
        {
            var result = this.LoadData();

            return(DownloadFileService.Load("procurementPlanReport.doc", "年度采购计划报告.doc", new string[] { })
                   .ExcuteDoc(result.OrderBy(r => r.Category).ToList(), this.ExportToDoc));
        }
Ejemplo n.º 2
0
 public DownloadListViewModel()
 {
     _downloadFileService = new DownloadFileService();
     DownloadAllCmd       = new DownloadCommand(DownloadAll);
     CancelAllCmd         = new DownloadCommand(CancelAll);
     LoadFiles();
 }
        public void SetUp()
        {
            this.fileExtensionMethodsTestFixture = new FileExtensionMethodsTestFixture();
            this.fileExtensionMethodsTestFixture.Setup();

            this.serviceLocator = this.fileExtensionMethodsTestFixture.ServiceLocator;
            ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object);

            this.messageBoxService = new Mock <IMessageBoxService>();
            this.serviceLocator.Setup(x => x.GetInstance <IMessageBoxService>()).Returns(this.messageBoxService.Object);

            this.session      = this.fileExtensionMethodsTestFixture.Session;
            this.fileRevision = this.fileExtensionMethodsTestFixture.FileRevision;

            this.file = new File();
            this.file.FileRevision.Add(this.fileRevision);

            this.downloadFileViewModel = new Mock <IDownloadFileViewModel>();
            this.downloadFileViewModel.Setup(x => x.Session).Returns(this.session.Object);

            this.session.Setup(x => x.ReadFile(this.fileRevision))
            .Callback(() =>
            {
                this.downloadFileViewModel.VerifySet(x => x.IsBusy         = true, Times.Once);
                this.downloadFileViewModel.VerifySet(x => x.IsBusy         = false, Times.Never);
                this.downloadFileViewModel.VerifySet(x => x.LoadingMessage = It.IsAny <string>(), Times.Once);
                System.Threading.Thread.Sleep(500);
                this.session.Verify(x => x.CanCancel(), Times.AtLeastOnce);
            })
            .ReturnsAsync(new byte[1]);

            this.service = new DownloadFileService();
        }
Ejemplo n.º 4
0
        public string ExportExs()
        {
            var result = this.LoadData();

            return(DownloadFileService.Load("procurementPlan.xls", "年度采购计划.xls", new string[] { })
                   .ExcuteXls(result.OrderBy(r => r.Category).ToList(), this.ExportToXls));
        }
Ejemplo n.º 5
0
        public string ExportExs()
        {
            var result = stockRepository.GetAllList();
            var dtos   = result.MapTo <List <StockListDto> >();

            return(DownloadFileService.Load("Stock.xls", "库存清单.xls", new string[] { })
                   .ExcuteXls(dtos.OrderBy(r => r.ProductName).ToList(), this.ExportToXls));
        }
Ejemplo n.º 6
0
        public string ExportExs(DateTime dateFrom, DateTime dataTo)
        {
            var result = LoadData(dateFrom, dataTo);
            var dtos   = result.MapTo <List <HisStockListDto> >();

            return(DownloadFileService.Load("HisStock.xls", "出入库记录.xls", new string[] { })
                   .ExcuteXls(dtos.OrderBy(r => r.ProductName).ToList(), this.ExportToXls));
        }
        public string ExportDoc2(Guid id)
        {
            var bid  = this._bidOpeningManagementRepository.Get(id);
            var plan = this._procurementPlanRepository.Get(bid.PlanId);

            var result = new KeyValue <BidOpeningManagement, ProcurementPlan>(bid, plan);

            return(DownloadFileService.Load("中标通知书模板.doc", $"中标通知书.doc", new string[] { })
                   .ExcuteDoc(result, this.ExportToDoc2));
        }
Ejemplo n.º 8
0
        public string Print(Guid id)
        {
            var old = this._processManagementRepository.Get(id);

            old.Status = ProcessStatus.NoticePrinted;
            this._processManagementRepository.Update(old);

            return(DownloadFileService.Load("LetterOfAcceptance.doc", "中标通知书.doc", new string[] { })
                   .ExcuteDoc(old, this.ExportToDoc));
        }
        public string ExportDoc3(Guid id)
        {
            var bid  = this._bidOpeningManagementRepository.Get(id);
            var plan = this._procurementPlanRepository.Get(bid.PlanId);
            var bil  = this._biddingManagementRepository.FirstOrDefault(r => r.PlanId == bid.PlanId);

            var result = new KeyValue <BidOpeningManagement, ProcurementPlan, BiddingManagement>(bid, plan, bil);

            return(DownloadFileService.Load("招投标计划模板.docx", $"招投标计划.docx", new string[] { })
                   .ExcuteDoc(result, this.ExportToDoc3));
        }
        public string ExportDoc(Guid id)
        {
            var item    = this._biddingManagementRepository.Get(id);
            var plan    = this._procurementPlanRepository.Get(item.PlanId);
            var details = this._costListRepository.GetAllList(r => r.BiddingManagementId == id);
            var result  = new KeyValue <BiddingManagement, ProcurementPlan, List <CostList> >(item, plan, details);

            if (plan.Category == ProcurementPlanCategory.Xxhcg)
            {
                return(DownloadFileService.Load("信息化采购模板.doc", $"中国人民武装警察部队四川省边防总队{plan.Name}招标文件.doc", new string[] { })
                       .ExcuteDoc(result, this.ExportToDoc));
            }

            if (plan.Category == ProcurementPlanCategory.Zccg)
            {
                return(DownloadFileService.Load("资产采购模板.doc", $"中国人民武装警察部队四川省边防总队{plan.Name}招标文件.doc", new string[] { })
                       .ExcuteDoc(result, this.ExportToDoc));
            }

            //Todo: 处理其他报告类型
            throw new Exception("未处理");
        }
Ejemplo n.º 11
0
        protected bool InstallTemplates(string targetFolder)
        {
            FileStorageService.Instance.CleanTempFolder();
            UnpackBuiltInButton.IsEnabled = false;
            var zipFilePath = string.Empty;

            if (DownloadTemplates.IsChecked.HasValue && DownloadTemplates.IsChecked.Value)
            {
                var downloadService = new DownloadFileService();
                if (!downloadService.TryDownloadFromUrl(TemplateZipUrl, out zipFilePath))
                {
                    MessageBox.Show($"Downloading from:\n{TemplateZipUrl} failed.\n\n{downloadService.Message} ");
                    UnpackBuiltInButton.IsEnabled = true;
                    return(false);
                }
            }

            if (Directory.EnumerateDirectories(targetFolder).Any())
            {
                var overwriteConfirmResult = MessageBox.Show(
                    "This will overwrite any templates with matching folder names in this root folder.\nAre you sure you want to continue?\n\nNote: Always make your template modifications in copied folders and never directly in the original example templates.",
                    "Confirm", MessageBoxButton.YesNo);
                if (overwriteConfirmResult != MessageBoxResult.Yes)
                {
                    UnpackBuiltInButton.IsEnabled = true;
                    return(false);
                }
            }

            var templateInstallService = new TemplateInstallService(targetFolder, zipFilePath);
            var success = templateInstallService.Install();

            MessageBox.Show(success ? "Templates installed" : "Could not install templates.", "", MessageBoxButton.OK);
            UnpackBuiltInButton.IsEnabled = true;
            FileStorageService.Instance.RemoveTempFolder();
            return(success);
        }
 public string ExportDoc1(Guid id)
 {
     return(DownloadFileService.Load("审计结果公示模板.doc", "审计结果公示.doc", new string[] { })
            .ExcuteDoc(id.ToString(), this.ExportToDoc1));
 }
 public string ExportDoc3()
 {
     return(DownloadFileService.Load("年度采购工作情况报告模板.doc", "年度采购工作情况报告.doc", new string[] { })
            .ExcuteDoc(null, this.ExportToDoc3));
 }
Ejemplo n.º 14
0
 public string ExportDoc()
 {
     return(DownloadFileService.Load("黑名单函模板.doc", "黑名单函.doc", new string[] { })
            .ExcuteDoc(null, this.ExportToDoc));
 }
 public string ExportDoc1(Guid id)
 {
     return(DownloadFileService.Load("履约保证金抵扣没收通知书模板.docx", "履约保证金抵扣没收通知书.docx", new string[] { })
            .ExcuteDoc(id, this.ExportToDoc1));
 }
Ejemplo n.º 16
0
        public string Export()
        {
            var codes = this._layerRepository.GetAll()
                        .Where(r => r.Category == DictionaryCategory.Budget_Account)
                        .OrderBy(r => r.LevelCode).Select(r => new { Code = r.LevelCode, r.Name }).ToList();
            var list     = this.GetBudgetPerformances();
            var newCodes = list.Select(r => r.Code).ToList();

            foreach (var item in list)
            {
                GetNewCode(item.Code);
            }


            void GetNewCode(string code)
            {
                if (!newCodes.Contains(code))
                {
                    newCodes.Add(code);
                }
                if (code.Length > 1)
                {
                    var code2 = code.Substring(0, code.Length - 1);
                    GetNewCode(code2);
                }
            }

            newCodes.Sort();
            var result = new List <BudgetPerformanceListDto>
            {
                new BudgetPerformanceListDto
                {
                    Code    = string.Empty,
                    Id      = Guid.NewGuid(),
                    Name    = string.Empty,
                    Total4  = list.Sum(r => r.Total4),
                    Total10 = list.Sum(r => r.Total10),
                    Total12 = list.Sum(r => r.Total12),
                    Total13 = list.Sum(r => r.Total13),
                    Total14 = list.Sum(r => r.Total14),
                    Total16 = list.Sum(r => r.Total16),
                    Total17 = list.Sum(r => r.Total17),
                    Total18 = list.Sum(r => r.Total18),
                    Total19 = list.Sum(r => r.Total19),
                    Total2  = list.Sum(r => r.Total2),
                    Total22 = list.Sum(r => r.Total22),
                    Total24 = list.Sum(r => r.Total24),
                    Total25 = list.Sum(r => r.Total25),
                    Total3  = list.Sum(r => r.Total3),
                    Total5  = list.Sum(r => r.Total5),
                    Total8  = list.Sum(r => r.Total8),
                    Total9  = list.Sum(r => r.Total9)
                }
            };

            foreach (var code in newCodes)
            {
                var item = list.FirstOrDefault(r => r.Code == code);
                if (item == null)
                {
                    var codeName = codes.FirstOrDefault(r => r.Code == code);
                    if (codeName == null)
                    {
                        continue;
                    }

                    item = new BudgetPerformanceListDto
                    {
                        Code   = codeName.Code,
                        Id     = Guid.NewGuid(),
                        Name   = codeName.Name,
                        Total4 = -1234 // 给个特定值,填充行数据时替换成空
                    };
                }

                result.Add(item);
            }

            return(DownloadFileService.Load("budgetOutlay.xls", "预算执行情况.xls", new string[] { })
                   .ExcuteXls(result, this.ExportToXls));
        }
 public string ExportDoc2(Guid id)
 {
     return(DownloadFileService.Load("年度采购工作情况报告模板.doc", "年度采购工作情况报告.doc", new string[] { })
            .ExcuteDoc(id.ToString(), this.ExportToDoc2));
 }