Example #1
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 #2
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 #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;
            }
        }
Example #4
0
 public virtual void KickoutUser(string uid, Hashtable result, SmartBox.Console.Service.ServiceReference1.ManagerServiceClient client)
 {
     if (client == null)
     {
         client = new SmartBox.Console.Service.ServiceReference1.ManagerServiceClient();
     }
     try
     {
         string[] sessionids = new string[] { uid };
         client.ForceQuitUsers(sessionids);
         result["d"] = "强制用户退出成功";
         result["r"] = true;
     }
     catch (Exception e)
     {
         result["r"]  = false;
         result["d"] += "强制用户退出失败,详细信息:" + e.Message;
     }
 }
        public JsonResult KickoutSelected(string ids)
        {
            Hashtable result = new Hashtable();
            result["r"] = true;
            string[] idlist = ids.Split(",".ToCharArray());

            SmartBox.Console.Service.ServiceReference1.ManagerServiceClient client = new SmartBox.Console.Service.ServiceReference1.ManagerServiceClient();
            string successStr = "";
            int successCnt = 0;
            string failedStr = "";
            int failedCnt = 0;
            foreach (string uid in idlist)
            {
                if (String.IsNullOrEmpty(uid))
                    continue;

                Hashtable r = new Hashtable();
                Bo.BoFactory.GetSMC_UserBo.KickoutUser(uid, r, client);
                if ((bool)r["r"])
                {
                    successStr += uid + "、";
                    successCnt++;
                }
                else
                {
                    failedStr += uid + "、";
                    failedCnt++;
                }

                //Bo.BoFactory.GetSMC_UserBo.PassUser(uid);
            }
            if (successCnt > 0)
                result["d"] += successStr + "已强制退出! ";

            if (failedCnt > 0)
                result["d"] += failedStr + "强制退出失败!";

            return Json(result);
        }
        public JsonResult Kickout(string uid, string uname)
        {
            uid = Server.UrlEncode(uid);
            uname = Server.UrlEncode(uname);
            Hashtable result = new Hashtable();
            SmartBox.Console.Service.ServiceReference1.ManagerServiceClient client = new SmartBox.Console.Service.ServiceReference1.ManagerServiceClient();
            Bo.BoFactory.GetSMC_UserBo.KickoutUser(uid, result, client);

            result["d"] = "用户" + uname + ((bool)result["r"] ? "已强制退出!" : "未强制退出!");

            return Json(result);
        }