Example #1
0
        public virtual bool LockUser(string uid)
        {
            SMC_User u = SMC_UserDao.GetUser(uid);

            if (u != null)
            {
                //u.u_auth_status = UserAuthStatus.Passed;
                u.u_lock_status      = UserLockedStatus.Locked;
                u.u_lock_expire_time = DateTime.Now.AddHours(1);//1小时后自动解锁
                u.u_lock_time        = DateTime.Now;
                SMC_UserDao.Update(u);

                try
                {
                    SmartBox.Console.Service.ServiceReference1.ManagerServiceClient client = new SmartBox.Console.Service.ServiceReference1.ManagerServiceClient();
                    client.ForceQuitUsers(new string[] { uid });
                }
                catch (Exception ex)
                {
                    Log4NetHelper.Error(ex);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        public virtual bool NotPassUser(string uid)
        {
            SMC_User u = SMC_UserDao.GetUser(uid);

            if (u != null)
            {
                //u.u_auth_status = UserAuthStatus.Rejected;
                u.u_auth_time        = DateTime.Now;
                u.u_enable_status    = UserEnabledStatus.Disabled;
                u.u_disable_time     = DateTime.Now;
                u.u_lock_expire_time = DateTime.MaxValue;//给一个比较大的时间值
                SMC_UserDao.Update(u);

                try
                {
                    SmartBox.Console.Service.ServiceReference1.ManagerServiceClient client = new SmartBox.Console.Service.ServiceReference1.ManagerServiceClient();
                    client.ForceQuitUsers(new string[] { uid });
                }
                catch (Exception ex)
                {
                    Log4NetHelper.Error(ex);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        public virtual void LockDevice(string id, string hour, Hashtable r)
        {
            DeviceDao dao = new DeviceDao(AppConfig.mainDbKey);
            Device    d   = dao.Get(id);

            d.LockTime        = DateTime.Now;
            d.Status          = 1;
            d.LockExpireHours = String.IsNullOrEmpty(hour) ? 0 : int.Parse(hour);
            dao.Update(d);
            r["r"] = true;
            SmartBox.Console.Service.ServiceReference1.ManagerServiceClient client = new SmartBox.Console.Service.ServiceReference1.ManagerServiceClient();

            try
            {
                DeviceUserDao duDao = new DeviceUserDao(AppConfig.mainDbKey);
                List <Tuple <string, string, object> > pars = new List <Tuple <string, string, object> >();
                pars.Add(new Tuple <string, string, object>("deviceid", "=", id));
                List <DeviceUser> deviceUsers = duDao.QueryList(pars);
                var rr = from e in deviceUsers select e.UID;

                string[] sessionids = rr.ToArray();
                client.ForceQuitUsers(sessionids);
            }
            catch (Exception e)
            {
                r["d"] += "强制用户退出失败,详细信息:" + e.Message;
            }
        }