Ejemplo n.º 1
0
        /// <summary>
        /// Used to Create a new User Account
        /// </summary>
        public static UserConfiguration CreateUser(CreateUserInfo info, string note = "")
        {
            string json = JSON.FromObject(info);

            if (!string.IsNullOrEmpty(json))
            {
                UserConfiguration result = null;

                string url = new Uri(ApiConfiguration.AuthenticationApiHost, "users/create/").ToString();

                var postDatas = new NameValueCollection();
                postDatas["sender_id"] = UserManagement.SenderId.Get();
                postDatas["user"]      = json;
                postDatas["note"]      = note;

                string response = HTTP.POST(url, postDatas);
                if (response != null)
                {
                    var success = ApiError.ProcessResponse(response, "Create User");
                    if (success)
                    {
                        result = UserConfiguration.Get(response);

                        return(result);
                    }
                }
            }

            return(null);
        }
        CreateUserInfo NewCreateUserInfo()
        {
            var info = new CreateUserInfo();

            info.FirstName = FirstName;
            info.LastName = LastName;

            info.Username = Username;
            info.Password = password_TXT.PasswordText;

            info.Company = Company;

            info.Email = Email;
            info.Phone = Phone;

            info.Address1 = Address1;
            info.Address2 = Address2;
            info.City = City;

            if (country_COMBO.SelectedItem != null) info.Country = country_COMBO.SelectedItem.ToString();
            if (state_COMBO.SelectedItem != null) info.State = state_COMBO.SelectedItem.ToString();

            info.Zipcode = ZipCode;

            return info;
        }
        void CreateUser_GUI(UpdateUser_Return result, CreateUserInfo createInfo)
        {
            if (result.Info != null)
            {
                if (mw != null) mw.Login(createInfo.Username, createInfo.Password);
            }
            else
            {
                TrakHound_UI.MessageBox.Show("Error during User Creation! Try Again.");
            }

            Saving = false;
        }
        void CreateUser(CreateUserInfo info)
        {
            Saving = true;

            ThreadPool.QueueUserWorkItem(new WaitCallback(CreateUser_Worker), info);
        }
        /// <summary>
        /// Used to Create a new User Account
        /// </summary>
        public static UserConfiguration CreateUser(CreateUserInfo info, string note = "")
        {
            string json = JSON.FromObject(info);
            if (!string.IsNullOrEmpty(json))
            {
                UserConfiguration result = null;

                string url = new Uri(ApiConfiguration.AuthenticationApiHost, "users/create/").ToString();

                var postDatas = new NameValueCollection();
                postDatas["sender_id"] = UserManagement.SenderId.Get();
                postDatas["user"] = json;
                postDatas["note"] = note;

                string response = HTTP.POST(url, postDatas);
                if (response != null)
                {
                    var success = ApiError.ProcessResponse(response, "Create User");
                    if (success)
                    {
                        result = UserConfiguration.Get(response);

                        return result;
                    }
                }
            }

            return null;
        }