コード例 #1
0
        public async Task <bool> SetzeZielFürNummerInformationAsync()
        {
            bool success = false;
            Guid?guid    = StandardRequirement.Instance.BonsaiTransferGuid;


            if (guid.HasValue && StandardRequirement.Instance.ErstellteNummerDefinitionResponse != null)
            {
                long gemasauftragsnummer = Common.Helpers.Random_Helper.GetLong(0, 10000);

                using (var httpClient = new HttpClient())
                {
                    SetzeZielFürNummerInformationRequest setzeZielFürNummerInformationRequest = LieferSetzeZielFürNummerInformation(guid, gemasauftragsnummer);
                    StringContent content = new StringContent(JsonConvert.SerializeObject(setzeZielFürNummerInformationRequest), Encoding.UTF8, "application/json");
                    using (HttpResponseMessage response = await httpClient.PutAsync(BaseAPIURL + "SetzeZielFürNummerInformation/", content))
                    {
                        if (response.IsSuccessStatusCode)
                        {
                            string apiResponse = await response.Content.ReadAsStringAsync();

                            NummerInformation nummerInformation = JsonConvert.DeserializeObject <NummerInformation>(apiResponse);
                            if (nummerInformation != null && nummerInformation.Ziel == gemasauftragsnummer.ToString())
                            {
                                StandardRequirement.Instance.GemasAuftragsnummer = gemasauftragsnummer;
                                success = true;
                            }
                        }
                    }
                }
            }


            return(success);
        }
コード例 #2
0
        public async Task <NummerInformation> HoleNummerInformationAsync(bool durchQuellen)
        {
            NummerInformation            nummerInformation            = null;
            HoleNummerInformationRequest holeNummerInformationRequest = new HoleNummerInformationRequest();

            holeNummerInformationRequest.Nummer_definition_id = StandardRequirement.Instance.NummerDefinition.Id;
            if (durchQuellen)
            {
                holeNummerInformationRequest.DurchQuellen = true;
                holeNummerInformationRequest.Quellen      = new object[] { StandardRequirement.Instance.DeuWoAuftragsnummer };
            }
            else
            {
                holeNummerInformationRequest.DurchQuellen = false;
                holeNummerInformationRequest.Ziel         = StandardRequirement.Instance.GemasAuftragsnummer;
            }
            using (var httpClient = new HttpClient())
            {
                StringContent content = new StringContent(JsonConvert.SerializeObject(holeNummerInformationRequest), Encoding.UTF8, "application/json");
                using (HttpResponseMessage response = await httpClient.PostAsync(BaseAPIURL + "HoleNummerInformation/", content))
                {
                    if (response.IsSuccessStatusCode)
                    {
                        string apiResponse = await response.Content.ReadAsStringAsync();

                        nummerInformation = JsonConvert.DeserializeObject <NummerInformation>(apiResponse);
                    }
                }
            }
            return(nummerInformation);
        }
コード例 #3
0
        private static async Task <bool> SetzeZielFürNummerInformationAsync(SetzeZielFürNummerInformationRequest setzeZielFürNummerInformationRequest)
        {
            bool success = false;


            if (setzeZielFürNummerInformationRequest != null)
            {
                using (var httpClient = new HttpClient())
                {
                    StringContent content = new StringContent(JsonConvert.SerializeObject(setzeZielFürNummerInformationRequest), Encoding.UTF8, "application/json");
                    using (HttpResponseMessage response = await httpClient.PutAsync(BaseAPIURL + "SetzeZielFürNummerInformation/", content))
                    {
                        if (response.IsSuccessStatusCode)
                        {
                            string apiResponse = await response.Content.ReadAsStringAsync();

                            NummerInformation nummerInformation = JsonConvert.DeserializeObject <NummerInformation>(apiResponse);
                            if (nummerInformation != null)
                            {
                                success = true;
                            }
                        }
                    }
                }
            }


            return(success);
        }
コード例 #4
0
        static async Task  Main(string[] args)
        {
            bool existiert = await StandardRequirement.Instance.PrüfeUndErstelleNummerDefinitionAsync();

            if (existiert)
            {
                Guid?guid = await StandardRequirement.Instance.ErstelleNummerInformationAsync();

                if (guid.HasValue)
                {
                    bool success = await StandardRequirement.Instance.SetzeZielFürNummerInformationAsync();

                    if (success)
                    {
                        NummerInformation nummerInformation1 = await StandardRequirement.Instance.HoleNummerInformationAsync(true);

                        NummerInformation nummerInformation2 = await StandardRequirement.Instance.HoleNummerInformationAsync(false);
                    }
                }
            }
            long countOfMassTests = Random_Helper.GetLong(1L, 4000L);

            for (long i = 0; i < countOfMassTests; i++)
            {
                var aaa = await DoMassTestAsync();
            }
        }
コード例 #5
0
        public async Task <ActionResult <object> > HoleNummerInformationZielUeberGuid(Guid guid)
        {
            object ziel = null;

            NummerInformation nummerInformation = await this._context.Nummerinformationen.Where(e => (e.Guid == guid)).FirstOrDefaultAsync();


            if (nummerInformation != null && nummerInformation.Ziel != null)
            {
                NummerDefinition nummerDefinition = await this._context.Nummerdefinitionen.Where(e => e.Id == nummerInformation.NummerdefinitionenId).FirstOrDefaultAsync();

                if (nummerDefinition != null)
                {
                    switch (nummerDefinition.ZielDatentypenId)
                    {
                    case 1:

                        ziel = nummerInformation.Ziel;
                        break;

                    case 2:
                        Int32 output2 = 0;
                        if (Int32.TryParse(nummerInformation.Ziel, out output2))
                        {
                            ziel = output2;
                        }

                        break;

                    case 3:
                        Guid output3 = Guid.NewGuid();
                        if (Guid.TryParse(nummerInformation.Ziel, out output3))
                        {
                            ziel = output3;
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            if (ziel == null)
            {
                return(NotFound());
            }
            else
            {
                return(ziel);
            }
        }
コード例 #6
0
        public async Task <NummerInformation> HoleNummerInformationAsync(NummerDefinition nummerDefinition, ErstelleNummerInformationRequest erstelleNummerInformationRequest)
        {
            NummerInformation            nummerInformation            = null;
            HoleNummerInformationRequest holeNummerInformationRequest = new HoleNummerInformationRequest();

            holeNummerInformationRequest.Nummer_definition_id = nummerDefinition.Id;
            holeNummerInformationRequest.DurchQuellen         = true;
            holeNummerInformationRequest.Quellen = erstelleNummerInformationRequest.Quellen;
            using (var httpClient = new HttpClient())
            {
                StringContent content = new StringContent(JsonConvert.SerializeObject(holeNummerInformationRequest), Encoding.UTF8, "application/json");
                using (HttpResponseMessage response = await httpClient.PostAsync(BaseAPIURL + "HoleNummerInformation/", content))
                {
                    if (response.IsSuccessStatusCode)
                    {
                        string apiResponse = await response.Content.ReadAsStringAsync();

                        nummerInformation = JsonConvert.DeserializeObject <NummerInformation>(apiResponse);
                    }
                }
            }
            return(nummerInformation);
        }
コード例 #7
0
        public async Task <MassTestResult> RunAsync(long max)
        {
            MassTestResult          massTestResult     = new MassTestResult();
            List <NummerDefinition> nummerDefinitionen = new List <NummerDefinition>();
            List <ErstelleNummerInformationRequest> erstelleNummerInformationRequests = new List <ErstelleNummerInformationRequest>();
            long countOfDefinitions = Random_Helper.GetLong(1L, max);

            massTestResult.CountOfDefinitions = countOfDefinitions;
            for (long i = 0; i < countOfDefinitions; i++)
            {
                NummerDefinition nummerDefinition = CreateRandomNummerDefinition();
                ErstellteNummerDefinitionResponse ErstellteNummerDefinitionResponse = await ErstelleNummerDefinitionAsync(nummerDefinition);

                if (ErstellteNummerDefinitionResponse != null)
                {
                    nummerDefinition.Guid = ErstellteNummerDefinitionResponse.Guid;
                    nummerDefinition.Id   = ErstellteNummerDefinitionResponse.Id;
                    nummerDefinitionen.Add(nummerDefinition);
                }
                else
                {
                    WriteRedTextToConsole("NummerDefinition konnte nicht erstellt werden.");
                }
            }
            long countOfInformations = Random_Helper.GetLong(1L, max);

            massTestResult.CountOfInformations = countOfInformations;
            foreach (var nummerDefinition in nummerDefinitionen)
            {
                for (int i = 0; i < countOfInformations; i++)
                {
                    ErstelleNummerInformationRequest erstelleNummerInformationRequest = CreateRandomErstelleNummerInformation(nummerDefinition);
                    Guid?guid = await ErstelleNummerInformationAsync(erstelleNummerInformationRequest);

                    if (guid.HasValue)
                    {
                        erstelleNummerInformationRequests.Add(erstelleNummerInformationRequest);
                        SetzeZielFürNummerInformationRequest setzeZielFürNummerInformationRequest = ErstelleSetzeZielFürNummerInformation(guid, nummerDefinition);
                        bool success = await SetzeZielFürNummerInformationAsync(setzeZielFürNummerInformationRequest);

                        if (success)
                        {
                            MassTestMeasure massTestMeasure = new MassTestMeasure();
                            massTestMeasure.CountOfInformations = await this._context.Nummerinformationen.CountAsync();

                            massTestMeasure.Start = DateTime.Now;
                            NummerInformation nummerInformation = await HoleNummerInformationAsync(nummerDefinition, erstelleNummerInformationRequest);

                            if (nummerInformation != null && nummerInformation.Ziel.ToString() == setzeZielFürNummerInformationRequest.Ziel.ToString())
                            {
                                massTestMeasure.End          = DateTime.Now;
                                massTestMeasure.Milliseconds = (massTestMeasure.End - massTestMeasure.Start).TotalMilliseconds;
                                massTestResult.MassTestMeasures.Add(massTestMeasure);
                            }
                            else
                            {
                                WriteRedTextToConsole("NummerInformation konnte nicht geholt werden.");
                            }
                        }
                    }
                    else
                    {
                        WriteRedTextToConsole("NummerInformation konnte nicht erstellt werden.");
                    }
                }
            }
            massTestResult.CountOfErstelleNummerInformationen = erstelleNummerInformationRequests.Count;


            return(massTestResult);
        }