コード例 #1
0
        private async void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                APIService.Username = txtUsername.Text;
                APIService.Password = txtPassword.Text;
                APIService x      = new APIService("Offices");
                var        result = await _service.Get <List <Model.Response.Member> >(new Model.Search.Member {
                    Username = txtUsername.Text
                });

                if (result[0].RoleId != 1)
                {
                    MessageBox.Show("You are not authorized to access this application!");
                }
                else
                {
                    var frm = new frmIndex();
                    this.Hide();
                    if (frm.ShowDialog() == DialogResult.Cancel)
                    {
                        this.Visible = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Incorrect username or password! " + ex.InnerException);
            }
        }
コード例 #2
0
 private void frmIndex_Load(object sender, EventArgs e)
 {
     btnBack.Visible = false;
     _obj            = this;
 }