Exemplo n.º 1
0
 private void btnShiJuanManage_Click(object sender, EventArgs e)
 {
     try
     {
         FrmShiJuanManager frmShiJuanManager = new FrmShiJuanManager();
         frmShiJuanManager.Show();
         this.Hide();
     }
     catch (Exception ex)
     {
         MessageBox.Show("打开试卷管理窗口异常," + ex.Message);
     }
 }
Exemplo n.º 2
0
        private async void doLogin(string strUrl, string strJsonPar)
        {
            try
            {
                var stringContent = new StringContent(strJsonPar, Encoding.UTF8, "application/json");
                var response      = await client.PostAsync(strUrl, stringContent);

                if (response.IsSuccessStatusCode)
                {
                    string strJsonRtn = response.Content.ReadAsStringAsync().Result;
                    ReturnResultEntity <MyUserEntity> returnResultEntity = JsonHelper.FromJson <ReturnResultEntity <MyUserEntity> >(strJsonRtn);
                    if (returnResultEntity.success)
                    {
                        MyUserEntity myUserEntity = returnResultEntity.data;
                        if (myUserEntity != null)
                        {
                            FrmShiJuanManager frmShiJuanManager = new FrmShiJuanManager();
                            frmShiJuanManager.UserId   = myUserEntity.userId;
                            frmShiJuanManager.UserName = myUserEntity.userName;
                            frmShiJuanManager.Show();
                            this.Hide();
                        }
                    }
                    else
                    {
                        MessageBox.Show("用户名或密码不正确");
                    }
                }
                else
                {
                    MessageBox.Show("Post登录失败,调用WebApi出错了");
                }
            }catch (Exception ex)
            {
                MessageBox.Show("Post登录异常," + ex.Message);
            }
        }