コード例 #1
0
ファイル: Form1.cs プロジェクト: Anna-B1569/ARXivar-NEXT-Dev
        private void buttonImport_Click(object sender, EventArgs e)
        {
            var bufferApi  = new IO.Swagger.Api.BufferApi(Configuration);
            var profileApi = new IO.Swagger.Api.ProfilesApi(Configuration);
            var statesApi  = new IO.Swagger.Api.StatesApi(Configuration);

            var aooApi = new IO.Swagger.Api.BusinessUnitsApi(Configuration);
            var aoo    = aooApi.BusinessUnitsGet();

            var docTypesApi = new IO.Swagger.Api.DocumentTypesApi(Configuration);
            var doctypes    = docTypesApi.DocumentTypesGet_0(1, aoo.First().Code);


            var fo = new OpenFileDialog();

            if (fo.ShowDialog() == DialogResult.OK)
            {
                var stream   = fo.OpenFile();
                var bufferId = bufferApi.BufferInsert(stream);

                var profileDto   = profileApi.ProfilesGet_0();
                var classeGneric = doctypes.FirstOrDefault(i =>
                                                           i.Key.Equals("GENERIC", StringComparison.CurrentCultureIgnoreCase));
                var status = statesApi.StatesGet_0();
                ((StateFieldDTO)profileDto.Fields.FirstOrDefault(i =>
                                                                 i.Name.Equals("Stato", StringComparison.CurrentCultureIgnoreCase))).Value = status.First().Id;
                ((DocumentTypeFieldDTO)profileDto.Fields.FirstOrDefault(i => i.Name.Equals("DocumentType"))).Value =
                    classeGneric.Id;
                ((OriginFieldDTO)profileDto.Fields.FirstOrDefault(i =>
                                                                  i.Name.Equals("Origine", StringComparison.CurrentCultureIgnoreCase))).Value = 0;
                profileDto.Document = new FileDTO(bufferId);

                var additional = profileApi.ProfilesGetAdditionalByClasse(classeGneric.DocumentType, classeGneric.Type2,
                                                                          classeGneric.Type3, "AbleBS");
                profileDto.Fields.AddRange(additional);

                ((SubjectFieldDTO)profileDto.Fields.FirstOrDefault(i =>
                                                                   i.Name.Equals("DOCNAME", StringComparison.CurrentCultureIgnoreCase))).Value = "Oggeto nuovo";
                var result = profileApi.ProfilesPost(new ProfileDTO()
                {
                    Fields   = profileDto.Fields,
                    Document = new FileDTO()
                    {
                        BufferIds = bufferId
                    },
                    Attachments            = new List <string>(),
                    AuthorityData          = new AuthorityDataDTO(),
                    Notes                  = new List <NoteDTO>(),
                    PaNotes                = new List <string>(),
                    PostProfilationActions = new List <PostProfilationActionDTO>()
                });

                MessageBox.Show(result.DocNumber.ToString());
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Anna-B1569/ARXivar-NEXT-Dev
        private void buttonSearch_click(object sender, EventArgs e)
        {
            try
            {
                var searchApi = new IO.Swagger.Api.SearchesApi(Configuration);

                var docTypesApi   = new IO.Swagger.Api.DocumentTypesApi(Configuration);
                var docTypes      = docTypesApi.DocumentTypesGet_0(1, "AbleBS");
                var classeFatture = docTypes.FirstOrDefault(i => i.Key == "AMM.FATT");

                var defaultSearch = searchApi.SearchesGet();
                var defaultSelect = searchApi.SearchesGetSelect_0(classeFatture.Id);

                var doctypefield = defaultSearch.Fields.FirstOrDefault(i =>
                                                                       i.Name.Equals("DOCUMENTTYPE", StringComparison.CurrentCultureIgnoreCase));
                ((FieldBaseForSearchDocumentTypeDto)doctypefield).Valore1 =
                    new DocumentTypeSearchFilterDto(classeFatture.DocumentType, classeFatture.Type2,
                                                    classeFatture.Type3);
                ((FieldBaseForSearchDocumentTypeDto)doctypefield).Operator = 3;

                var additionals = searchApi.SearchesGetAdditionalByClasse(classeFatture.DocumentType,
                                                                          classeFatture.Type2, classeFatture.Type3, "AbleBS");
                var codiceFattura = additionals.FirstOrDefault(i => i.Description == "Codice Fattura");
                ((FieldBaseForSearchStringDto)codiceFattura).Operator = 11;  //non nullo e non vuoto;

                defaultSearch.Fields.Add(codiceFattura);
                defaultSelect.Fields.FirstOrDefault(i => i.Label == "Codice Fattura").Selected = true;

                var values   = searchApi.SearchesPostSearch(new SearchCriteriaDto(defaultSearch, defaultSelect));
                var profiles = new DataTable();

                foreach (var columnSearchResult in values.First().Columns)
                {
                    profiles.Columns.Add(columnSearchResult.Label);
                }

                foreach (var rowSearchResult in values)
                {
                    profiles.Rows.Add(rowSearchResult.Columns.Select(i => i.Value).ToArray());
                }

                searchGrid.DataSource = profiles;
            }
            catch (Exception exception)
            {
                errorLabel.Text = exception.Message;
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: Anna-B1569/ARXivar-NEXT-Dev
        private......AsyncDocTypes(IO.Swagger.Api.BusinessUnitsApi aooApi, IO.Swagger.Api.DocumentTypesApi docTypesApi)
        {
            List <DocumentTypeBaseDTO> doctypes = null;

            for (int i = 0; i < 150; i++)
            {
                var aoos = ...aooApi....(0, "");
                doctypes = ...docTypesApi....(1, aoos.First().Code);
            }

            aooTable.Invoke((MethodInvoker) delegate()
            {
                aooTable.DataSource = doctypes;
                MessageBox.Show("End of async calls: " + DateTime.Now.ToString("O"));
            });
        }
コード例 #4
0
 private void buttonGetAooAsync_Click(object sender, EventArgs e)
 {
     try
     {
         //Inizialize BusinessUnit & DocumentTypes Api
         var aooApi      = new IO.Swagger.Api.BusinessUnitsApi(Configuration);
         var docTypesApi = new IO.Swagger.Api.DocumentTypesApi(Configuration);
         //Call Async method
         AsyncDocTypes(aooApi, docTypesApi);
         //Test asyncronous operations
         MessageBox.Show("Step forward from async call: " + DateTime.Now.ToString("O"));
     }
     catch (Exception exception)
     {
         errorLabel.Text = exception.Message;
     }
 }
コード例 #5
0
        private void buttonGetDocTypes_Click(object sender, EventArgs e)
        {
            try
            {
                if (aooTable.SelectedRows != null && aooTable.SelectedRows.Count > 0)
                {
                    var aooCode = ((BusinessUnitDTO)aooTable.SelectedRows[0].DataBoundItem).Code;
                    //Inizialize DocumentTypes Api
                    var docTypesApi = new IO.Swagger.Api.DocumentTypesApi(Configuration);
                    //Get DocumentTypes list

                    var docTypes = docTypesApi.DocumentTypesGet_0(1, aooCode);
                    //Bind to the grid
                    aooTable.DataSource = docTypes;
                }
            }
            catch (Exception exception)
            {
                errorLabel.Text = exception.Message;
            }
        }
コード例 #6
0
        private void buttonGetDocTypes_Click(object sender, EventArgs e)
        {
            try
            {
                if (aooTable.SelectedRows != null && aooTable.SelectedRows.Count > 0)
                {
                    //Recuperiamo, dalla riga selezionata, il codice della AOO
                    var aooCode = ((BusinessUnitDTO)aooTable.SelectedRows[0].DataBoundItem).Code;

                    //Inizializzo "DocumentTypes Api"
                    var docTypesApi = new IO.Swagger.Api.DocumentTypesApi(Configuration);

                    //Mi faccio ritornare la lista delle classi documentali censite
                    var docTypes = docTypesApi.DocumentTypesGet_0(1, aooCode);

                    //Costruisco la tabella con la lista delle classi documentali
                    aooTable.DataSource = docTypes;
                }
            }
            catch (Exception exception)
            {
                errorLabel.Text = exception.Message;
            }
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: Anna-B1569/ARXivar-NEXT-Dev
        private void button8_Click(object sender, EventArgs e)
        {
            try
            {
                var searchV2Api = new IO.Swagger.Api.SearchesV2Api(Configuration);

                var docTypesApi   = new IO.Swagger.Api.DocumentTypesApi(Configuration);
                var docTypes      = docTypesApi.DocumentTypesGet_0(1, "AbleBS");
                var classeFatture = docTypes.FirstOrDefault(i => i.Key == "AMM.FATT");
                var classeBolle   = docTypes.FirstOrDefault(i => i.Key == "AMM.BOL");

                //Get search for the first documentType
                var searchFatture       = searchV2Api.SearchesV2GetEmpty();
                var doctypefieldFatture = searchFatture.Fields.FirstOrDefault(i =>
                                                                              i.Name.Equals("DOCUMENTTYPE", StringComparison.CurrentCultureIgnoreCase));
                ((FieldBaseForSearchDocumentTypeDto)doctypefieldFatture).Valore1 =
                    new DocumentTypeSearchFilterDto(classeFatture.DocumentType, classeFatture.Type2,
                                                    classeFatture.Type3);
                ((FieldBaseForSearchDocumentTypeDto)doctypefieldFatture).Operator = 3;

                //Get search for the second documenttype
                var searchBolle       = searchV2Api.SearchesV2GetEmpty();
                var doctypefieldBolle = searchBolle.Fields.FirstOrDefault(i =>
                                                                          i.Name.Equals("DOCUMENTTYPE", StringComparison.CurrentCultureIgnoreCase));
                ((FieldBaseForSearchDocumentTypeDto)doctypefieldBolle).Valore1 =
                    new DocumentTypeSearchFilterDto(classeBolle.DocumentType, classeBolle.Type2, classeBolle.Type3);
                ((FieldBaseForSearchDocumentTypeDto)doctypefieldBolle).Operator = 3;


                var baseSelect = searchV2Api.SearchesV2GetSelect_0(classeFatture.Id);

                var additionalsFatture = searchV2Api.SearchesV2GetAdditionalByClasse(classeFatture.DocumentType,
                                                                                     classeFatture.Type2, classeFatture.Type3, "AbleBS");
                var codiceFattura = additionalsFatture.FirstOrDefault(i => i.Description == "Codice Fattura");
                ((FieldBaseForSearchStringDto)codiceFattura).Operator = 11;  //non nullo e non vuoto;

                searchFatture.Fields.Add(codiceFattura);
                baseSelect.Fields.FirstOrDefault(i => i.Label == "Codice Fattura").Selected = true;
                baseSelect.Fields
                .FirstOrDefault(i => i.Name.Equals("CLASSEDOCDESC", StringComparison.CurrentCultureIgnoreCase))
                .Selected           = true;
                baseSelect.MaxItems = 0;

                var values = searchV2Api.SearchesV2PostSearchMultiple(new SearchCriteriaMultipleDto()
                {
                    SearchFilterDtoList = new List <SearchDTO>()
                    {
                        searchFatture, searchBolle
                    },
                    SelectFilterDto = baseSelect
                });

                var profiles = new DataTable();

                foreach (var columnSearchResult in values.First().Columns)
                {
                    profiles.Columns.Add(columnSearchResult.Label);
                }

                foreach (var rowSearchResult in values)
                {
                    profiles.Rows.Add(rowSearchResult.Columns.Select(i => i.Value).ToArray());
                }

                searchGrid.DataSource = profiles;
            }
            catch (Exception exception)
            {
                errorLabel.Text = exception.Message;
            }
        }
コード例 #8
0
        private void buttonImport_Click(object sender, EventArgs e)
        {
            //Preambolo
            String messaggio;
            var    businessApi = new IO.Swagger.Api.BusinessUnitsApi(Configuration);
            var    bufferApi   = new IO.Swagger.Api.BufferApi(Configuration);
            var    profileApi  = new IO.Swagger.Api.ProfilesApi(Configuration);
            var    statesApi   = new IO.Swagger.Api.StatesApi(Configuration);
            var    aooApi      = new IO.Swagger.Api.BusinessUnitsApi(Configuration);
            var    aoo         = aooApi.BusinessUnitsGet();
            var    docTypesApi = new IO.Swagger.Api.DocumentTypesApi(Configuration);
            var    doctypes    = docTypesApi.DocumentTypesGet_0(1, aoo.First().Code);


            var fo = new OpenFileDialog();

            if (fo.ShowDialog() == DialogResult.OK)
            {
                //Mi apro il file e prendo il suo contenuto
                var stream   = fo.OpenFile();
                var bufferId = bufferApi.BufferInsert(stream);

                //Quale AOO devo utilizzare?
                messaggio = "Quale AOO devo utilizzare?\n";
                var listaAoo = businessApi.BusinessUnitsGet(1, "CODICE");
                foreach (BusinessUnitDTO bu in listaAoo)
                {
                    messaggio += string.Format("{0}: {1}\n", bu.Code, bu.Name);
                }
                var buScelta = Interaction.InputBox(messaggio, "Creazione profilo", "Immetti valore");

                //Il mio profilo andrà nella classe GENERIC
                var profileDto   = profileApi.ProfilesGet_0();
                var classeGneric = doctypes.FirstOrDefault(i => i.Key.Equals("GENERIC", StringComparison.CurrentCultureIgnoreCase));
                var status       = statesApi.StatesGet_0();

                //Definisco lo stato documentale
                messaggio = "Quale stato documentale vuoi utilizzare?\n";
                foreach (StateBaseDto stato in status)
                {
                    messaggio += string.Format("{0}: {1}\n", stato.Id, stato.Description);
                }
                String statoDocumentaleScelto = Interaction.InputBox(messaggio, "Creazione profilo", "Immetti valore");
                ((StateFieldDTO)profileDto.Fields.FirstOrDefault(i => i.Name.Equals(..., StringComparison.CurrentCultureIgnoreCase))).Value = statoDocumentaleScelto;

                //Gestiamo il DocumentType
                ((DocumentTypeFieldDTO)profileDto.Fields.FirstOrDefault(i => i.Name.Equals(...))).Value = classeGneric.Id;

                //Gestiamo l'origine del documento
                ((OriginFieldDTO)profileDto.Fields.FirstOrDefault(i => i.Name.Equals(..., StringComparison.CurrentCultureIgnoreCase))).Value = 0;

                //Impostiamo l'AOO
                ((BusinessUnitFieldDTO)profileDto.Fields.FirstOrDefault(i => i.Name.Equals(..., StringComparison.CurrentCultureIgnoreCase))).Value = buScelta;

                //Impostiamo l'oggetto
                ((SubjectFieldDTO)profileDto.Fields.FirstOrDefault(i => i.Name.Equals(..., StringComparison.CurrentCultureIgnoreCase))).Value = ...;


                //Ci mettiamo il file nel profilo
                profileDto.Document = new FileDTO(bufferId);

                //Campo aggiuntivi: ricerchiamoli e popoliamoli
                var additional = profileApi....(classeGneric.DocumentType, classeGneric.Type2, classeGneric.Type3, buScelta);
                ((AdditionalFieldStringDTO)additional.FirstOrDefault(i => i.Description.Equals("StringaProtocollo", StringComparison.CurrentCultureIgnoreCase))).Value = "api00x";
                ((AdditionalFieldIntDTO)additional.FirstOrDefault(i => i.Description.Equals("CodiceProtocollo", StringComparison.CurrentCultureIgnoreCase))).Value     = 9876;
                ((AdditionalFieldDateTimeDTO)additional.FirstOrDefault(i => i.Description.Equals("DataProtocollo", StringComparison.CurrentCultureIgnoreCase))).Value  = new DateTime(2021, 01, 01);
                profileDto.Fields....(additional);

                //Creazione del profilo, annesso metadati e documento
                var result = profileApi.ProfilesPost(new ProfileDTO()
                {
                    Fields   = profileDto.Fields,
                    Document = new FileDTO()
                    {
                        BufferIds = bufferId
                    },
                    Attachments            = new List <string>(),
                    AuthorityData          = new AuthorityDataDTO(),
                    Notes                  = new List <NoteDTO>(),
                    PaNotes                = new List <string>(),
                    PostProfilationActions = new List <PostProfilationActionDTO>()
                });

                MessageBox.Show("Profilo creato con numero: " + result.DocNumber.ToString());
            }
        }