Пример #1
0
        public int AddOperFunc(OperFunc operFunc, BusiLog busiLog)
        {
            //SqlConnection conn = ConnectionPool.BorrowConnection();
            int iRet = 0;

            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    iRet = OperFuncAccess.AddOperFunc(trans, operFunc);
                    BusiLogAccess.AddBusiLog(trans, busiLog);
                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
            return(iRet);
        }
Пример #2
0
        public DataTable GetOneOperFuncList(string strOperID)
        {
            SqlConnection conn  = ConnectionPool.BorrowConnection();
            DataTable     dtRet = null;

            try
            {
                dtRet = OperFuncAccess.GetOneOperFuncList(conn, strOperID);
            }
            finally
            {
                ConnectionPool.ReturnConnection(conn);
            }
            return(dtRet);
        }
Пример #3
0
        /// <summary>
        /// 执行登录
        /// </summary>
        /// <returns></returns>
        public Oper Login(out ArrayList lstPurview, out ArrayList lstPage)
        {
            SqlConnection conn = ConnectionPool.BorrowConnection();

            try
            {
                #region 取操作员实体

                DataTable dtOper = OperAccess.GetOperByName(conn, strOperName);
                if (dtOper.Rows.Count > 1)
                {
                    throw new BusinessException("操作员登录", "有同名操作员存在,登录失败!");
                }
                // 取操作员实体
                Oper operLogin = new Oper(dtOper);

                if (null == operLogin)
                {
                    throw new BusinessException("操作员登录", "操作员不存在,登录失败!");
                }
                if (!operLogin.cnbValidate)
                {
                    throw new BusinessException("操作员登录", "账号已失效,登录失败!");
                }
                if (operLogin.cnvcPwd != DataSecurity.Encrypt(strPassword))
                {
                    throw new BusinessException("操作员登录", "操作员密码不正确,登录失败!");
                }

                #endregion


                #region 处理操作人员权限

                // 处理操作人员权限
                lstPurview = new ArrayList();
                lstPage    = new ArrayList();
                DataTable dtOperFunc = OperFuncAccess.GetOneOperFuncList(conn, operLogin.cnnOperID.ToString());
                foreach (DataRow row in dtOperFunc.Rows)
                {
                    OperFunc operFunc = new OperFunc(row);
                    lstPurview.Add(operFunc.cnvcFuncName);
                    lstPage.Add(operFunc.cnvcFuncAddress);
                }

                #endregion

                #region 写登录日志

                // 写登录日志
                LoginLog loginLog = new LoginLog();
                loginLog.cnvcOperName  = strOperName;
                loginLog.cnvcIPAddress = strLoginIP;
                loginLog.cnvcBrowser   = strBrowser;
                loginLog.cndLoginTime  = DateTime.Now;
                EntityMapping.Create(loginLog, conn);

                #endregion

                return(operLogin);
            }
            finally
            {
                ConnectionPool.ReturnConnection(conn);
            }
        }