예제 #1
0
        void AutoLogout(T_PB_USER user)
        {
            var seializa = new SerializationMemoryObject <T_PB_USER>();

            seializa.Serializer(user);
            IsolatedStorageHelper.WriteSlTextFile("Login", seializa.SerializerData);

            MessageBox.Show("您的用户信息已经失效,已经被禁止使用该系统");
            if (LogoutSystem != null)
            {
                LogoutSystem(this, EventArgs.Empty);
            }
        }
예제 #2
0
        private void VailLogin(T_PB_USER user)
        {
            if (user.IsLogic)
            {
                (App.Current as App).Profile = user;

                var seializa = new SerializationMemoryObject <T_PB_USER>();
                seializa.Serializer(user);
                IsolatedStorageHelper.WriteSlTextFile("Login", seializa.SerializerData);

                if (LoginCompleted != null)
                {
                    LoginCompleted(this, EventArgs.Empty);
                }
            }
            else
            {
                VisualStateManager.GoToState(this, "loginerror", true);
            }
        }
예제 #3
0
 private void VailLogin(T_PB_USER user)
 {
     if (user.IsLogic)
     {
         var profile = (App.Current as IApplicationFramework).Profile;
         if (user.UserCode == profile.UserCode && user.PassWord == profile.PassWord)
         {
             if (!(user.RoleId.Equals("c6d0daae-d383-11e3-9a3b-00241d5227ba") ||
                   user.RoleId.Equals("e069ae6c-d383-11e3-9a3b-00241d5227ba") ||
                   (user.TimeOut != null && user.TimeOut.Value >= DateTime.Now)))
             {
                 AutoLogout(user);
             }
         }
         else
         {
             AutoLogout(user);
         }
     }
     else
     {
         AutoLogout(user);
     }
 }
예제 #4
0
        private void VailLogin(T_PB_USER user)
        {
            if (user.IsLogic)
            {
                (App.Current as App).Profile = user;

                var seializa = new SerializationMemoryObject<T_PB_USER>();
                seializa.Serializer(user);
                IsolatedStorageHelper.WriteSlTextFile("Login", seializa.SerializerData);

                if (LoginCompleted != null)
                    LoginCompleted(this, EventArgs.Empty);
            }
            else
                VisualStateManager.GoToState(this, "loginerror", true);
        }
예제 #5
0
        void LoginClick(object sender, MouseButtonEventArgs e)
        {
            var userCode = tb_userCode.Text.Trim();
            var passWord = tb_password.Password.Trim();
            if (string.IsNullOrEmpty(userCode))
            {
                MessageBox.Show("请输入帐号");
                tb_userCode.Focus();
                return;
            }
            if (string.IsNullOrEmpty(passWord))
            {
                MessageBox.Show("请输入密码");
                tb_password.Focus();
                return;
            }

            if (!IsolatedStorageHelper.IncreaseQuotaTo())
                return;

            VisualStateManager.GoToState(this, "logining", true);

            SetInfo();
            T_PB_USER user = new T_PB_USER() { IsLogic=true,IsLogin=1 };
            user.UserName = "******";
            user.PassWord = "******";
            user.MenuList = new System.Collections.ObjectModel.ObservableCollection<T_BASE_MENU>();
            user.MenuList.Add(new T_BASE_MENU { MenuID = "1", MenuName = "功能1", MenuImagePath = "/Images/FrameWork/Navigation/1.png" });
            user.MenuList.Add(new T_BASE_MENU { MenuID = "1", MenuName = "功能2", MenuImagePath = "/Images/FrameWork/Navigation/1.png" });
            user.MenuList.Add(new T_BASE_MENU { MenuID = "1", MenuName = "功能3", MenuImagePath = "/Images/FrameWork/Navigation/1.png" });
            user.MenuList.Add(new T_BASE_MENU { MenuID = "1", MenuName = "功能4", MenuImagePath = "/Images/FrameWork/Navigation/1.png" });
            VailLogin(user);
            return;
            //if (NetworkInterface.GetIsNetworkAvailable())
            //{
            //    client.UserLoginAsync(tb_userCode.Text, tb_password.Password, CurrentSystemType.Instance.SystemType);
            //}
            //else
            //{
            //    var seializa = new SerializationMemoryObject<T_PB_USER>();
            //    seializa.SerializerData = IsolatedStorageHelper.ReadSlTextFile("Login");
            //    if (string.IsNullOrEmpty(seializa.SerializerData))
            //    {
            //        MessageBox.Show("没有网络连接");
            //        VisualStateManager.GoToState(this, "loginerror", true);
            //        return;
            //    }
            //    var user= seializa.Deserialize();

            //     //管理员 和设计人员不限制日期
            //    if (user.UserCode == tb_userCode.Text && user.PassWord == tb_password.Password)
            //    {
            //        if (user.RoleId.Equals("c6d0daae-d383-11e3-9a3b-00241d5227ba") || user.RoleId.Equals("e069ae6c-d383-11e3-9a3b-00241d5227ba") || (user.TimeOut != null && user.TimeOut.Value >= DateTime.Now))
            //        {
            //            VailLogin(user);
            //        }
            //        else
            //        {
            //            MessageBox.Show(user.UserName + "用户已过期,使用期到" + user.TimeOut.Value.ToString("yyyy-MM-dd"));
            //            VisualStateManager.GoToState(this, "loginerror", true);
            //        }
            //    }
            //    else
            //    {
            //        MessageBox.Show("用户名密码错误");
            //        VisualStateManager.GoToState(this, "loginerror", true);
            //    }
            //}
        }
예제 #6
0
        void LoginClick(object sender, MouseButtonEventArgs e)
        {
            var userCode = tb_userCode.Text.Trim();
            var passWord = tb_password.Password.Trim();

            if (string.IsNullOrEmpty(userCode))
            {
                MessageBox.Show("请输入帐号");
                tb_userCode.Focus();
                return;
            }
            if (string.IsNullOrEmpty(passWord))
            {
                MessageBox.Show("请输入密码");
                tb_password.Focus();
                return;
            }

            if (!IsolatedStorageHelper.IncreaseQuotaTo())
            {
                return;
            }

            VisualStateManager.GoToState(this, "logining", true);

            SetInfo();
            T_PB_USER user = new T_PB_USER()
            {
                IsLogic = true, IsLogin = 1
            };

            user.UserName = "******";
            user.PassWord = "******";
            user.MenuList = new System.Collections.ObjectModel.ObservableCollection <T_BASE_MENU>();
            user.MenuList.Add(new T_BASE_MENU {
                MenuID = "1", MenuName = "功能1", MenuImagePath = "/Images/FrameWork/Navigation/1.png"
            });
            user.MenuList.Add(new T_BASE_MENU {
                MenuID = "1", MenuName = "功能2", MenuImagePath = "/Images/FrameWork/Navigation/1.png"
            });
            user.MenuList.Add(new T_BASE_MENU {
                MenuID = "1", MenuName = "功能3", MenuImagePath = "/Images/FrameWork/Navigation/1.png"
            });
            user.MenuList.Add(new T_BASE_MENU {
                MenuID = "1", MenuName = "功能4", MenuImagePath = "/Images/FrameWork/Navigation/1.png"
            });
            VailLogin(user);
            return;
            //if (NetworkInterface.GetIsNetworkAvailable())
            //{
            //    client.UserLoginAsync(tb_userCode.Text, tb_password.Password, CurrentSystemType.Instance.SystemType);
            //}
            //else
            //{
            //    var seializa = new SerializationMemoryObject<T_PB_USER>();
            //    seializa.SerializerData = IsolatedStorageHelper.ReadSlTextFile("Login");
            //    if (string.IsNullOrEmpty(seializa.SerializerData))
            //    {
            //        MessageBox.Show("没有网络连接");
            //        VisualStateManager.GoToState(this, "loginerror", true);
            //        return;
            //    }
            //    var user= seializa.Deserialize();

            //     //管理员 和设计人员不限制日期
            //    if (user.UserCode == tb_userCode.Text && user.PassWord == tb_password.Password)
            //    {
            //        if (user.RoleId.Equals("c6d0daae-d383-11e3-9a3b-00241d5227ba") || user.RoleId.Equals("e069ae6c-d383-11e3-9a3b-00241d5227ba") || (user.TimeOut != null && user.TimeOut.Value >= DateTime.Now))
            //        {
            //            VailLogin(user);
            //        }
            //        else
            //        {
            //            MessageBox.Show(user.UserName + "用户已过期,使用期到" + user.TimeOut.Value.ToString("yyyy-MM-dd"));
            //            VisualStateManager.GoToState(this, "loginerror", true);
            //        }
            //    }
            //    else
            //    {
            //        MessageBox.Show("用户名密码错误");
            //        VisualStateManager.GoToState(this, "loginerror", true);
            //    }
            //}
        }
예제 #7
0
 private void VailLogin(T_PB_USER user)
 {
     if (user.IsLogic)
     {
         var profile = (App.Current as IApplicationFramework).Profile;
         if (user.UserCode == profile.UserCode && user.PassWord == profile.PassWord)
         {
             if (!(user.RoleId.Equals("c6d0daae-d383-11e3-9a3b-00241d5227ba")
                 || user.RoleId.Equals("e069ae6c-d383-11e3-9a3b-00241d5227ba")
                 || (user.TimeOut != null && user.TimeOut.Value >= DateTime.Now)))
             {
                 AutoLogout(user);
             }
         }
         else
         {
             AutoLogout(user);
         }
     }
     else
     {
         AutoLogout(user);
     }
 }
예제 #8
0
        void AutoLogout(T_PB_USER user)
        {
            var seializa = new SerializationMemoryObject<T_PB_USER>();
            seializa.Serializer(user);
            IsolatedStorageHelper.WriteSlTextFile("Login", seializa.SerializerData);

            MessageBox.Show("您的用户信息已经失效,已经被禁止使用该系统");
            if (LogoutSystem != null)
                LogoutSystem(this, EventArgs.Empty);
        }