Example #1
0
        /// <summary>
        /// ユーザー情報取得(検索条件指定)
        /// </summary>
        /// <param name="structure">Trueの場合、構造体のみ返却</param>
        /// <returns></returns>
        public DataTable getUserInfo()
        {
            StringBuilder sb     = new StringBuilder();
            StringBuilder sbwork = new StringBuilder();

            sb.AppendLine("SELECT ");
            sb.AppendLine("* ");
            sb.AppendLine("FROM ");
            sb.AppendLine("M_USER ");
            sb.AppendLine("WHERE ");
            sb.AppendLine("USER_ID = null");

            // SQL実行
            DataTable dt = new SqlBridging().ExecuteReader(sb.ToString());

            return(dt);
        }
Example #2
0
        /// <summary>
        /// ユーザー情報取得(複数ユーザーiD指定)
        /// </summary>
        /// <param name="structure">Trueの場合、構造体のみ返却</param>
        /// <returns></returns>
        public DataTable getUserInfo(List <string> userIdList)
        {
            StringBuilder sb     = new StringBuilder();
            StringBuilder sbwork = new StringBuilder();

            sb.AppendLine("SELECT ");
            sb.AppendLine("* ");
            sb.AppendLine("FROM ");
            sb.AppendLine("M_USER ");
            sb.AppendLine("WHERE ");

            var parm = "";

            for (int i = 0; i < userIdList.Count; i++)
            {
                userIdList.CombineFromStringSingleQuotes(ref parm);
            }

            sb.AppendLine("USER_ID IN (@param)");
            sb = sb.Replace("@param", parm);

            sb.AppendLine(sbwork.ToString());

            // SQL実行
            DataTable dt = new SqlBridging().ExecuteReader(sb.ToString());

            DataColumn[] stringColumns =
                dt.Columns.Cast <DataColumn>()
                .Where(c => c.DataType == typeof(string))
                .ToArray();

            foreach (DataRow row in dt.Rows)
            {
                foreach (DataColumn col in stringColumns)
                {
                    if (row.Field <string>(col) == null)
                    {
                        continue;
                    }
                    row.SetField <string>(col, row.Field <string>(col).Trim());
                }
            }

            return(dt);
        }
Example #3
0
        /// <summary>
        /// 部署情報取得(検索条件指定)
        /// </summary>
        /// <param name="structure">Trueの場合、構造体のみ返却</param>
        /// <returns></returns>
        public DataTable getDivisionInfo()
        {
            StringBuilder sb     = new StringBuilder();
            StringBuilder sbwork = new StringBuilder();

            sb.AppendLine("SELECT ");
            sb.AppendLine("* ");
            sb.AppendLine("FROM ");
            sb.AppendLine("M_BUSYO_SEKKEI ");
            sb.AppendLine("WHERE ");
            sb.AppendLine("KA_CODE = null");
            sb.AppendLine("AND ");
            sb.AppendLine("BU_CODE = null");
            sb.AppendLine("AND ");
            sb.AppendLine("BY_PU = null");

            // SQL実行
            DataTable dt = new SqlBridging().ExecuteReader(sb.ToString());

            return(dt);
        }
Example #4
0
        /// <summary>
        /// 部署情報取得(検索条件指定)
        /// </summary>
        /// <param name="structure">Trueの場合、構造体のみ返却</param>
        /// <returns></returns>
        public DataTable getDivisionInfo(BLDivisionSearch parent)
        {
            StringBuilder sb      = new StringBuilder();
            StringBuilder sbwork  = new StringBuilder();
            StringBuilder sbwork2 = new StringBuilder();

            sb.AppendLine("SELECT ");
            sb.AppendLine("* ");
            sb.AppendLine("FROM ");
            sb.AppendLine("M_BUSYO_SEKKEI ");
            sb.AppendLine("WHERE ");

            if (parent.SearchPrmDivision != "")
            {
                sbwork.AppendLine("KA_CODE LIKE '@division%' ");
                sbwork = sbwork.Replace("@division", parent.SearchPrmDivision);
            }
            if (parent.SearchPrmDepartment != "")
            {
                if (sbwork.ToString() != "")
                {
                    sbwork.AppendLine("AND ");
                }
                sbwork.AppendLine("BU_CODE LIKE '@department%' ");
                sbwork = sbwork.Replace("@department", parent.SearchPrmDepartment);
            }

            sb.AppendLine(sbwork.ToString());

            sb.AppendLine("UNION ");
            sb.AppendLine("SELECT ");
            sb.AppendLine("* ");
            sb.AppendLine("FROM ");
            sb.AppendLine("M_BUSYO_HYOUKA ");
            sb.AppendLine("WHERE ");

            if (parent.SearchPrmDivision != "")
            {
                sbwork2.AppendLine("KA_CODE LIKE '@division%' ");
                sbwork2 = sbwork2.Replace("@division", parent.SearchPrmDivision);
            }
            if (parent.SearchPrmDepartment != "")
            {
                if (sbwork2.ToString() != "")
                {
                    sbwork2.AppendLine("AND ");
                }
                sbwork2.AppendLine("BU_CODE LIKE '@department%' ");
                sbwork2 = sbwork2.Replace("@department", parent.SearchPrmDepartment);
            }

            sb.AppendLine(sbwork2.ToString());

            // SQL実行
            DataTable dt = new SqlBridging().ExecuteReader(sb.ToString());

            DataColumn[] stringColumns =
                dt.Columns.Cast <DataColumn>()
                .Where(c => c.DataType == typeof(string))
                .ToArray();

            foreach (DataRow row in dt.Rows)
            {
                foreach (DataColumn col in stringColumns)
                {
                    if (row.Field <string>(col) == null)
                    {
                        continue;
                    }
                    row.SetField <string>(col, row.Field <string>(col).Trim());
                }
            }

            return(dt);
        }
Example #5
0
        /// <summary>
        /// ユーザー情報取得(検索条件指定)
        /// </summary>
        /// <param name="structure">Trueの場合、構造体のみ返却</param>
        /// <returns></returns>
        public DataTable getUserInfo(BLUserSearch parent)
        {
            StringBuilder sb     = new StringBuilder();
            StringBuilder sbwork = new StringBuilder();

            sb.AppendLine("SELECT ");
            sb.AppendLine("* ");
            sb.AppendLine("FROM ");
            sb.AppendLine("M_USER ");
            sb.AppendLine("WHERE ");

            if (parent.SearchPrmUserName != "")
            {
                sbwork.AppendLine("USER_NAME LIKE '@userName%' ");
                sbwork = sbwork.Replace("@userName", parent.SearchPrmUserName);
            }
            if (parent.SearchPrmMailAddress != "")
            {
                if (sbwork.ToString() != "")
                {
                    sbwork.AppendLine("AND ");
                }
                sbwork.AppendLine("MAIL LIKE '@address%' ");
                sbwork = sbwork.Replace("@address", parent.SearchPrmMailAddress);
            }
            if (parent.SearchPrmDepartment != "")
            {
                if (sbwork.ToString() != "")
                {
                    sbwork.AppendLine("AND ");
                }
                sbwork.AppendLine("BU_CODE LIKE '@department%' ");
                sbwork = sbwork.Replace("@department", parent.SearchPrmDepartment);
            }
            if (parent.SearchPrmDivision != "")
            {
                if (sbwork.ToString() != "")
                {
                    sbwork.AppendLine("AND ");
                }
                sbwork.AppendLine("KA_CODE LIKE '@division%' ");
                sbwork = sbwork.Replace("@division", parent.SearchPrmDivision);
            }

            sb.AppendLine(sbwork.ToString());

            // SQL実行
            DataTable dt = new SqlBridging().ExecuteReader(sb.ToString());

            DataColumn[] stringColumns =
                dt.Columns.Cast <DataColumn>()
                .Where(c => c.DataType == typeof(string))
                .ToArray();

            foreach (DataRow row in dt.Rows)
            {
                foreach (DataColumn col in stringColumns)
                {
                    if (row.Field <string>(col) == null)
                    {
                        continue;
                    }
                    row.SetField <string>(col, row.Field <string>(col).Trim());
                }
            }

            return(dt);
        }