コード例 #1
0
        /// <summary>
        /// Find all function by key search
        /// </summary>
        /// <param name="keysSearch">contain collection of parameter of condition searching, split by '|'</param>
        /// <param name="options">contain collection of parameter to custom value return</param>
        /// <param name="totalRecord">Total record matching condition</param>
        /// <returns>Dataset rows of record matching</returns>
        public static DataSet FindFunction(string keysSearch, OptionFilter options, ref int totalRecord)
        {
            var ds = new DataSet();

            try
            {
                // Keys search
                var functionName = Null.NullString; // Find by near value matching of FunctionName/DisplayNameOnMenu
                var functionType = Null.NullString; // Array FunctionType, split by ',' and user IN operator in sql for searching
                var href         = Null.NullString; // Find by near value matching of  HrefGet/HrefPost
                var parentId     = Null.NullString; // Array Prid, split by ',' and user IN operator in sql for searching
                var level        = Null.NullString; // Array Level, split by ',' and user IN operator in sql for searching
                if (!string.IsNullOrEmpty(keysSearch))
                {
                    var arrKeySearch = keysSearch.Split('|');
                    if (arrKeySearch.Length == 5)
                    {
                        functionName = arrKeySearch[0];
                        functionType = KeySearch.FilterComboboxValue(arrKeySearch[1]);
                        href         = arrKeySearch[2];
                        parentId     = KeySearch.FilterComboboxValue(arrKeySearch[3]);
                        level        = arrKeySearch[4];
                    }
                }

                var paramTotalRecord = new OracleParameter("p_total_record", OracleDbType.Int32, ParameterDirection.Output);
                ds = OracleHelper.ExecuteDataset(Configuration.connectionString, CommandType.StoredProcedure, "pkg_s_function.proc_Function_Find",
                                                 new OracleParameter("p_functionName", OracleDbType.Varchar2, functionName, ParameterDirection.Input),
                                                 new OracleParameter("p_functionType", OracleDbType.Varchar2, functionType, ParameterDirection.Input),
                                                 new OracleParameter("p_href", OracleDbType.Varchar2, href, ParameterDirection.Input),
                                                 new OracleParameter("p_parentId", OracleDbType.Varchar2, parentId, ParameterDirection.Input),
                                                 new OracleParameter("p_level", OracleDbType.Varchar2, level, ParameterDirection.Input),

                                                 new OracleParameter("p_orderBy", OracleDbType.Varchar2, options.OrderBy, ParameterDirection.Input),
                                                 new OracleParameter("p_startAt", OracleDbType.Decimal, options.StartAt, ParameterDirection.Input),
                                                 new OracleParameter("p_endAt", OracleDbType.Decimal, options.EndAt, ParameterDirection.Input),
                                                 paramTotalRecord,
                                                 new OracleParameter("p_cursor", OracleDbType.RefCursor, ParameterDirection.Output));

                totalRecord = Convert.ToInt32(paramTotalRecord.Value.ToString());
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(ds);
        }
コード例 #2
0
ファイル: UserDA.cs プロジェクト: SangDD/Legaltech
        /// <summary>
        /// Find all user by key search
        /// </summary>
        /// <param name="keysSearch">contain collection of parameter of condition searching, split by '|'</param>
        /// <param name="options">contain collection of parameter to custom value return</param>
        /// <param name="totalRecord">Total record matching condition</param>
        /// <returns>Data set contain rows matching</returns>
        public static DataSet FindUser(string keysSearch, OptionFilter options, ref int totalRecord)
        {
            var ds = new DataSet();

            try
            {
                // Keys search
                var userName     = Null.NullString; // Find by near value matching of  UserName
                var fullName     = Null.NullString; // Find by near value matching of  FullName
                var departmentId = Null.NullString; // Array departmentId, split by ',' and user IN operator in sql for searching
                var type         = Null.NullString; // Find by near value matching of  GroupId
                var status       = Null.NullString; // Array Status, split by ',' and user IN operator in sql for searching
                if (!string.IsNullOrEmpty(keysSearch))
                {
                    var arrKeySearch = keysSearch.Split('|');
                    if (arrKeySearch.Length == 4)
                    {
                        userName = arrKeySearch[0];
                        fullName = arrKeySearch[1];
                        type     = KeySearch.FilterComboboxValue(arrKeySearch[2]);
                        status   = KeySearch.FilterComboboxValue(arrKeySearch[3]);
                    }
                }

                var paramTotalRecord = new OracleParameter("p_totalRecord", OracleDbType.Int32, ParameterDirection.Output);
                ds = OracleHelper.ExecuteDataset(Configuration.connectionString, CommandType.StoredProcedure, "pkg_s_users.proc_User_Find",
                                                 new OracleParameter("p_userName", OracleDbType.Varchar2, userName, ParameterDirection.Input),
                                                 new OracleParameter("p_fullName", OracleDbType.Varchar2, fullName, ParameterDirection.Input),

                                                 new OracleParameter("p_type", OracleDbType.Varchar2, type, ParameterDirection.Input),
                                                 new OracleParameter("p_status", OracleDbType.Varchar2, status, ParameterDirection.Input),

                                                 new OracleParameter("p_orderBy", OracleDbType.Varchar2, options.OrderBy, ParameterDirection.Input),
                                                 new OracleParameter("p_startAt", OracleDbType.Decimal, options.StartAt, ParameterDirection.Input),
                                                 new OracleParameter("p_endAt", OracleDbType.Decimal, options.EndAt, ParameterDirection.Input),
                                                 paramTotalRecord,
                                                 new OracleParameter("p_cursor", OracleDbType.RefCursor, ParameterDirection.Output));

                totalRecord = Convert.ToInt32(paramTotalRecord.Value.ToString());
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(ds);
        }