Esempio n. 1
0
        private void LoadUser_Completed(LoadUserOperation operation)
        {
            if (!operation.User.Identity.IsAuthenticated)
            {
                this.RootVisual = new MainLogin();
            }
            else
            {
                UserInfo = new UserInfo();
                ProductManager.Web.User lUser = operation.User.Identity as ProductManager.Web.User;
                UserInfo.UserName       = lUser.UserName;
                UserInfo.UserAction     = lUser.RightDictionary;
                UserInfo.UserDepartment = lUser.Department;
                UserInfo.UserID         = lUser.UserID;
                UserInfo.DepartmentID   = lUser.DepartmentID;
                UserInfo.UserPassword   = lUser.Password;
                UserInfo.IsManager      = lUser.IsManager;

                //InstanceContext context = new InstanceContext(LogonPersionCallBack);
                //IOnLinePersionService sc = new ProductManager.Web.OnLinePersionServiceContext(context);
                //sc.LogonPersion(UserInfo.UserID, UserInfo.UserName);
                LogonUser(UserInfo.UserID, UserInfo.UserName);
                this.RootVisual = new MainPage();
            }
        }
        private void LoginOperation_Completed(LoginOperation loginOperation)
        {
            IsBusy = false;
            if (loginOperation.LoginSuccess)
            {
                ProductManager.Web.User lUser = loginOperation.User.Identity as ProductManager.Web.User;
                if (lUser.IsFreeze)
                {
                    NotifyWindow notifyWindow = new NotifyWindow("用户已冻结", "用户已冻结!");
                    notifyWindow.Show();
                    return;
                }

                App app = Application.Current as App;
                app.UserInfo = new UserInfo();

                app.UserInfo.UserName       = lUser.UserName;
                app.UserInfo.UserAction     = lUser.RightDictionary;
                app.UserInfo.UserDepartment = lUser.Department;
                app.UserInfo.UserID         = lUser.UserID;
                app.UserInfo.DepartmentID   = lUser.DepartmentID;
                app.UserInfo.UserPassword   = lUser.Password;
                app.UserInfo.IsManager      = lUser.IsManager;

                if (app.UserInfo.UserPassword == Cryptography.MD5.GetMd5String("123456"))
                {
                    ModifyPasswrodWindow modifyPasswordWindow = new ModifyPasswrodWindow();
                    modifyPasswordWindow.Closed += modifyWindowClosed;
                    modifyPasswordWindow.Show();
                }
                else
                {
                    app.LogonUser(app.UserInfo.UserID, app.UserInfo.UserName);
                    FinishLogon(null);
                }
            }
            else
            {
                NotifyWindow notifyWindow = new NotifyWindow("用户名或密码错误", "用户名或密码错误");
                notifyWindow.Show();
            }
        }