コード例 #1
0
        public static string CreateRobot2Group(int groupid, bool isAndroid = true, int cnt = 1)
        {
            int i = 0;

            while (i < cnt)
            {
                string       user_name = Randstr();
                string       password  = "******";
                XingshenUser Newuser;
                string       msg = svrHelper.Create_register(out Newuser, user_name, password, isAndroid);
                if (string.IsNullOrEmpty(msg))
                {
                    Newuser.RobotGroup = groupid;
                    Newuser.Update();
                    XingshenUserData ud = new XingshenUserData();
                    svrHelper.system_user_info(Newuser, ref ud);
                    ud.Add();

                    i++;
                }
                else if (msg == "用户名已经被占用")
                {
                    //重新
                }
                else
                {
                    return(msg);
                }
            }
            return("");
        }
コード例 #2
0
        public async Task <IHttpActionResult> SignupNewUser(Newuser user)
        {
            var resultData = await _userRepository.SignupNewUser(user.Username, user.Password, user.Fullname);

            if (!resultData)
            {
                return(Unauthorized());
            }
            return(Ok());
        }
コード例 #3
0
        public ActionResult Inscription(string txtName, string txtFirstName, string txtEmail)
        {
            Newuser u = new Newuser()
            {
                cliName      = txtName,
                cliFirstName = txtFirstName,
                cliMail      = txtEmail
            };

            return(View(u));
        }
コード例 #4
0
        /// <summary>
        /// This method create an async request that send data of the new user
        /// @author Jose A.
        /// </summary>
        private async void RegisterRequest()
        {
            Newuser user = new Newuser();

            user.Age      = Int32.Parse(ageEntry.Text);
            user.Email    = emailEntry.Text;
            user.Password = CreateMD5(passwordEntry.Text);
            user.Name     = nameEntry.Text;
            HttpClient cliente = new HttpClient();

            if (ChefBox.IsChecked)
            {
                string url         = "http://" + LoginPage.ip + ":6969/newChef";//AQUI DEBE IR EL URL PARA CHEFS
                String jsonNewUser = JsonConvert.SerializeObject(user);
                Console.WriteLine("JSON NEW USER:"******"DATASENT" + datasent);
                datasent.Headers.ContentType.MediaType = "application/json";
                var result = await cliente.PostAsync(url, datasent);

                var json = result.Content.ReadAsStringAsync().Result;
                await DisplayAlert("Result", json, "ok");
            }
            else
            {
                string url         = "http://" + LoginPage.ip + ":6969/newUser";//AQUI DEBE IR EL URL PARA USUARIOS SINGULARES
                String jsonNewUser = JsonConvert.SerializeObject(user);
                Console.WriteLine("JSON NEW USER:"******"DATASENT" + datasent);
                datasent.Headers.ContentType.MediaType = "application/json";
                var result = await cliente.PostAsync(url, datasent);

                var json = result.Content.ReadAsStringAsync().Result;
                await DisplayAlert("Result", json, "ok");
            }
        }
コード例 #5
0
        //public Task<IList<IWord>> GetListOfWords(Consts.Languages lang, CancellationToken cancellationToken)
        //{
        //    Words = new List<IWord>();
        //    return Words;
        //}

        public async Task <bool> SignupAsync(Newuser user)
        {
            var uri = new Uri(string.Format(Consts.RestUrl + "Signup/", String.Empty));

            try
            {
                var json    = JsonConvert.SerializeObject(user);
                var content = new StringContent(json, Encoding.UTF8, "application/json");

                HttpResponseMessage response = null;
                response = client.PostAsync(uri, content).GetAwaiter().GetResult();
                if (response.IsSuccessStatusCode)
                {
                    var userString = await response.Content.ReadAsStringAsync();

                    return(JsonConvert.DeserializeObject <bool>(userString));
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(@"				ERROR {0}", ex.Message);
            }
            return(false);
        }