Example #1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     txtUserID.Text = WebServiceInstants.GetURL(ServiceType.remUser);
     if (bool.TrueString.Equals(WebServiceInstants.GetURL(ServiceType.RememberMe)))
     {
         chkRememberMe.Checked = true;
         txtPassword.Text      = WebServiceInstants.GetURL(ServiceType.remPassword);
     }
     else
     {
         chkRememberMe.Checked = false;
     }
 }
Example #2
0
        private void login()
        {
            if (!txtUserID.Text.Equals("") && !txtPassword.Text.Equals(""))
            {
                //MD5
                string pws = STL.PDA.Util.common.EncryptMD5(txtPassword.Text);

                try
                {
                    UserLogin.SI_MM028_PDA2SAP_LOGIN_OUTService svc = new UserLogin.SI_MM028_PDA2SAP_LOGIN_OUTService();;
                    svc.Url         = WebServiceInstants.GetURL(ServiceType.LoginURL);
                    svc.Credentials = nc.GetCredential(new Uri(svc.Url), "Basic");
                    UserLogin.ZFIS_PDA_LOGIN_REQ login_req = new STL.PDA.UserLogin.ZFIS_PDA_LOGIN_REQ();
                    login_req.ZDATA          = new STL.PDA.UserLogin.ZFIS_PDA_LOGIN_REQDATA();
                    login_req.ZDATA.PASSWORD = pws;
                    login_req.ZDATA.USERID   = txtUserID.Text;
                    UserLogin.ZFIS_PDA_LOGIN_RES login_res = svc.SI_MM028_PDA2SAP_LOGIN_OUT(login_req);
                    if (login_res.IF_STATU.Equals("01"))
                    {
                        MainForm mfm = new MainForm();
                        mfm.Show();
                        this.Hide();
                        SaveToConfig();
                    }
                    else
                    {
                        MessageBox.Show(login_res.IFMSG, "登陆失败");
                    }
                }
                catch (WebException ex)
                {
                    MessageBox.Show(ex.Status + ";" + ex.Response);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("Please enter User Name and password.");
            }
        }