Ejemplo n.º 1
0
        public static void RefreshSession(string url, string sessionid)
        {
            //if the tests take a long time to run we want to avoid a timeout. This method will do that
            SessionsApi s = new SessionsApi(url);

            s.Refresh(sessionid);
        }
Ejemplo n.º 2
0
 private void btnConnect_Click(object sender, EventArgs e)
 {
     try
     {
         string      url = txtURL.Text.TrimEnd('/');
         SessionsApi s   = new SessionsApi(url + "/api/v6");
         Session     key = s.Login(txtUser.Text, txtPass.Text);
         Console.WriteLine(key.SessionId);
         using (frmAll frmAllTests = new frmAll(key, url + "/api/v6"))
         {
             frmAllTests.Location = this.Location;
             this.Hide();
             frmAllTests.ShowDialog();
         }
         this.Show();
         //frmSel closed re-display logon
         this.Show();
         this.Dispose();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private static void Main(string[] args)
        {
            Configuration configuration = new Configuration();

            configuration.BasePath = "http://connector.develop.cnxt.dtr01.rodenstock.com:8080/api";
            //configuration.BasePath = "http://localhost:8280/api";

            PatientsApi patientsApi = new PatientsApi(configuration);

            // Query the first 25 patients sorted by lastName (ascending)
            PatientsResponse patientsResponse = patientsApi.GetPatients(25, null, new PatientFilter()
            {
                DateOfBirth = DateTime.ParseExact("1982-10-30", "yyyy-MM-dd", CultureInfo.InvariantCulture,
                                                  DateTimeStyles.None)
            }, new List <string>()
            {
                "lastName"
            }, new List <string>()
            {
                "session", "latestSessionId", "latestSessionUpdate"
            });

            // Query the next 25 patients sorted by lastName (ascending)
            patientsResponse = patientsApi.GetPatients(25, patientsResponse.PageInfo.EndCursor, null, new List <string>()
            {
                "lastName"
            }, new List <string>()
            {
                "session", "latestSessionId", "latestSessionUpdate"
            });

            List <PatientResponse> patients = patientsResponse.Patients;

            PatientResponse patient = null;

            foreach (PatientResponse patientResponse in patients)
            {
                // Query patient by id and include session relationship
                patient = patientsApi.GetPatient(patientResponse.Id, new List <string>()
                {
                    "session"
                });
                Console.WriteLine("Patient: {0}" + Environment.NewLine, JsonConvert.SerializeObject(patient));
            }

            SessionsApi sessionsApi = new SessionsApi(configuration);

            // Query the first 25 sessions sorted by upatedAt date (descending)
            SessionsResponse sessionsResponse = sessionsApi.GetSessions(25, null, new SessionFilter()
            {
                UpdatedAfter = DateTime.Parse("2020-02-17T10:00:00.391984Z"), State = null
            }, new List <string>()
            {
                "-updatedAt"
            }, new List <string>()
            {
                "patient"
            });

            // Query the next 25 sessions sorted by updatedAt date (descending)
            sessionsResponse = sessionsApi.GetSessions(25, sessionsResponse.PageInfo.EndCursor, new SessionFilter()
            {
                UpdatedAfter = DateTime.Parse("2020-02-17T10:00:00.391984Z"), State = null
            }, new List <string>()
            {
                "-updatedAt"
            }, new List <string>()
            {
                "patient"
            });

            List <SessionResponse> sessions = sessionsResponse.Sessions;

            SessionResponse session = null;

            foreach (SessionResponse sessionResponse in sessions)
            {
                // Query session by id and include patient and b2boptic relationships
                session = sessionsApi.GetSession(sessionResponse.Id, new List <string>()
                {
                    "patient", "b2boptic"
                });
                Console.WriteLine("Session: {0}" + Environment.NewLine, JsonConvert.SerializeObject(session));

                // Query assets assigned to the the specified session
                AssetsResponse assetResponse = sessionsApi.GetAssets(session.Id);
            }

            string b2bOptic_Sample1 = System.IO.File.ReadAllText("./Data/B2BOptic_Sample1.xml");

            // Import b2boptic XML document as new session
            List <string> sessionIds = sessionsApi.ImportB2BOpticAsNewSession(b2bOptic_Sample1, "OPEN");

            string b2bOptic_Sample2 = System.IO.File.ReadAllText("./Data/B2BOptic_Sample2.xml");

            // Import b2boptic XML document and update it by session for the specified session
            sessionIds = sessionsApi.ImportB2BOptic("691e5c29-3d70-4a3e-a8dd-bea781faba4b", b2bOptic_Sample2, "OPEN");

            SessionResponse _sessionResponse = sessionsApi.GetSession("f62fc646-9101-4f20-8255-65816435662c");
            AssetsResponse  _assetResponse   = sessionsApi.GetAssets(_sessionResponse.Id);

            AssetsApi assetsApi = new AssetsApi(configuration);
            DNEyeScannerAssetsResponse dnEyeScannerAssetsResponse = assetsApi.GetDNEyeScannerAssets("b126c195-8dde-47d6-9373-a2a47a72abaa");

            ImpressionISTAssetsResponse impressionISTAssetResponse = assetsApi.GetImpressionISTAssets("f62fc646-9101-4f20-8255-65816435662c");

            Console.ReadLine();
        }
Ejemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                throw new Exception();
            }
            catch (Exception ex)
            {
                MailMessage mail = new MailMessage();
                mail.To.Add("*****@*****.**");
                mail.From    = new MailAddress("*****@*****.**");
                mail.Subject = "Error";
                string Body = "Error";
                mail.Body       = Body;
                mail.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient("smtp-mail.outlook.com", 587);
                // smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
                smtp.UseDefaultCredentials = false;
                smtp.EnableSsl             = true;
                smtp.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "#3vert0n5");
                // smtp.Port = 587;
                //Or your Smtp Email ID and Password
                //smtp.Send(mail);

                //ex.LogToElmah();
            }

            var sessionsApi   = new SessionsApi();
            var sessionCreate = new SessionCreate("#3Vert0n", true, "*****@*****.**");
            var token         = sessionsApi.CreateSession(sessionCreate);

            //var header

            var configuration = new Configuration();

            //configuration.Username = "******";
            //configuration.Password = "******";
            configuration.AccessToken = token.Token;
            //configuration.AccessToken = "WzMwMzM2NDEwLDExMzE4NjM5OF0.xKV2DHnWMDxNTsicJfNaqiLthbo";

            var eventsApi = new EventsApi(configuration);

            var minDateTime = new DateTime(2020, 11, 11, 12, 0, 0);
            var maxDateTime = new DateTime(2020, 11, 11, 21, 0, 0);

            var eventTypes = new List <string>();

            eventTypes.Add("horse_racing_race");

            var eventTypeDomains = new List <string>();

            eventTypeDomains.Add("horse_racing");

            var eventTypeScopes = new List <string>();

            eventTypeScopes.Add("single_event");

            var events = eventsApi.GetEvents(null, null, null, eventTypes, eventTypeDomains, eventTypeScopes, true, null, minDateTime, maxDateTime, null, null, null, null, null, null, "start_datetime,name", 100, false, null);

            ModelEvent event1 = events._Events.FirstOrDefault();

            var eventConfig = new MapperConfiguration(cfg => cfg.CreateMap <ModelEvent, CustomModel.Event>().ForMember(Event => Event.Markets, opt => opt.Ignore()));
            var eventMapper = eventConfig.CreateMapper();
            var eventList   = eventMapper.Map <List <ModelEvent>, List <CustomModel.Event> >(events._Events);

            //var eventIds = new List<int?>();
            var eventIds = (from item in eventList select item.Id).ToList()
                           .Select(s => Int32.TryParse(s, out int n) ? n : (int?)null).ToList();

            var marketsApi     = new MarketsApi(configuration);
            var apiMarketsList = marketsApi.GetMarketsByEventIds(eventIds, "display_order", 100, false, false);

            var marketMapperConfig = new MapperConfiguration(cfg => cfg.CreateMap <Market, CustomModel.Market>().ForMember(Market => Market.Contracts, opt => opt.Ignore()));
            var marketMapper       = marketMapperConfig.CreateMapper();
            var marketList         = marketMapper.Map <List <Market>, List <CustomModel.Market> >(apiMarketsList.Markets);

            //var marketIds = new List<int?>();
            //marketIds.Add(11369867);

            var marketIds = (from item in marketList select item.Id).ToList()
                            .Select(s => Int32.TryParse(s, out int n) ? n : (int?)null).ToList();

            var contractsApi = new ContractsApi(configuration);
            var apiContracts = contractsApi.GetContractsByMarketIds(marketIds);

            var contractMapperConfig = new MapperConfiguration(cfg => cfg.CreateMap <Contract, CustomModel.Contract>().ForMember(Contract => Contract.Quote, opt => opt.Ignore()));
            var contractMapper       = contractMapperConfig.CreateMapper();
            var contractList         = contractMapper.Map <List <Contract>, List <CustomModel.Contract> > (apiContracts.Contracts);

            var pricesApi     = new PricesApi(configuration);
            var apiPricesList = pricesApi.GetQuotes(marketIds);

            foreach (var apiPrice in apiPricesList)
            {
                var s = apiPrice.Value.ToString();
                var q = JObject.Parse(apiPrice.Value.ToString());

                var bidList = q["bids"].ToList();
                var bids    = new List <CustomModel.BidOffer>();

                foreach (var item in bidList)
                {
                    var bid = new CustomModel.BidOffer();
                    bid.BidOfferTypeDescription = "Bid";
                    bid.Price    = (int?)item["price"];
                    bid.Quantity = (int?)item["quantity"];

                    bids.Add(bid);
                }

                var offerList = q["offers"].ToList();
                var offers    = new List <CustomModel.BidOffer>();

                foreach (var item in offerList)
                {
                    var offer = new CustomModel.BidOffer();
                    offer.BidOfferTypeDescription = "Offer";
                    offer.Price    = (int?)item["price"];
                    offer.Quantity = (int?)item["quantity"];

                    bids.Add(offer);
                }

                var contractId          = apiPrice.Key;
                CustomModel.Quote quote = new CustomModel.Quote(contractId, bids, offers);

                var contract = contractList.Where(c => c.Id == contractId).First();
                contract.Quote = quote;
            }

            foreach (var itemMarket in marketList)
            {
                var contracts = contractList.Where(c => c.MarketId == itemMarket.Id).ToList();
                itemMarket.Contracts = contracts;
            }

            foreach (var itemEvent in eventList)
            {
                var markets = marketList.Where(c => c.EventId == itemEvent.Id).ToList();
                itemEvent.Markets = markets;
            }
        }
Ejemplo n.º 5
0
 public void Init()
 {
     instance = new SessionsApi();
 }