Esempio n. 1
0
        /// <summary>
        /// 登出
        /// </summary>
        /// <param name="account">登录帐号</param>
        public void Logout(string account)
        {
            SqlCommandBase cmd = SqlBuilder.BuildSqlProcedure("p_sys_Logout");

            cmd.AddParam("@Account", SqlDbType.VarChar, account);
            DataProvider.Instance.ExecuteNoQuery(_Loginer.DBName, cmd.SqlCommand);
        }
Esempio n. 2
0
        /// <summary>
        /// 检查用户组是否存在
        /// </summary>
        /// <param name="groupCode">用户组编号</param>
        /// <returns></returns>
        public override bool CheckNoExists(string groupCode)
        {
            string         sql = "select count(*) from [C_UserGroup] where [GroupCode]=@GroupCode";
            SqlCommandBase cmd = SqlBuilder.BuildSqlCommandBase(sql);

            cmd.AddParam("@GroupCode", SqlDbType.VarChar, groupCode);
            object o = DataProvider.Instance.ExecuteScalar(_Loginer.DBName, cmd.SqlCommand);

            return(int.Parse(o.ToString()) > 0);
        }
        /// <summary>
        /// 搜索系统日志数据
        /// </summary>
        /// <param name="logUser">用户</param>
        /// <param name="tableName">数据表名</param>
        /// <param name="dateFrom">日志日期:由</param>
        /// <param name="dateTo">日志日期:至</param>
        /// <returns></returns>
        public DataSet SearchLog(string logUser, string tableName, DateTime dateFrom, DateTime dateTo)
        {
            SqlCommandBase cmd = SqlBuilder.BuildSqlProcedure("sp_SearchLog");

            cmd.AddParam("@LogUser", SqlDbType.VarChar, logUser);
            cmd.AddParam("@TableName", SqlDbType.VarChar, tableName);
            cmd.AddParam("@LogDateFrom", SqlDbType.VarChar, ConvertEx.ToCharYYYYMMDD(dateFrom));
            cmd.AddParam("@LogDateTo", SqlDbType.VarChar, ConvertEx.ToCharYYYYMMDD(dateTo));
            return(DataProvider.Instance.GetDataSet(_Loginer.DBName, cmd.SqlCommand));
        }
Esempio n. 4
0
        /// <summary>
        /// 检查用户是否存在
        /// </summary>
        /// <param name="userid">用户编号</param>
        /// <returns></returns>
        public bool ExistsUser(string account)
        {
            string         sql = "select count(*) from [C_User] where [Account]=@Account";
            SqlCommandBase cmd = SqlBuilder.BuildSqlCommandBase(sql);

            cmd.AddParam("@Account", SqlDbType.VarChar, account);
            object o = DataProvider.Instance.ExecuteScalar(_Loginer.DBName, cmd.SqlCommand);

            return(int.Parse(o.ToString()) > 0);
        }
Esempio n. 5
0
        public DataTable GetUserDirect(string account, string DBName)
        {
            string         sql = "select * from [C_User] where [Account]=@Account";
            SqlCommandBase cmd = SqlBuilder.BuildSqlCommandBase(sql);

            cmd.AddParam("@Account", SqlDbType.VarChar, account);
            DataTable dt = DataProvider.Instance.GetTable(DBName, cmd.SqlCommand, TUser.__TableName);

            return(dt);
        }
Esempio n. 6
0
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="account">帐号</param>
        /// <returns></returns>
        public bool DeleteUser(string account)
        {
            string         sql = "Delete [C_User] where [Account]=@Account";
            SqlCommandBase cmd = SqlBuilder.BuildSqlCommandBase(sql);

            cmd.AddParam("@Account", SqlDbType.VarChar, account);
            int i = DataProvider.Instance.ExecuteNoQuery(_Loginer.DBName, cmd.SqlCommand);

            return(i != 0);
        }
Esempio n. 7
0
        /// <summary>
        /// 获取用户所属组
        /// </summary>
        /// <param name="account">当前用户</param>
        /// <returns></returns>
        public DataTable GetUserGroups(string account)
        {
            string         SQL = "SELECT * FROM C_UserGroup WHERE GroupCode IN (SELECT GroupCode FROM C_UserGroupRe WHERE Account=@Account)";
            SqlCommandBase cmd = SqlBuilder.BuildSqlCommandBase(SQL);

            cmd.AddParam("@Account", SqlDbType.VarChar, account);
            DataTable dt = DataProvider.Instance.GetTable(_Loginer.DBName, cmd.SqlCommand, TUserGroup.__TableName);

            return(dt);
        }
Esempio n. 8
0
        /// <summary>
        /// 跟据Novell网帐号获取系统帐号
        /// </summary>
        /// <param name="novellAccount">Novell网帐号</param>
        /// <returns></returns>
        public DataTable GetUserByNovellID(string novellAccount)
        {
            string         sql = "select * from [C_User] where [NovellAccount]=@novellAccount";
            SqlCommandBase cmd = SqlBuilder.BuildSqlCommandBase(sql);

            cmd.AddParam("@novellAccount", SqlDbType.VarChar, novellAccount);
            DataTable dt = DataProvider.Instance.GetTable(_Loginer.DBName, cmd.SqlCommand, TUser.__TableName);

            return(dt);
        }
Esempio n. 9
0
        /// <summary>
        /// 获取指定单据的附件数据
        /// </summary>
        /// <param name="docID">单据号码</param>
        /// <returns></returns>
        public DataTable GetData(string docID)
        {
            string         sql = "select * from [tb_AttachFile] where [DocID]=@DocID";
            SqlCommandBase cmd = SqlBuilder.BuildSqlCommandBase(sql);

            cmd.AddParam("@docID", SqlDbType.VarChar, docID);
            DataTable dt = DataProvider.Instance.GetTable(_Loginer.DBName, cmd.SqlCommand, tb_AttachFile.__TableName);

            return(dt);
        }
Esempio n. 10
0
        public bool ModifyPwdDirect(string account, string pwd, string DBName)
        {
            string         sql = "update C_User set password=@password where account=@account";
            SqlCommandBase cmd = SqlBuilder.BuildSqlCommandBase(sql);

            cmd.AddParam("password", SqlDbType.VarChar, pwd);
            cmd.AddParam("account", SqlDbType.VarChar, account);
            object o = DataProvider.Instance.ExecuteNoQuery(DBName, cmd.SqlCommand);

            return(int.Parse(o.ToString()) != 0);
        }
Esempio n. 11
0
        public DataSet GetUserReportData(DateTime createDateFrom, DateTime createDateTo)
        {
            StringBuilder sb = new StringBuilder("select * from [C_User] where ISDELETED=0 ");

            if (createDateFrom.Year > 1901)
            {
                sb.Append(" AND CONVERT(VARCHAR,[CreateTime],112)>='" + createDateFrom.ToString("yyyyMMdd") + "'");
            }

            if (createDateTo.Year > 1901)
            {
                sb.Append(" AND CONVERT(VARCHAR,[CreateTime],112)<='" + createDateTo.ToString("yyyyMMdd") + "'");
            }

            SqlCommandBase cmd = SqlBuilder.BuildSqlCommandBase(sb.ToString());

            return(DataProvider.Instance.GetDataSet(_Loginer.DBName, cmd.SqlCommand));
        }
Esempio n. 12
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="userID">登录帐号</param>
        /// <returns></returns>
        public DataTable Login(LoginUser loginUser, char LoginUserType)
        {
            SqlCommandBase cmd = SqlBuilder.BuildSqlProcedure("p_sys_Login");

            cmd.AddParam("@Account", SqlDbType.VarChar, loginUser.Account);
            cmd.AddParam("@Password", SqlDbType.VarChar, loginUser.Password);
            cmd.AddParam("@DataSetID", SqlDbType.VarChar, loginUser.DataSetID);
            cmd.AddParam("@LoginUserType", SqlDbType.Char, LoginUserType);
            DataSet ds = DataProvider.Instance.GetDataSet(loginUser.DataSetDBName, cmd.SqlCommand);

            if (ds.Tables.Count == 2)
            {
                string error = ConvertEx.ToString(ds.Tables[1].Rows[0][0]);
                if (error.Trim() != string.Empty)
                {
                    throw new CustomException(error);                               //抛出异常
                }
                return(ds.Tables[0]);
            }
            return(null);
        }