Example #1
0
        public async Task <Room_Result> getResult(Struct_SearchConfig_Room cfg)
        {
            await post(cfg);

            Room_Result res = new Room_Result();

            res.list = this.list;
            res.ok   = this.resultOK;

            return(res);
        }
Example #2
0
        //Raumliste mit HTTP-POST abfragen
        private async Task post(Struct_SearchConfig_Room cfg)
        {
            try
            {
                Helper h = new Helper();

                String date = h.buildNumber(cfg.date_day) + "." + h.buildNumber(cfg.date_month) + "." + cfg.date_year;

                //Daten zur Übertragung vorbereiten
                Dictionary <string, string> pairs = new Dictionary <string, string>();
                pairs.Add("godatum", date);
                pairs.Add("von", cfg.time_start.ToString());
                pairs.Add("bis", cfg.time_end.ToString());
                pairs.Add("dstunde", cfg.duration.ToString());
                pairs.Add("lehrkapmin", cfg.cap_min.ToString());
                pairs.Add("lehrkapmax", cfg.cap_max.ToString());

                if (cfg.withPool)
                {
                    //Wenn Pool gewünscht keine Variable setzen
                }
                else
                {
                    pairs.Add("pool", "1");
                }

                pairs.Add("abgeschickt", " Suche starten ");

                var                 content  = new FormUrlEncodedContent(pairs);
                HttpClient          client   = new HttpClient();
                HttpResponseMessage response = await client.PostAsync(new Uri("https://intranet.tuhh.de/allgemein/raum/freiraum.php"), content);

                var htxt = await response.Content.ReadAsStringAsync();

                readData(htxt);
            }
            catch (Exception ex)
            {
            }
        }