示例#1
0
文件: User.cs 项目: riyuexing/rms
        /// <summary>
        /// 判断该用户是否能访问这个资源, 如果找不到该资源返回 true;
        /// </summary>
        /// <param name="code"></param>
        /// <param name="operationCode"></param>
        /// <returns></returns>
        public bool HasResourceRight(string code, string operationCode)
        {
            if (!AvailableFunction.isAvailableFunction(operationCode))
            {
                return(false);
            }

            string classCode    = operationCode.Substring(0, 4);
            string resourceCode = BLL.ResourceRule.GetResourceCode(code, classCode);

            if (resourceCode == "")
            {
                return(true);
            }
            AccessRangeStrategyBuilder sb = new AccessRangeStrategyBuilder();

            sb.AddStrategy(new Strategy(AccessRangeStrategyName.ResourceCode, resourceCode));
            ArrayList ar = new ArrayList();

            ar.Add(this.m_UserCode);
            ar.Add(BuildStationCodes());
            sb.AddStrategy(new Strategy(AccessRangeStrategyName.AccessRelation1, ar));
            sb.AddStrategy(new Strategy(AccessRangeStrategyName.OperationCode, operationCode));
            QueryAgent qa     = new QueryAgent();
            string     sql    = sb.BuildMainQueryString();
            EntityData entity = qa.FillEntityData("AccessRange", sql);

            qa.Dispose();
            bool canAccess = entity.HasRecord();

            entity.Dispose();
            return(canAccess);
        }
示例#2
0
文件: User.cs 项目: riyuexing/rms
        /// <summary>
        /// 用户权限
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public bool HasRight(string code)
        {
//			if ( code.Length == 2 )
//				return HasModuleRight(code);
//			else if ( code.Length== 4 )
//				return HasClassRight(code);
//			else if ( code.Length == 6 )
//				return HasOperationRight(code);
//			else
//				return false;

            if (!AvailableFunction.isAvailableFunction(code))
            {
                return(false);
            }

            return(m_OperationArray.Contains(code));
        }
示例#3
0
文件: User.cs 项目: riyuexing/rms
        /// <summary>
        /// 对该项操作的类型是否有权限
        /// </summary>
        /// <param name="operationCode">操作编号</param>
        /// <param name="typeCode">类型编号</param>
        /// <returns></returns>
        public bool HasTypeOperationRight(string operationCode, string typeCode)
        {
            if (!AvailableFunction.isAvailableFunction(operationCode))
            {
                return(false);
            }

            try
            {
                string inputFullID  = RmsPM.BLL.SystemGroupRule.GetSystemGroupFullID(typeCode);
                string stationCodes = BuildStationCodeString(this.BuildStationCodes());
                string s0           = String.Format(" ( AccessRange.AccessRangeType=0 and AccessRange.relationCode = '{0}' ) "
                                                    , this.UserCode);
                string s1 = "";
                if (stationCodes != "")
                {
                    s1 = String.Format(" or ( AccessRange.AccessRangeType=1 and AccessRange.relationCode in ( {0} ) ) "
                                       , stationCodes);
                }

                string sss = String.Format("select  dbo.GetSystemGroupFullID ( groupCode) as GroupFullID  from accessrange where operationcode='{0}' and  isnull( groupCode ,'') <> '' and  (  {1}  {2}  )"
                                           , new object[] { operationCode, s0, s1 });
                QueryAgent qa     = new QueryAgent();
                DataSet    entity = qa.ExecSqlForDataSet(sss);
                qa.Dispose();

                bool isFounded = false;
                foreach (DataRow dr in entity.Tables[0].Rows)
                {
                    string groupFullID = (string)dr["GroupFullID"];
                    if (inputFullID.IndexOf(groupFullID) == 0)
                    {
                        isFounded = true;
                        break;
                    }
                }
                entity.Dispose();
                return(isFounded);
            }
            catch (Exception ex)
            { throw ex; }
        }
示例#4
0
文件: User.cs 项目: riyuexing/rms
        /// <summary>
        ///
        /// </summary>
        /// <param name="code"></param>
        /// <param name="className"></param>
        /// <param name="operationCode"></param>
        /// <returns></returns>
        public bool HasResourceRight(string code, string className, string operationCode)
        {
            if (!AvailableFunction.isAvailableFunction(operationCode))
            {
                return(false);
            }

            try
            {
                bool       hasRight = false;
                EntityData entity   = GetOperationEntityData(code, className);
                if (entity.CurrentTable.Select(String.Format("OperationCode='{0}'", operationCode)).Length > 0)
                {
                    hasRight = true;
                }
                return(hasRight);
            }
            catch (Exception ex)
            { throw ex; }
        }
示例#5
0
文件: User.cs 项目: riyuexing/rms
        /// <summary>
        /// 判断费用项权限
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public bool GetCBSResourceRight(string code, string operationCode)
        {
            if (!AvailableFunction.isAvailableFunction(operationCode))
            {
                return(false);
            }

            try
            {
                bool    canAccess = false;
                DataSet ds        = GetCBSOperationEntityData(code);
                if (ds.Tables[0].Select(String.Format("OperationCode='{0}'", operationCode)).Length > 0)
                {
                    canAccess = true;
                }
                ds.Dispose();
                return(canAccess);
            }
            catch (Exception ex)
            { throw ex; }
        }
示例#6
0
        protected void Application_Start(Object sender, EventArgs e)
        {
            //记录application 开始时间 by simon
            SetLog4Net();
            LogHelper.WriteLog("系统开始运行");
            IAppConfigSetter setter = new AppConfigSetter();

            ApplicationConfiguration.SetAppConfiguration(setter);
            ClassBuilderManager.LoadClassBuilderDefine();

            ApplicationConfigSetup acs = new ApplicationConfigSetup();

            acs.LoadLogPath();
            acs.Dispose();


            BLL.WorkFlowSystemCode wfs = new RmsPM.BLL.WorkFlowSystemCode();
            Rms.WorkFlow.InterfaceManager.iSystemCode = wfs;

            BLL.WorkFlowDefine wfd = new RmsPM.BLL.WorkFlowDefine();
            Rms.WorkFlow.InterfaceManager.iDefinition = wfd;

            BLL.WorkFlowCaseIO wfci = new BLL.WorkFlowCaseIO();
            Rms.WorkFlow.InterfaceManager.iWorkCase = wfci;

            RmsPM.DAL.QueryStrategy.SystemClassDescription.LoadItem();

            string vPath = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["VirtualDirectory"]);

            Application["VirtualMapPath"] = vPath;

            AvailableFunction.LoadAvailableFunction();

            /********************** 在线用户统计 ***************************/
            Hashtable UserTable = new Hashtable();

            Application.Lock();
            Application["UserTable"] = UserTable;
            Application.UnLock();
            /***************************************************************/

            //单一用户登录
            Application["SingleUserLogin"] = BLL.ConvertRule.ToString(System.Configuration.ConfigurationManager.AppSettings["SingleUserLogin"]);

            //被弹出的用户列表
            Hashtable KilledUserTable = new Hashtable();

            Application.Lock();
            Application["KilledUserTable"] = KilledUserTable;
            Application.UnLock();

            //登录超时时间
            Application["LoginTimeOut"] = BLL.ConvertRule.ToDecimal(System.Configuration.ConfigurationSettings.AppSettings["LoginTimeOut"]);

            //是否使用新的合同结构(合同明细、合同计划分开)
            Application["IsContractNew"] = "1";            //System.Configuration.ConfigurationSettings.AppSettings["IsContractNew"];

            //营销系统接口
            Application["SalServiceUrl"] = BLL.ConvertRule.ToString(System.Configuration.ConfigurationSettings.AppSettings["SalServiceUrl"]);

            /********************** 定时器启动 ***************************/
            if (System.Configuration.ConfigurationSettings.AppSettings["SendMailTime"] != null)
            {
                //创建一个新的Timer实例
                if (sysTimer == null)
                {
                    sysTimer = new System.Timers.Timer();
                }
                //将sysTimer_Elapsed指定为计时器的 Elapsed 事件处理程序
                sysTimer.Elapsed  += new System.Timers.ElapsedEventHandler(sysTimer_Elapsed);
                sysTimer.Interval  = nInterMin * 60 * 1000;
                sysTimer.AutoReset = true;
                sysTimer.Enabled   = true;
                //ApplicationLog.WriteLog("SendMailTime", "定时器已经启动,邮件发送时间为" + System.Configuration.ConfigurationSettings.AppSettings["SendMailTime"].ToString());
            }
            /***************************************************************/
            Application["GridPageSize"] = 14;

            InitContractActorOperationList();
        }