예제 #1
0
        public ActionResult ProductAbout()
        {
            string Copyright = string.Empty;
            NGCOM  ngcom     = new NGCOM();

            ViewBag.SN       = ngcom.SN;
            ViewBag.AllUsers = ngcom.AllUsers;
            ViewBag.OAUsers  = ngcom.OAUsers;
            ViewBag.UserName = ngcom.UserName;
            ViewBag.FullName = GetProductAboutMsg();
            return(View("ProductAbout"));
        }
예제 #2
0
        /// <summary>
        /// 设置登录套件的信息
        /// </summary>
        /// <param name="product">产品</param>
        /// <param name="suitInfo">套件,采用i6Hr,i6WM,..格式,用逗号分开</param>
        /// <returns></returns>
        //[MethodImpl(MethodImplOptions.Synchronized)]
        public bool SetLoginUsers(string product, string suitInfo, string mac)
        {
            //UserDac userDac = new UserDac();
            bool lockedSuccess = false;

            //在此检测登录数
            NG3.Cache.Interface.IMemCachedClient memClient = NG3.MemCached.Client.MemCachedClientFactory.GetMemCachedClient();

            Mutex mutex = GetMutex();

            try
            {
                //lockedSuccess = userDac.LockByDb(ConnectionInfoService.GetSessionConnectString());
                //memClient.BeginLock("NNSERVERMAXUSERCONTROLKEY");
                mutex.WaitOne(15000);    //15秒超时
                int    currentUsers = GetOnlineUserCount();
                string maxUsers     = "36984";
#if !DEBUG
                maxUsers = memClient.GetSmallObject(NSSERVER_MAX_USERS_INFO) as string;
                if (maxUsers == null)
                {
                    int oauser  = new NGCOM().OAUsers;
                    int alluser = new NGCOM().AllUsers;
                    maxUsers = (oauser + alluser).ToString();
                    memClient.SetSmallObject(NSSERVER_MAX_USERS_INFO, maxUsers);
                }
#endif

                #region
                string[] idArr = GetSessionID(CurrentSessionInfo.LoginID);
                foreach (string id in idArr)
                {
                    OnlineInfo infoTmp = HSLoginInfo[id] as OnlineInfo;
                    if (infoTmp != null)
                    {
                        if (infoTmp.IsOaUser == "0")    //当前坑是非OA
                        {
                            string currentAllusers = memClient.GetSmallObject("NSSERVERALLUSERSINFO_CURRENT") as string;
                            if ((!String.IsNullOrEmpty(currentAllusers)) && (currentAllusers != "0"))    //非OA当前用户数-1
                            {
                                currentAllusers = (int.Parse(currentAllusers) - 1).ToString();
                                memClient.SetSmallObject("NSSERVERALLUSERSINFO_CURRENT", currentAllusers);
                            }
                        }
                    }
                }
                #endregion


                if (currentUsers < int.Parse(maxUsers))
                {
                    OnlineInfo lInfo = new OnlineInfo();

                    #region 注册登录信息

                    lInfo.UniqueClientID = CurrentSessionInfo.UniqueClientID;
                    lInfo.SessionID      = CurrentSessionInfo.SessionID;
                    lInfo.IPAddr         = CurrentSessionInfo.IPAddr;
                    lInfo.MacAddr        = mac;
                    lInfo.Product        = product;
                    lInfo.LoginID        = CurrentSessionInfo.LoginID;
                    lInfo.LoginName      = CurrentSessionInfo.LoginName;
                    lInfo.LoginTime      = DateTime.Now;
                    lInfo.LastRefTime    = DateTime.Now;
                    lInfo.LoginUCode     = CurrentSessionInfo.LoginUCode;
                    lInfo.LoginUName     = CurrentSessionInfo.LoginUName;
                    lInfo.LoginOCode     = CurrentSessionInfo.LoginOCode;
                    lInfo.LoginOName     = CurrentSessionInfo.LoginOName;
                    lInfo.DeptNo         = CurrentSessionInfo.DeptNo;
                    lInfo.DeptName       = CurrentSessionInfo.DeptName;

                    if (suitInfo != null && suitInfo.Trim().Length > 0)
                    {
                        lInfo.LoginSuitInfo = suitInfo;
                    }
                    else
                    {
                        lInfo.LoginSuitInfo = string.Empty;
                    }
                    #endregion

                    //SyncHSLoginInfoWithCacheServer(0);
                    this.GetALLOnlineUserFromCache();
                    //踢掉已登录的用户
                    //string[] idArr = GetSessionID(CurrentSessionInfo.LoginID);
                    foreach (string id in idArr)
                    {
                        OnlineInfo infoTmp = HSLoginInfo[id] as OnlineInfo;
                        if (infoTmp != null)
                        {
                            //if (infoTmp.IPAddr == CurrentSessionInfo.IPAddr)
                            //{//自己登陆
                            //    //HSLoginInfo.Remove(id);
                            //    RemoveOnlineUserInfo(id);
                            //}
                            //else
                            //{//强制登陆,踢掉别人
                            //    this.KillLoginUser(id, CurrentSessionInfo.IPAddr);
                            //}
                            //由于远程登录用户无法获取到真实ip,如果根据ip判断会导致不同用户远程同一台机器的时候用相同的用户名登录而不会踢人
                            this.KillLoginUser(id, CurrentSessionInfo.IPAddr);
                        }
                    }
                    //HSLoginInfo[CurrentSessionInfo.SessionID] = lInfo;
                    //存到缓存服务器中
                    this.SaveOnlineUserToCache(CurrentSessionInfo.UniqueClientID, lInfo);
                    //HSLoginInfoUpdate(CurrentSessionInfo.SessionID, lInfo);
                    //写一份OnlineInfo到Session
                    BackupOnlineInfoToSession(lInfo);
                    //memClient.EndLock("NNSERVERMAXUSERCONTROLKEY");
                    return(true);
                }
                else    //超过最大用户数
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                //if (lockedSuccess)//加锁成功的才进行解锁
                //{
                //    userDac.UnLockByDb(ConnectionInfoService.GetSessionConnectString());
                //}
                //memClient.EndLock("NNSERVERMAXUSERCONTROLKEY");
                mutex.ReleaseMutex();
            }
        }
예제 #3
0
        public DataTable RigthFiltrateExt(string usertype, DataTable menudt, TreeDataLevelType level)
        {
            rightdata.LoginConnectionStr = NG3.AppInfoBase.UserConnectString;
            //用户的菜单权限
            DataTable dtUserPageRights = rightdata.UserPageRightsDtExt; //cpcmInterface.GetAllPageRights(ocode, logid);
            //所有菜单权限
            DataTable dtAllPageRights = rightdata.AllPageRightsDt;      //cpcmInterface.GetAllPageRights();


            for (int i = menudt.Rows.Count - 1; i >= 0; i--)
            {
                DataRow dr = menudt.Rows[i];

                string norightcontrol = dr["norightcontrol"].ToString();
                if (norightcontrol == "1")
                {
                    if (show)
                    {
                        dr["name"] += "(不控制权限)";
                    }
                    continue;//不需要权限控制标记为:"1",跳过
                }

                //功能节点
                string functionnodeflag = dr["functionnode_flag"].ToString();
                string url       = dr["url"].ToString();
                string nodeid    = dr["id"].ToString();
                string apptype   = dr["apptype"].ToString().ToLower();
                string rightname = dr["rightname"].ToString();//权限名、权限号

                string moduleno = dr["moduleno"].ToString();
                //string rightid = dr["rightid"].ToString();
                string funcname = (dr["functionname"] == null || dr["functionname"] == DBNull.Value) ? string.Empty : dr["functionname"].ToString();

                Int64 rightkey = 0;
                Int64.TryParse(dr["rightkey"].ToString(), out rightkey);

                if ("ProjectOpportunityListManager" == rightname)
                {
                }

                //winform
                if (apptype == AppType.WinForm)
                {
                    if (rightkey == -1 || rightkey == 0)
                    {
                        if (show)
                        {
                            dr["name"] += "(win权限error)";
                        }
                        continue;
                    }
                    else
                    {
                        DataRow[] drs = dtUserPageRights.Select(string.Format("rightkey={0}", rightkey));
                        if (drs.Length == 0)
                        {
                            if (show)
                            {
                                dr["name"] += "(win无权限)";
                            }
                            else
                            {
                                dr.Delete();
                            }
                        }
                    }
                }
                else if (apptype == AppType.PB)//pb
                {
                    #region intfi网银控制,为提高性能,暂时先放在pb权限控制这一段

                    if (dr["ebankflg"] != null && dr["ebankflg"] != DBNull.Value && !string.IsNullOrEmpty(dr["ebankflg"].ToString()))
                    {
                        string ebankflg = dr["ebankflg"].ToString();

                        if (ebankflg.Equals("1"))
                        {
                            NGCOM  ngcom = new NGCOM();
                            string flag  = ngcom.GetEbank();
                            if (flag.Equals("0"))
                            {
                                if (show)
                                {
                                    dr[""] += "(无网银)";
                                    //ShowTitle(doc, node, "(无网银)");//测试用
                                }
                                else
                                {
                                    dr.Delete();
                                }
                                continue;
                            }
                        }
                    }

                    #endregion

                    if (rightkey == 0)
                    {
                        if (show)
                        {
                            dr["name"] += "(pb权限error)";
                        }
                        continue;
                    }
                    else if (rightkey == -1)
                    {
                        if (show)
                        {
                            dr["name"] += "(pb权限error)";
                        }
                        continue;
                    }
                    else
                    {
                        DataRow[] drs = dtUserPageRights.Select(string.Format("rightkey={0}", rightkey));
                        if (drs.Length == 0)
                        {
                            if (show)
                            {
                                dr["name"] += "(pb无权限)";
                            }
                            else
                            {
                                dr.Delete();
                            }
                        }
                    }
                }
                else if (apptype == AppType.WebForm || apptype == AppType.WebMvc)//web
                {
                    if (rightkey == -1 || rightkey == 0)
                    {
                        if (show)
                        {
                            dr["name"] += "(web权限error)";
                        }
                        continue;
                    }
                    else
                    {
                        DataRow[] drs = dtUserPageRights.Select(string.Format("rightkey={0}", rightkey));
                        if (drs.Length == 0)
                        {
                            if (show)
                            {
                                dr["name"] += "(web无权限)";
                            }
                            else
                            {
                                dr.Delete();
                            }
                        }
                    }
                }
            }

            menudt.AcceptChanges();
            if (level == TreeDataLevelType.TopLevel)
            {
                this.RemoveNode(menudt);
            }
            menudt.AcceptChanges();

            //DataRow[] dr = dt.Select("TabPageID = 'TabPageContractManage'");
            //DataRow[] dddd = menudt.Select("code = 990100120303");
            return(menudt);
        }