public IList<Operation> Find(Role role, int? status)
        {
            IList<Core.Business.Operation> operationlist = new List<Core.Business.Operation>();

            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@roleid", SqlDbType.Int, role.Id);
            sql.AddParameter("@status", SqlDbType.Int, status.Value);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlSearchInner);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Operation operation = new Core.Business.Operation();

                    if (!reader.IsDBNull(0)) operation.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) operation.Status = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) operation.AddDate = reader.GetDateTime(2);
                    if (!reader.IsDBNull(3)) operation.Name = reader.GetString(3);
                    if (!reader.IsDBNull(4)) operation.Controller = reader.GetString(4);
                    if (!reader.IsDBNull(5)) operation.Action = reader.GetString(5);

                    operation.MarkOld();
                    operationlist.Add(operation);
                }
                reader.Close();
            }
            return operationlist;
        }
        public Operation Find(string controller, string action)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Controller", SqlDbType.NVarChar, controller);
            sql.AddParameter("@Action", SqlDbType.NVarChar, action);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlFind);

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.Operation operation = new Core.Business.Operation();

                if (!reader.IsDBNull(0)) operation.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) operation.Status = reader.GetInt32(1);
                if (!reader.IsDBNull(2)) operation.AddDate = reader.GetDateTime(2);
                if (!reader.IsDBNull(3)) operation.Name = reader.GetString(3);
                if (!reader.IsDBNull(4)) operation.Controller = reader.GetString(4);
                if (!reader.IsDBNull(5)) operation.Action = reader.GetString(5);

                reader.Close();
                return operation;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
        public PagedList<Core.Business.Operation> Search(OperationSearch search)
        {
            IList<Core.Business.Operation> operationlist = new List<Core.Business.Operation>();
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Name", SqlDbType.NVarChar, !string.IsNullOrEmpty(search.Name) ? (object)search.Name : (object)DBNull.Value);
            sql.AddParameter("@Controller", SqlDbType.NVarChar, !string.IsNullOrEmpty(search.ControllerName) ? (object)search.ControllerName : (object)DBNull.Value);
            sql.AddParameter("@Action", SqlDbType.NVarChar, !string.IsNullOrEmpty(search.ActionName) ? (object)search.ActionName : (object)DBNull.Value);
            sql.AddParameter("@Status", SqlDbType.Int, search.Status != null ? (object)search.Status.Value : (object)DBNull.Value);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlSearch);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Operation operation = new Core.Business.Operation();

                    if (!reader.IsDBNull(0)) operation.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) operation.Status = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) operation.AddDate = reader.GetDateTime(2);
                    if (!reader.IsDBNull(3)) operation.Name = reader.GetString(3);
                    if (!reader.IsDBNull(4)) operation.Controller = reader.GetString(4);
                    if (!reader.IsDBNull(5)) operation.Action = reader.GetString(5);

                    operation.MarkOld();
                    operationlist.Add(operation);
                }
                reader.Close();
            }
            return new PagedList<Operation>(operationlist, 0, 100, 1000);
        }
        public Core.Business.Operation Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.Int, id);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectOperation);

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.Operation operation = new Core.Business.Operation();

                if (!reader.IsDBNull(0)) operation.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) operation.Status = reader.GetInt32(1);
                if (!reader.IsDBNull(2)) operation.AddDate = reader.GetDateTime(2);
                if (!reader.IsDBNull(3)) operation.Name = reader.GetString(3);
                if (!reader.IsDBNull(4)) operation.Controller = reader.GetString(4);
                if (!reader.IsDBNull(5)) operation.Action = reader.GetString(5);

                reader.Close();
                return operation;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
        public IList<Core.Business.Operation> GetAllOperation()
        {
            IList<Core.Business.Operation> operationlist = new List<Core.Business.Operation>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllOperation);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Operation operation = new Core.Business.Operation();

                    if (!reader.IsDBNull(0)) operation.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) operation.Status = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) operation.AddDate = reader.GetDateTime(2);
                    if (!reader.IsDBNull(3)) operation.Name = reader.GetString(3);
                    if (!reader.IsDBNull(4)) operation.Controller = reader.GetString(4);
                    if (!reader.IsDBNull(5)) operation.Action = reader.GetString(5);

                    operation.MarkOld();
                    operationlist.Add(operation);
                }
                reader.Close();
            }
            return operationlist;
        }