コード例 #1
0
        private void ImageRemoveSet(ImageRemove <PagamentoDocumenti> obj)
        {
            if (obj.GuidKey == this._INSTANCE_KEY)
            {
                if (!SettingDocumentiPagamentiValidator.CheckFolderPdfPagamenti())
                {
                    return;
                }

                var folderPagamenti = SettingDocumentiPagamentiValidator.ReadSetting().CartellaReteDocumentiPagamenti;

                using (var saveManager = new SaveEntityManager())
                {
                    var repo = saveManager.UnitOfWork.PagamentoDocumentiRepository;

                    var filePdf = obj.File.Entity;

                    var nomeFile = Path.Combine(folderPagamenti, filePdf.PathFile);

                    File.Delete(nomeFile);

                    var item = repo.Find(a => a.ID == filePdf.ID).First();
                    repo.Delete(item);

                    saveManager.SaveEntity("Rimossa immagine");
                }

                EventAggregator.Instance().Publish <ImageListUpdate>(new ImageListUpdate());
            }
        }
コード例 #2
0
        private void AddImageFiles(ImageAddFiles obj)
        {
            if (obj.GuidKey == this._INSTANCE_KEY)
            {
                if (!SettingDocumentiPagamentiValidator.CheckFolderPdfPagamenti())
                {
                    return;
                }

                var folderPagamenti = SettingDocumentiPagamentiValidator.ReadSetting().CartellaReteDocumentiPagamenti;

                using (var saveManager = new SaveEntityManager())
                {
                    var repo = saveManager.UnitOfWork.PagamentoDocumentiRepository;
                    foreach (var item in obj.Files)
                    {
                        var filePdf = item;

                        var info     = new FileInfo(filePdf);
                        var nomeFile = info.Name;
                        var dir      = Path.Combine(folderPagamenti, this._IDPagamentoMaster.ToString());
                        if (!Directory.Exists(dir))
                        {
                            Directory.CreateDirectory(dir);
                        }
                        File.Copy(filePdf, Path.Combine(dir, nomeFile));

                        repo.Add(new PagamentoDocumenti()
                        {
                            IDPagamentoMaster = this._IDPagamentoMaster,
                            FileName          = nomeFile,
                            Ordine            = 0,
                            PathFile          = Path.Combine(this._IDPagamentoMaster.ToString(), nomeFile),
                        });
                    }

                    saveManager.SaveEntity("Immagini aggiunte correttamente");

                    EventAggregator.Instance().Publish <ImageListUpdate>(new ImageListUpdate());
                }
            }
        }
コード例 #3
0
        internal List <ImmaginiFile <PagamentoDocumenti> > RefreshImageListData()
        {
            if (!SettingDocumentiPagamentiValidator.CheckFolderPdfPagamenti())
            {
                return(_listFotoArticolo = new List <ImmaginiFile <PagamentoDocumenti> >());
            }
            using (var uof = new UnitOfWork())
            {
                var setting = SettingDocumentiPagamentiValidator.ReadSetting();

                var imageList = uof.PagamentoDocumentiRepository.Find(a => a.IDPagamentoMaster == _IDPagamentoMaster)
                                .OrderBy(a => a.Ordine).ToList();

                _listFotoArticolo = imageList.Select(a =>
                                                     new ImmaginiFile <PagamentoDocumenti>(Path.Combine(
                                                                                               setting.CartellaReteDocumentiPagamenti, a.PathFile)
                                                                                           , a.FileName, a)).ToList();

                return(_listFotoArticolo.ToList());
            }
        }
コード例 #4
0
        private void ApriSettingDocPagamenti()
        {
            var setting = SettingDocumentiPagamentiValidator.ReadSetting();

            var view = new GenericSettingView(setting);
            {
                view.OnSave += (a, b) =>
                {
                    using (var cur = new CursorManager())
                    {
                        view.Validate();
                        using (var save = new SaveEntityManager())
                        {
                            save.UnitOfWork.SettingDocumentiPagamentiRepository.Update(setting);
                            save.SaveEntity(enSaveOperation.OpSave);
                        }
                    }
                };
                this.ShowView(view, enAmbiente.SettingSito);
            }
        }