コード例 #1
0
ファイル: LoginForm.cs プロジェクト: hnjm/sim-pos-desktop
        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);
        }
コード例 #2
0
 public NewStockForm(m_users user)
 {
     InitializeComponent();
     this.user        = user;
     UserTextBox.Text = user.user_name;
 }