Пример #1
0
        public RegisterViewModel()
        {
            _client = new NoValidationServiceClient();
            _client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
            var res = _client.GetCities();

            _cities = new ObservableCollection <City>(City.Convert(res));
        }
Пример #2
0
        static void Main(string[] args)
        {
            NoValidationServiceClient n = new NoValidationServiceClient();

            n.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
            var myUnivercity = n.GetUnivercities("Туполева").First();
            var cities       = n.GetCities();
            var myCity       = cities.First(city => city.Name.Contains("Казань"));

            if (myCity != null && myUnivercity != null)
            {
                var res =
                    n.Register(new UserCrDto()
                {
                    Nickname    = "Asd",
                    Password    = "******",
                    Description = "Asd",
                    Email       = "*****@*****.**",
                    Group       = "Asd",
                    Name        = "AsdAsd",
                    Surname     = "Aasdsa"
                }
                               );
                if (res.ActionResult == ActionResult.IncorrectParameter)
                {
                    foreach (var error in res.Errors)
                    {
                        Console.WriteLine(error.Variable + " " + error.CheckStatus);
                    }
                }
                else
                {
                    Console.WriteLine(res.CreatedObject.Id);
                }
                Console.ReadLine();
            }



            //var client = new SchedulerClient.SchedulerClient();
            //client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
            //client.ClientCredentials.UserName.UserName = "******";
            //client.ClientCredentials.UserName.Password = "******";
            //var res =
            //    client.EditUser(new UserCrDto()
            //    {
            //        Nickname = "asdasd",
            //        Password = "******",
            //        CityId = myCity.Id,
            //        UniversityId = myUnivercity.Id,
            //        Name = "ahwaw",
            //        Phone = "8950945371",
            //        Email = "*****@*****.**",
            //        Surname = "Бакиев",
            //        Group = "4402",
            //        Description = "Умный и скромный парень"
            //    });
            //if (res.ActionResult == (AuthService.ActionResult) ActionResult.IncorrectParameter)
            //{
            //    foreach (var error in res.Errors)
            //    {
            //        Console.WriteLine(error.Variable + " " + error.CheckStatus);
            //    }
            //}
            //else
            //{
            //    Console.WriteLine(res.CreatedObject.Id);
            //}
            //Console.ReadLine();

            //var channelRole =
            //    client.EditEvent(new EventDto
            //    {
            //        EventId = 3,
            //        ChannelId = 2,
            //        Descrition = "111111111111",
            //        EventTime = new DateTime(2017, 6, 5),
            //        ImportanceId = 1,
            //        Title = "Karappa"
            //    });
            //Console.WriteLine(channelRole.ActionResult);
            //Console.ReadLine();
            ////var r = client.GetEvents(2, 1, DateTime.Now, 1);
            ////foreach (var eventDto in r)
            ////{
            ////    Console.WriteLine(eventDto.ImportanceId);
            ////}
            ////Console.ReadLine();
        }