Exemple #1
0
        /// <summary>
        /// CheckIn del documento corrente MTEXT
        /// </summary>
        private void CheckInMTextDocument(String file)
        {
            // Salvataggio del docNumber del documento in CheckOut
            String docNumber = CheckOutContext.Current.Status.DocumentNumber;

            // Estrai porzione del path di interesse per M/TEXT
            file = file.Substring(8);

            // Accedi a MTEXT per prelevare il PDF
            MTextModelProvider mtext = ModelProviderFactory <MTextModelProvider> .GetInstance();

            // Preleva contenuto PDF
            Byte[] content = mtext.ExportDocument(file, "application/pdf");

            // Fai sembrare il file M/TEXT un file FDF
            CheckOutContext.Current.Status.DocumentLocation = "mtext.pdf";

            // Effettua il checkin del documento
            ValidationResultInfo result = CheckInOutServices.CheckInDocument(content);

            // Salva l'FQN del file M/TEXT
            DocsPaWebService ws = new DocsPaWebService();

            ws.SetMTextFullQualifiedName(new MTextDocumentInfo()
            {
                DocumentDocNumber = docNumber,
                FullQualifiedName = file
            });

            if (!result.Value)
            {
                // Scrittura dei messaggi di errore nel checkin
                Response.Write(this.GetErrorMessage(result));
            }
        }
Exemple #2
0
        public void ProcessRequest()
        {
            // Ottieni istanza MTEXT
            MTextModelProvider mtext = ModelProviderFactory <MTextModelProvider> .GetInstance();

            // Carica scheda documento
            DocsPaWR.SchedaDocumento schedaDocumentoSelezionata = CheckInOut.CheckInOutServices.CurrentSchedaDocumento;

            // Carica modello
            String databinding = schedaDocumentoSelezionata.template.PATH_MODELLO_1;

            // Elabora FQN
            String fqn = MTextUtils.Id2FullQualifiedName(documentNumber);

            // Crea documento
            try
            {
                fqn = mtext.CreateDocument(fqn, MTextUtils.CustomObject2Dictionary(schedaDocumentoSelezionata.template), databinding);
            }
            catch (Exception e)
            {
                Response.StatusCode = 500;
                this.WriteResponse(fqn, e.Message);
                return;
            }

            // Ottieni URL per EDIT
            String url = mtext.GetDocumentEditUrl(fqn);

            // Restituisci stringa fqn|editURL
            this.WriteResponse(fqn, url);
        }
Exemple #3
0
        /// <summary>
        /// Funzione per la visualizzazione di un documento M/Text con un certo Full
        /// Qualified Name
        /// </summary>
        /// <param name="fqn">Full Qualified Name del documento da visualizzare</param>
        private void ProcessShowFile(string fqn)
        {
            // Reperimento istanza provider del modello e url per
            // l'apertura del documento M/Text
            MTextModelProvider mText = ModelProviderFactory <MTextModelProvider> .GetInstance();

            String documentUrl = String.Empty;

            try
            {
                documentUrl = mText.GetDocumentEditUrl(fqn);
            }
            catch (Exception e)
            {
                this.WriteResponse(fqn, e.Message);
                this.Response.StatusCode = 500;
                return;
            }

            // Apertura della pagina
            HttpResponse r = Response;

            r.Write(fqn);
            r.Write("|");
            r.Write(documentUrl);
        }
Exemple #4
0
        public static CobieModel OpenEsent(string esentDB)
        {
            var provider = ModelProviderFactory.CreateProvider();

            var model = provider.Open(esentDB, XbimSchemaVersion.Cobie2X4, accessMode: XbimDBAccess.ReadWrite);

            return(new CobieModel(model));
        }
Exemple #5
0
        public static CobieModel OpenStep21Zip(string input, bool esentDB = false)
        {
            var provider = ModelProviderFactory.CreateProvider();

            var model = provider.Open(input, XbimSchemaVersion.Cobie2X4);

            return(new CobieModel(model));
        }
Exemple #6
0
        public static CobieModel OpenStep21(string input, bool esentDB = false)
        {
            var provider = ModelProviderFactory.CreateProvider();
            XbimSchemaVersion ifcVersion = GetSchemaVersion(input, provider);

            var model = provider.Open(input, ifcVersion);

            return(new CobieModel(model));
        }
Exemple #7
0
        public static CobieModel OpenStep21(Stream input, long streamSize, bool esentDB = false)
        {
            var provider  = ModelProviderFactory.CreateProvider();
            var modelType = esentDB ? XbimModelType.EsentModel : XbimModelType.MemoryModel;
            // TODO: Should determine the schema. not hardwire
            var model = provider.Open(input, StorageType.Stp, XbimSchemaVersion.Ifc4, modelType);

            return(new CobieModel(model));
        }
Exemple #8
0
        public void Test_Assert_ComplexProvider()
        {
            var generator = new ModelDescriptionGenerator(new HttpConfiguration());
            var provider  = ModelProviderFactory.GetProvider(typeof(VipDemandDto));

            Assert.IsInstanceOf <ComplexModelProvider>(provider);
            var doc = generator.CreateDefaultDocumentation(typeof(VipDemandDto));

            Assert.AreEqual(doc, "VIP需求信息数据单元");
        }
Exemple #9
0
        /// <summary>
        /// Creates an <see cref="IGeneratorRunner" />.
        /// </summary>
        /// <param name="setupInfos">The setupInfos.</param>
        /// <returns>
        /// An <see cref="IGeneratorRunner" />.
        /// </returns>
        public IGeneratorRunner Create(IEnumerable <SetupInfo> setupInfos)
        {
            List <WriterInfo> writerInfos = new List <WriterInfo>();

            foreach (var setupInfo in setupInfos)
            {
                var modelCache = new ModelCache(ModelProviderFactory.CreateModelProvider(setupInfo), setupInfo.Setup);
                AddGlobalWriterSetups(setupInfo, modelCache, writerInfos);
                AddGeneratorSpecificWriterSetups(setupInfo, modelCache, writerInfos);
            }

            return(new GeneratorRunner(writerInfos));
        }
Exemple #10
0
        /// <summary>
        /// Funzione per la cancellazione di un documento M/Text dal server M/Text
        /// </summary>
        /// <param name="idDocument">Id del documento da cancellare</param>
        private void ProcessDelete(String idDocument)
        {
            try
            {
                // Eliminazione del documento da M/Text
                MTextModelProvider mTextProvider = ModelProviderFactory <MTextModelProvider> .GetInstance();

                mTextProvider.DeleteDocument(Utils.MTextUtils.Id2FullQualifiedName(idDocument));
            }
            catch (Exception e)
            {
                // Non viene intrapresa alcuna azione
            }
        }
Exemple #11
0
        /// <summary>
        /// Funzione per l'eliminazione di un documento salvato in un contesto di checkout
        /// </summary>
        private void ProcessDeleteFromCheckOutContext()
        {
            if (CheckOutContext.Current != null && !String.IsNullOrEmpty(CheckOutContext.Current.Status.DocumentLocation))
            {
                MTextModelProvider mTextProvider = ModelProviderFactory <MTextModelProvider> .GetInstance();

                try
                {
                    mTextProvider.DeleteDocument(CheckOutContext.Current.Status.DocumentLocation.Substring(8));
                }
                catch (Exception e)
                {
                    // Non viene intrapresa alcuna azione
                }
            }
        }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Reperimento del template in definizione
            Templates template = (Templates)Session["templateSelPerModelli"];

            // Generazione di un dizionario creato a partire dai campi del template
            List <LabelValuePair> sampleValues = MTextUtils.GetSampleLabelValueCollection(new List <OggettoCustom>(template.ELENCO_OGGETTI));
            MTextModelProvider    provider     = ModelProviderFactory <MTextModelProvider> .GetInstance();

            Byte[] dataSource = provider.GetXmlExample(template.DESCRIZIONE, sampleValues);

            this.Response.Clear();

            // Scrittura del content nella response
            this.WriteDataSource(dataSource);
        }
Exemple #13
0
 public void ShouldNotRegisterProviderThatDoesNotHaveSchemeAttributeManually()
 {
     ModelProviderFactory.Register(typeof(NoSchemeProvider));
 }
Exemple #14
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            Modello1.Enabled  = false;
            Modello2.Enabled  = false;
            Allegato.Enabled  = false;
            ModelloSU.Enabled = false;

            // Se i modelli M/Text sono attivi e non si è in postback vengono rese visibili le righe con
            // le drop down per la scelta del tipo del modello e vengono popolate le liste dei modelli
            if (MTextUtils.IsActiveMTextIntegration() && !IsPostBack)
            {
                this.trGenerateMTextSourceModel.Visible = true;
                this.trModelChoiceMainDocument.Visible  = true;
                //this.trModelChoiceAtt.Visible = true;
                try
                {
                    List <ModelInfo> models = ModelProviderFactory <MTextModelProvider> .GetInstance().GetModels();

                    foreach (ModelInfo model in models)
                    {
                        this.ddlMTextModelMain.Items.Add(new ListItem(model.Name, model.Path));
                        this.ddlMTextModelAtt.Items.Add(new ListItem(model.Name, model.Path));
                    }
                }
                catch (Exception ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Errore durante il reperimento dei modelli M/Text');", true);
                }
            }


            this.linkTag.NavigateUrl = "metaTagsCampiWORD_PITRE.doc";
            string valoreChiave;

            valoreChiave = utils.InitConfigurationKeys.GetValue("0", "FE_EXPORT_DA_MODELLO");
            if (!string.IsNullOrEmpty(valoreChiave) && valoreChiave.Equals("1"))
            {
                Tr2.Visible = true;
            }
            else
            {
                Tr2.Visible = false;
            }


            DocsPaWR.Templates template = (SAAdminTool.DocsPaWR.Templates)Session["templateSelPerModelli"];

            // Se l'estensione del modello 1 è MTXT viene attivata la visualizzazione M/Text
            // altrimenti quella normale
            if (!String.IsNullOrEmpty(template.PATH_MODELLO_1_EXT) && template.PATH_MODELLO_1_EXT == "MTXT" && !IsPostBack)
            {
                this.ddlModelTypeMain.SelectedIndex = 1;
                this.CheckBox1.Checked        = true;
                this.pnlModelTypeMain.Visible = true;
                this.uploadPathUno.Visible    = false;

                // Toppa temporanea in attesa di prox versione M/Text
                int index = this.ddlMTextModelMain.Items.IndexOf(new ListItem(MTextUtils.GetNameFromQualifiedName(template.PATH_MODELLO_1), template.PATH_MODELLO_1));
                if (index == -1)
                {
                    this.ddlMTextModelMain.Items.Add(new ListItem(MTextUtils.GetNameFromQualifiedName(template.PATH_MODELLO_1), template.PATH_MODELLO_1));
                    index = this.ddlMTextModelMain.Items.Count - 1;
                }
                // Fine toppa temporanea

                this.ddlMTextModelMain.SelectedIndex = index;
            }
            else
            if (template.PATH_MODELLO_1 != "")
            {
                CheckBox1.Checked = true;
                Modello1.Enabled  = true;
            }

            // Se l'estensione del modello 2 è MTXT viene attivata la visualizzazione M/Text
            // altrimenti quella normale
            if (!String.IsNullOrEmpty(template.PATH_MODELLO_2_EXT) && template.PATH_MODELLO_2_EXT == "MTXT" && !IsPostBack)
            {
                this.ddlModelTypeAtt.SelectedIndex = 1;
                this.CheckBox2.Checked             = true;
                this.pnlModelTypeAtt.Visible       = true;
                this.uploadPathDue.Visible         = false;

                // Toppa temporanea in attesa di prox versione M/Text
                int index = this.ddlMTextModelAtt.Items.IndexOf(new ListItem(MTextUtils.GetNameFromQualifiedName(template.PATH_MODELLO_2), template.PATH_MODELLO_2));
                if (index == -1)
                {
                    this.ddlMTextModelAtt.Items.Add(new ListItem(MTextUtils.GetNameFromQualifiedName(template.PATH_MODELLO_2), template.PATH_MODELLO_2));
                    index = this.ddlMTextModelAtt.Items.Count - 1;
                }
                // Fine toppa temporanea

                this.ddlMTextModelAtt.SelectedIndex = index;
            }
            else
            if (template.PATH_MODELLO_2 != "")
            {
                CheckBox2.Checked = true;
                Modello2.Enabled  = true;
            }

            if (template.PATH_MODELLO_STAMPA_UNIONE != "")
            {
                CheckBox4.Checked = true;
                ModelloSU.Enabled = true;
            }
            if (template.PATH_ALLEGATO_1 != "")
            {
                CheckBox3.Checked = true;
                Allegato.Enabled  = true;
            }

            if (!string.IsNullOrEmpty(template.PATH_MODELLO_EXCEL))
            {
                CheckBox5.Checked  = true;
                ModelloExc.Enabled = true;
            }

            if (System.Configuration.ConfigurationManager.AppSettings["MODELLO_DOCUMENTO"] != null && System.Configuration.ConfigurationManager.AppSettings["MODELLO_DOCUMENTO"] == "1")
            {
                uploadPathDue.Visible = false;
                CheckBox2.Visible     = false;
                ImageButton2.Visible  = false;
            }

            if (SHOW_STAMPA_UNIONE)
            {
                this.PanelSU.Visible = true;
            }
            else
            {
                this.PanelSU.Visible = false;
            }
        }
Exemple #15
0
 // Internal Constructor for reading
 protected IfcStore()
 {
     ModelProvider = ModelProviderFactory.CreateProvider();
 }
Exemple #16
0
 public void Initialize()
 {
     ModelProviderFactory.Register(typeof(EmptyMachine));
     Inventory = new ModelInventory();
 }
Exemple #17
0
 public void CleanUp()
 {
     ModelProviderFactory.Reset();
 }
Exemple #18
0
 public void ShouldNotBeProvidersWhichHaveTheSameSchemeAttribute()
 {
     ModelProviderFactory.Reset();
     Inventory.Get <Model>(Name);
 }