예제 #1
0
        private void MeuItemLogin_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                QH_Functions.QH_Functions qhfun = new QHMobile.QH_Functions.QH_Functions();
                qhfun.Url         = WebServiceInstants.GetURL(ServiceType.QH_Functions);
                qhfun.Credentials = nc;
                if (!qhfun.CompareDate(System.DateTime.Today.Day.ToString(), System.DateTime.Today.Month.ToString(), System.DateTime.Today.Year.ToString()))
                {
                    MessageBox.Show("Plase check your PDA date!");
                    return;

                    Cursor.Current = Cursors.Default;
                }

                if (!txtUserID.Text.Equals("") && !txtPassword.Text.Equals(""))
                {
                    string tempuser     = txtUserID.Text;
                    string temppassword = txtPassword.Text;


                    UsersQH.UsersQH_Service serviceUser = new QHMobile.UsersQH.UsersQH_Service();
                    serviceUser.Url         = WebServiceInstants.GetURL(ServiceType.UsersQH);
                    serviceUser.Credentials = nc;

                    UsersQH.UsersQH user = serviceUser.Read(tempuser);

                    if (user != null)
                    {
                        if (temppassword.Equals(user.Password))
                        {
                            LoginInformation linfo = new LoginInformation();
                            linfo.loginpassword  = user.Password;
                            linfo.loginuser      = user.UserName;
                            linfo.staffdimension = user.Stuff_Dimension;
                            linfo.userlevel      = user.UserLevel.ToString();

                            Cursor.Current = Cursors.Default;
                            SaveToConfig();
                            frmMain msc = new frmMain(linfo.loginuser, linfo.loginpassword, linfo.staffdimension, linfo.userlevel);
                            msc.Show();
                            this.Hide();
                        }
                        else
                        {
                            MessageBox.Show("Password is wrong.");
                            Cursor.Current = Cursors.Default;
                        }
                    }
                    else
                    {
                        MessageBox.Show("User Not Found!");
                    }
                }
                else
                {
                    MessageBox.Show("Please enter User Name and password.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
            Cursor.Current = Cursors.Default;
        }
예제 #2
0
        private void mnuGRNBack_Click(object sender, EventArgs e)
        {
            frmMain msc = new frmMain(username, staffdim, userlevel);

            msc.Show();
        }
예제 #3
0
        private void menuItem1_Click(object sender, EventArgs e)
        {
            frmMain frmMain = new frmMain(staffname, staffdimension, stafflevel);

            frmMain.Show();
        }