예제 #1
0
        /// <summary>
        /// 用户登录完成事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void sysloginClinet_SystemLoginCompleted(object sender, SystemLoginCompletedEventArgs e)
        {
            if (e.Error != null && e.Error.Message != "")
            {
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(e.Error.ToString());
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
            }
            else
            {
                if (e.Result == null)
                {
                    txtLoadingMessage.Text = "用户名密码错误,请重试";
                    btnLogin.IsEnabled     = true;
                    return;
                }
                else
                {
                    string pwdChecker = CheckPwd(this.txbUserPassword.Password);
                    if (!string.IsNullOrEmpty(pwdChecker))
                    {
                        btnLogin.IsEnabled     = true;
                        txtLoadingMessage.Text = "若已修改密码,请重新登录.";
                        this.parentWindow.NavigateToRegistration();
                        return;
                    }

                    //txtLoadingMessage.Text = "登录成功,开始获取员工信息......";
                    sysUser            = new EmployeeInfoWS.V_UserLogin();
                    sysUser.EMPLOYEEID = e.Result.EMPLOYEEID;
                    sysUser.ISMANAGER  = e.Result.ISMANAGER;
                    sysUser.SYSUSERID  = e.Result.SYSUSERID;
                    NotifyUserMessage("登录成功,正在初始化系统,请稍等......");
                    //登录成功,获取员工信息
                    EmployeeInfoClient.getEmployeeInfobyLoginAsync(sysUser.EMPLOYEEID);

                    SMT.SaaS.LocalData.Tables.V_UserLogin us = new SaaS.LocalData.Tables.V_UserLogin();
                    us.UserName   = txbUserName.Text;
                    us.EMPLOYEEID = sysUser.EMPLOYEEID;
                    us.ISMANAGER  = sysUser.ISMANAGER;
                    us.SYSUSERID  = sysUser.SYSUSERID;
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo            = new LoginUserInfo();
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID = us.EMPLOYEEID;
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.SysUserID  = us.SYSUSERID;
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.IsManager  = us.ISMANAGER == "1" ? true : false;
                    //SMT.SaaS.LocalData.ViewModel.V_UserLoginVM.SaveV_UserLogin(txbUserName.Text, us);
                    if (!IsolatedStorageSettings.ApplicationSettings.Contains("user"))
                    {
                        IsolatedStorageSettings.ApplicationSettings.Add("user", us);
                    }
                }
            }
        }
예제 #2
0
파일: Login.xaml.cs 프로젝트: jjg0519/OA
        /// <summary>
        /// 根据SysUserID,验证用户是否允许登录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void sysloginClinet_GetUserInfobyIDCompleted(object sender, GetUserInfobyIDCompletedEventArgs e)
        {
            if (e.Error != null && e.Error.Message != string.Empty)
            {
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(e.Error.ToString());
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                HtmlPage.Window.Invoke("loadCompletedSL", new string[] { "false", e.Error.ToString() });
            }
            else
            {
                if (e.Result == null)
                {
                    txtUserMsg.Text = "警告!用户异常,不能执行当前请求。";
                    HtmlPage.Window.Invoke("loadCompletedSL", new string[] { "false", txtUserMsg.Text });
                    SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage("警告!用户不存在,不能执行当前请求。");
                    SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                    return;
                }
                else
                {
                    isloading          = true;
                    sysUser            = new EmployeeInfoWS.V_UserLogin();
                    sysUser.EMPLOYEEID = e.Result.EMPLOYEEID;
                    sysUser.ISMANAGER  = e.Result.ISMANAGER;
                    sysUser.SYSUSERID  = e.Result.SYSUSERID;

                    //登录成功,获取员工信息
                    employeeInfoClient.getEmployeeInfobyLoginAsync(sysUser.EMPLOYEEID);

                    SMT.SaaS.LocalData.Tables.V_UserLogin us = new SaaS.LocalData.Tables.V_UserLogin();
                    us.UserName   = sysUser.SYSUSERID;
                    us.EMPLOYEEID = sysUser.EMPLOYEEID;
                    us.ISMANAGER  = sysUser.ISMANAGER;
                    us.SYSUSERID  = sysUser.SYSUSERID;
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo            = new LoginUserInfo();
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID = us.EMPLOYEEID;
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.SysUserID  = us.SYSUSERID;
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.IsManager  = us.ISMANAGER == "1" ? true : false;
                }
            }
        }
예제 #3
0
        /// <summary>
        /// 用户登录完成事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void sysloginClinet_SystemLoginCompleted(object sender, SystemLoginCompletedEventArgs e)
        {
            if (e.Error != null && e.Error.Message != "")
            {
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(e.Error.ToString());
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
            }
            else
            {
                if (e.Result == null)
                {
                    txtLoadingMessage.Text = "用户名密码错误,请重试";
                    btnLogin.IsEnabled = true;
                    return;
                }
                else
                {
                    string pwdChecker = CheckPwd(this.txbUserPassword.Password);
                    if (!string.IsNullOrEmpty(pwdChecker))
                    {
                        btnLogin.IsEnabled = true;
                        txtLoadingMessage.Text = "若已修改密码,请重新登录.";
                        this.parentWindow.NavigateToRegistration();
                        return;
                    }

                    //txtLoadingMessage.Text = "登录成功,开始获取员工信息......";
                    sysUser = new EmployeeInfoWS.V_UserLogin();
                    sysUser.EMPLOYEEID = e.Result.EMPLOYEEID;
                    sysUser.ISMANAGER = e.Result.ISMANAGER;
                    sysUser.SYSUSERID = e.Result.SYSUSERID;
                    NotifyUserMessage("登录成功,正在初始化系统,请稍等......");
                    //登录成功,获取员工信息
                    EmployeeInfoClient.getEmployeeInfobyLoginAsync(sysUser.EMPLOYEEID);

                    SMT.SaaS.LocalData.Tables.V_UserLogin us = new SaaS.LocalData.Tables.V_UserLogin();
                    us.UserName = txbUserName.Text;
                    us.EMPLOYEEID = sysUser.EMPLOYEEID;
                    us.ISMANAGER = sysUser.ISMANAGER;
                    us.SYSUSERID = sysUser.SYSUSERID;
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo = new LoginUserInfo();
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID = us.EMPLOYEEID;
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.SysUserID = us.SYSUSERID;
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.IsManager = us.ISMANAGER == "1" ? true : false;
                    //SMT.SaaS.LocalData.ViewModel.V_UserLoginVM.SaveV_UserLogin(txbUserName.Text, us);
                    if (!IsolatedStorageSettings.ApplicationSettings.Contains("user"))
                    {
                        IsolatedStorageSettings.ApplicationSettings.Add("user", us);
                    }
                }
            }
        }
예제 #4
0
        /// <summary>
        /// 根据SysUserID,验证用户是否允许登录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void sysloginClinet_GetUserInfobyIDCompleted(object sender, GetUserInfobyIDCompletedEventArgs e)
        {
            if (e.Error != null && e.Error.Message != string.Empty)
            {
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(e.Error.ToString());
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                HtmlPage.Window.Invoke("loadCompletedSL", new string[] { "false", e.Error.ToString() });
            }
            else
            {
                if (e.Result == null)
                {
                    txtUserMsg.Text = "警告!用户异常,不能执行当前请求。";
                    HtmlPage.Window.Invoke("loadCompletedSL", new string[] { "false", txtUserMsg.Text });
                    SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage("警告!用户不存在,不能执行当前请求。");
                    SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                    return;
                }
                else
                {
                    isloading = true;
                    sysUser = new EmployeeInfoWS.V_UserLogin();
                    sysUser.EMPLOYEEID = e.Result.EMPLOYEEID;
                    sysUser.ISMANAGER = e.Result.ISMANAGER;
                    sysUser.SYSUSERID = e.Result.SYSUSERID;

                    //登录成功,获取员工信息
                    employeeInfoClient.getEmployeeInfobyLoginAsync(sysUser.EMPLOYEEID);

                    SMT.SaaS.LocalData.Tables.V_UserLogin us = new SaaS.LocalData.Tables.V_UserLogin();
                    us.UserName = sysUser.SYSUSERID;
                    us.EMPLOYEEID = sysUser.EMPLOYEEID;
                    us.ISMANAGER = sysUser.ISMANAGER;
                    us.SYSUSERID = sysUser.SYSUSERID;
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo = new LoginUserInfo();
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID = us.EMPLOYEEID;
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.SysUserID = us.SYSUSERID;
                    SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.IsManager = us.ISMANAGER == "1" ? true : false;
                }
            }
        }