private bool login(string username, string pass) { bool login_success = false; user = new m_users(); try { string endpoint = home_url + "/users/" + username + "/" + pass; WebRequest request = WebRequest.Create(endpoint) as HttpWebRequest;; WebResponse response = request.GetResponse(); using (var reader = new StreamReader(response.GetResponseStream())) { string responseContent = reader.ReadToEnd(); user = JsonConvert.DeserializeObject <m_users>(responseContent); if (user.user_name != null && user.password != null) { login_success = true; } } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); } return(login_success); }
public NewStockForm(m_users user) { InitializeComponent(); this.user = user; UserTextBox.Text = user.user_name; }