Example #1
0
 private void OKButton_Click(object sender, RoutedEventArgs e)
 {
     
     string StrUserName = "";
     string StrPwd = "";
     StrUserName = this.nam.Text.ToString().Trim();
     StrPwd = this.paw.Password.ToString().Trim();
     if (string.IsNullOrEmpty(StrUserName))
     {
         ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), "用户名不能为空", Utility.GetResourceStr("CONFIRMBUTTON"));
         this.nam.Focus();
         return;
     }
     if (string.IsNullOrEmpty(StrPwd))
     {
         ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), "密码不能为空", Utility.GetResourceStr("CONFIRMBUTTON"));
         paw.Focus();
         return;
     }
     //client.SysUserInfoUpdateByUserIdandUsernameAsync("c16f11e6-6020-479b-970f-484f5f308b7e", "guojing", "33333");
     //client.UserLoginAsync(StrUserName,common);
     
     string aa="";
     //client.GetSystemTypeByUserIDAsync("70c153bb-111a-48ad-b605-541fb04b9497", aa);
     UserLogin login = new UserLogin(StrUserName, StrPwd);
     login.LoginedClick += (obj, ev) =>
     {
         //T_SYS_USER aa = new T_SYS_USER();
         if (login.LoginResult)
         {
             string StrFlag = "";
             string id="";
             UserInfo = login.GetUserInfo();
             MainPage mainPage = new MainPage();
             Common.ParentLayoutRoot = mainPage.LayoutRoot;
             AppConfig._CurrentStyleCode = 1;
             Common.ParentLayoutRoot = mainPage.LayoutRoot;
             App.Navigation(mainPage);
             App.MainPage = mainPage;
             if (App.Current.Resources["CurrentUserID"] == null)
             {
                 App.Current.Resources.Add("CurrentUserID", UserInfo.EMPLOYEEID);
             }
             //Common.CurrentConfig.CurrentUser.UserInfo = login.User;
             //client.GetUserPermissionByUserToUIAsync(UserInfo.SYSUSERID);
             //client.GetUserPermissionByUserAsync(login.User.SYSUSERID);
             //client.GetUserPermissionByUserToUIAsync(UserInfo.SYSUSERID);
             //personelClient.GetEmployeeDetailByIDAsync(login.User.EMPLOYEEID);
             //client.GetEntityMenuByUserAsync("1", login.User.SYSUSERID, StrFlag);
             UserInfo.REMARK = "test";
             //client.SysUserInfoUpdateAsync(UserInfo);
             //client.SysUserInfoUpdateByUserIdandUsernameAsync("","guojing","33333");
         }
         else
         {
             //用户名或密码错误
             ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("USERNAMEORPASSWORDERROR"), Utility.GetResourceStr("CONFIRMBUTTON"));
         }
     };
     //if (!string.IsNullOrEmpty(StrUserName) && !string.IsNullOrEmpty(StrPwd))
     //{
     //    client.GetUserInfoAsync(this.nam.Text);
     //}
 }
Example #2
0
        private void OK_Click(object sender, RoutedEventArgs e)
        {
            isLogining = true;
            RefreshBtn();
            SaveData();
            string StrUserName = "";//用户名
            string StrPwd = "";//密码
            string StrCode = ""; //验证码
            StrUserName = UserName.Text.ToString().Trim();
            StrPwd = paw.Password.ToString().Trim();
            //暂时不使用
            StrCode = YanZM.Text.ToString().Trim();


            if (string.IsNullOrEmpty(StrUserName))
            {
                Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("USERNAMENOTNULL"));
                UserName.Focus();
                return;
            }
            if (string.IsNullOrEmpty(StrPwd))
            {
                Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("PASSWORDNOTNULL"));
                paw.Focus();
                return;

            }

            //StrPwd = Utility.AESEncrypt(StrPwd);

            login = new UserLogin(StrUserName, StrPwd);
            login.LoginedClick += (obj, ev) =>
            {
                isLogining = false;
                if (login.LoginResult)
                {
                    UserInfo = login.GetUserInfo();
               
                    if (App.Current.Resources["CurrentUserID"] == null)
                    {
                        App.Current.Resources.Add("CurrentUserID", UserInfo.EMPLOYEEID);
                    }
                    
                    var nameOld = settings.Contains("UserName") ? Convert.ToString(settings["UserName"]) : "";
                    settings["UserName"] = StrUserName;
                    settings["UserPWD"] = StrPwd;
                    settings.Save();
                    isLogin = true;
                    string strEmployeeID = string.Empty;
                    if (SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo != null)
                    {
                        strEmployeeID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                    }
                    if ( (!settings.Contains("SYS_PostInfo")) || (nameOld != StrUserName))
                    {
                        hyperlinkButton1_Click(null, null);                      
                        isLogining = true;
                    }
                    login.OnGetOrgCompleted += (obje, eve) =>
                        {
                        };
                    login.LoadAllOrgInfo();
                }
                else
                {
                    MessageBox.Show("用户或密码错误!");
                }
                
                RefreshBtn();
            };
            
        }
Example #3
0
        //private void client_UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
        //{
        //    //try
        //    //{
        //        if (e != null)
        //        {
        //            Utility.CurrentUser = e.Result;
        //            AppContext.Host.SetRoot(new MainPage());
        //        }
        //    //}
        //    //catch (Exception ex)
        //    //{
        //    //    MessageBox.Show(ex.Message.ToString());
        //    //    btnLogin.IsEnabled = true;
        //    //    pBar.Stop();
        //    //}
        //}

        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtUserId.Text.Trim()))
                {
                    //MessageBox.Show("用户名不能为空!");
                    ComfirmWindow.ConfirmationBox("提示信息", "用户名不能为空!", "确定");
                    txtUserId.Focus();
                    return;
                }
              
                if (string.IsNullOrEmpty(txtPassword.Password.Trim()))
                {
                    //MessageBox.Show("用户密码不能为空!");
                    ComfirmWindow.ConfirmationBox("提示信息", "用户密码不能为空!", "确定");
                    txtPassword.Focus();
                    return;
                }

                btnLogin.IsEnabled = false;
                pBar.Start();
                #region 龙康才
                login = new UserLogin(txtUserId.Text.Trim(), txtPassword.Password.Trim());
                login.LoginedClick += (obj, ev) =>
                {
                    if (login.LoginResult)
                    {
                        loginUserInfo = login.GetUserInfo();
                        Utility.CurrentUser = new  T_SYS_USER();
                        Utility.CurrentUser.CREATEDATE = loginUserInfo.CREATEDATE;
                        Utility.CurrentUser.CREATEUSER = loginUserInfo.CREATEUSER;
                        Utility.CurrentUser.EMPLOYEECODE = loginUserInfo.EMPLOYEECODE;
                        Utility.CurrentUser.EMPLOYEEID = loginUserInfo.EMPLOYEEID;
                        Utility.CurrentUser.EMPLOYEENAME = loginUserInfo.EMPLOYEENAME;
                       // Utility.CurrentUser.EntityKey = loginUserInfo.EntityKey;
                        Utility.CurrentUser.ISENGINEMANAGER = loginUserInfo.ISENGINEMANAGER;
                        Utility.CurrentUser.ISFLOWMANAGER = loginUserInfo.ISFLOWMANAGER;
                        Utility.CurrentUser.ISMANGER = loginUserInfo.ISMANGER;
                        Utility.CurrentUser.OWNERCOMPANYID = loginUserInfo.OWNERCOMPANYID;
                        Utility.CurrentUser.OWNERDEPARTMENTID = loginUserInfo.OWNERDEPARTMENTID;
                        Utility.CurrentUser.OWNERID = loginUserInfo.OWNERID;
                        Utility.CurrentUser.OWNERPOSTID = loginUserInfo.OWNERPOSTID;
                        Utility.CurrentUser.PASSWORD = loginUserInfo.PASSWORD;
                        Utility.CurrentUser.REMARK = loginUserInfo.REMARK;
                        Utility.CurrentUser.STATE = loginUserInfo.STATE;
                        Utility.CurrentUser.SYSUSERID = loginUserInfo.SYSUSERID;
                      //  Utility.CurrentUser.T_SYS_USERROLE = loginUserInfo.T_SYS_USERROLE;
                        Utility.CurrentUser.UPDATEDATE = loginUserInfo.UPDATEDATE;
                        Utility.CurrentUser.UPDATEUSER = loginUserInfo.UPDATEUSER;
                        Utility.CurrentUser.USERNAME = loginUserInfo.USERNAME;
                      
                        AppContext.Host.SetRoot(new MainPage());
                    }
                    else
                    {
                        //用户名或密码错误
                        ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("USERNAMEORPASSWORDERROR"), Utility.GetResourceStr("CONFIRMBUTTON"));
                    }
                };
                #endregion
               // client.UserLoginAsync(txtUserId.Text.Trim(), UserLogin.Encrypt(txtPassword.Password.Trim()));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
                btnLogin.IsEnabled = true;
                pBar.Stop();
            }
        }
Example #4
0
        private void OK_Click(object sender, RoutedEventArgs e)
        {

            try
            {
                string StrUserName = "";//用户名
                string StrPwd = "";//密码
                string StrCode = ""; //验证码
                StrUserName = UserName.Text.ToString().Trim();
                StrPwd = paw.Password.ToString().Trim();
                //暂时不使用
                StrCode = YanZM.Text.ToString().Trim();


                if (string.IsNullOrEmpty(StrUserName))
                {
                    Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("USERNAMENOTNULL"));
                    UserName.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(StrPwd))
                {
                    Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("PASSWORDNOTNULL"));
                    paw.Focus();
                    return;

                }
                this.OK.IsEnabled = false;
                login = new UserLogin(StrUserName, StrPwd);
                loadbar.setloadingMessage("开始登录");
                login.LoginedClick += (obj, ev) =>
                {

                    if (login.LoginResult)
                    {
                        UserInfo = login.GetUserInfo();

                        Common.CurrentLoginUserInfo.UserName = UserInfo.USERNAME;
                        Common.CurrentLoginUserInfo.UserPwd = UserInfo.PASSWORD;                        
                        if (App.Current.Resources["CurrentUserID"] == null)
                        {
                            App.Current.Resources.Add("CurrentUserID", UserInfo.EMPLOYEEID);
                        }
                        //organClient.GetCompanyActivedAsync(UserInfo.EMPLOYEEID);
                        LoadStart();
                        LoadCompanyInfo();
                        if (!IsolatedStorageSettings.ApplicationSettings.Contains("usName"))
                        {
                            IsolatedStorageSettings.ApplicationSettings.Add("usName",this.UserName.Text);
                        }
                        else
                        {
                            IsolatedStorageSettings.ApplicationSettings["usName"] = this.UserName.Text;
                        }
                        if (!IsolatedStorageSettings.ApplicationSettings.Contains("Password"))
                        {
                            IsolatedStorageSettings.ApplicationSettings.Add("Password",paw.Password);
                        }
                        else
                        {
                            IsolatedStorageSettings.ApplicationSettings["Password"] = paw.Password;
                        }
                    }
                    else
                    {
                        this.OK.IsEnabled = true;
                        //用户名或密码错误
                        ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("USERNAMEORPASSWORDERROR"), Utility.GetResourceStr("CONFIRMBUTTON"));
                    }
                };
            }
            catch (Exception ex)
            {
                ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), ex.ToString(), Utility.GetResourceStr("CONFIRMBUTTON"));
            }


        }
Example #5
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OK_buton(object sender, System.Windows.RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(nam.Text) || string.IsNullOrEmpty(paw.Password))
            {
                MessageBox.Show("用户名或密码不能为空!");
            }
            else
            {

                this.OK.IsEnabled = false;
                UserLogin log = new UserLogin(nam.Text, paw.Password);
                log.LoginedClick += (obj, ev) =>
                {
                    if (log.LoginResult)
                    {
                        UserInfo = log.GetUserInfo();
                        // client.GetUserInfoAsync(nam.Text);
                        // 加载读取数据滚动条
                        if (App.Current.Resources["CurrentUserID"] == null)
                        {
                            App.Current.Resources.Add("CurrentUserID", UserInfo.EMPLOYEEID);
                        }
                        Common.CurrentLoginUserInfo.UserName = UserInfo.USERNAME;
                        Common.CurrentLoginUserInfo.UserPwd = UserInfo.PASSWORD;

                        LoadStart();
                        // 加载组织机构字典
                        LoadCompanyInfo();
                        if (IsolatedStorageSettings.ApplicationSettings.Contains("usName"))
                        {
                            IsolatedStorageSettings.ApplicationSettings["usName"] = nam.Text;
                        }
                        else
                        {
                            IsolatedStorageSettings.ApplicationSettings.Add("usName", nam.Text);
                        }
                        if (IsolatedStorageSettings.ApplicationSettings.Contains("Password"))
                        {
                            IsolatedStorageSettings.ApplicationSettings["Password"] = paw.Password;
                        }
                        else
                        {
                            IsolatedStorageSettings.ApplicationSettings.Add("Password", paw.Password);
                        }
                    }
                    else
                    {
                        //用户名或密码错误
                        this.OK.IsEnabled = true;
                        tbErrMsg.Text = Utility.GetResourceStr("USERNAMEORPASSWORDERROR");
                    }
                };


            }
        }